cli: model name substitution fix, release 0.0.23 (#22089)

This commit is contained in:
Erick Friis 2024-05-23 13:09:38 -07:00 committed by GitHub
parent 18b8c8628a
commit 95c3e5f85f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 19 deletions

View File

@ -1,4 +1,5 @@
"""__ModuleName__ chat models.""" """__ModuleName__ chat models."""
from typing import Any, AsyncIterator, Iterator, List, Optional from typing import Any, AsyncIterator, Iterator, List, Optional
from langchain_core.callbacks import ( from langchain_core.callbacks import (
@ -29,6 +30,7 @@ class Chat__ModuleName__(BaseChatModel):
"""Return type of chat model.""" """Return type of chat model."""
return "chat-__package_name_short__" return "chat-__package_name_short__"
# TODO: This method must be implemented to generate chat responses.
def _generate( def _generate(
self, self,
messages: List[BaseMessage], messages: List[BaseMessage],
@ -38,7 +40,7 @@ class Chat__ModuleName__(BaseChatModel):
) -> ChatResult: ) -> ChatResult:
raise NotImplementedError raise NotImplementedError
# TODO: Implement if __model_name__ supports streaming. Otherwise delete method. # TODO: Implement if Chat__ModuleName__ supports streaming. Otherwise delete method.
def _stream( def _stream(
self, self,
messages: List[BaseMessage], messages: List[BaseMessage],
@ -48,7 +50,7 @@ class Chat__ModuleName__(BaseChatModel):
) -> Iterator[ChatGenerationChunk]: ) -> Iterator[ChatGenerationChunk]:
raise NotImplementedError raise NotImplementedError
# TODO: Implement if __model_name__ supports async streaming. Otherwise delete # TODO: Implement if Chat__ModuleName__ supports async streaming. Otherwise delete
# method. # method.
async def _astream( async def _astream(
self, self,
@ -59,7 +61,7 @@ class Chat__ModuleName__(BaseChatModel):
) -> AsyncIterator[ChatGenerationChunk]: ) -> AsyncIterator[ChatGenerationChunk]:
raise NotImplementedError raise NotImplementedError
# TODO: Implement if __model_name__ supports async generation. Otherwise delete # TODO: Implement if Chat__ModuleName__ supports async generation. Otherwise delete
# method. # method.
async def _agenerate( async def _agenerate(
self, self,

View File

@ -1,4 +1,5 @@
"""__ModuleName__ large language models.""" """__ModuleName__ large language models."""
from typing import ( from typing import (
Any, Any,
AsyncIterator, AsyncIterator,
@ -32,6 +33,7 @@ class __ModuleName__LLM(BaseLLM):
"""Return type of LLM.""" """Return type of LLM."""
return "__package_name_short__-llm" return "__package_name_short__-llm"
# TODO: This method must be implemented to generate text completions.
def _generate( def _generate(
self, self,
prompts: List[str], prompts: List[str],
@ -41,7 +43,7 @@ class __ModuleName__LLM(BaseLLM):
) -> LLMResult: ) -> LLMResult:
raise NotImplementedError raise NotImplementedError
# TODO: Implement if __model_name__ supports async generation. Otherwise # TODO: Implement if __ModuleName__LLM supports async generation. Otherwise
# delete method. # delete method.
async def _agenerate( async def _agenerate(
self, self,
@ -52,7 +54,7 @@ class __ModuleName__LLM(BaseLLM):
) -> LLMResult: ) -> LLMResult:
raise NotImplementedError raise NotImplementedError
# TODO: Implement if __model_name__ supports streaming. Otherwise delete method. # TODO: Implement if __ModuleName__LLM supports streaming. Otherwise delete method.
def _stream( def _stream(
self, self,
prompt: str, prompt: str,
@ -62,7 +64,7 @@ class __ModuleName__LLM(BaseLLM):
) -> Iterator[GenerationChunk]: ) -> Iterator[GenerationChunk]:
raise NotImplementedError raise NotImplementedError
# TODO: Implement if __model_name__ supports async streaming. Otherwise delete # TODO: Implement if __ModuleName__LLM supports async streaming. Otherwise delete
# method. # method.
async def _astream( async def _astream(
self, self,

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "__package_name__" name = "__package_name__"
version = "0.0.1" version = "0.1.0"
description = "An integration package connecting __ModuleName__ and LangChain" description = "An integration package connecting __ModuleName__ and LangChain"
authors = [] authors = []
readme = "README.md" readme = "README.md"
@ -12,7 +12,7 @@ license = "MIT"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = ">=3.8.1,<4.0" python = ">=3.8.1,<4.0"
langchain-core = ">=0.1,<0.3" langchain-core = "^0.2.0"
[tool.poetry.group.test] [tool.poetry.group.test]
optional = true optional = true
@ -21,7 +21,7 @@ optional = true
pytest = "^7.4.3" pytest = "^7.4.3"
pytest-asyncio = "^0.23.2" pytest-asyncio = "^0.23.2"
pytest-socket = "^0.7.0" pytest-socket = "^0.7.0"
langchain-core = {path = "../../core", develop = true} langchain-core = { path = "../../core", develop = true }
[tool.poetry.group.codespell] [tool.poetry.group.codespell]
optional = true optional = true
@ -42,19 +42,19 @@ ruff = "^0.1.8"
[tool.poetry.group.typing.dependencies] [tool.poetry.group.typing.dependencies]
mypy = "^1.7.1" mypy = "^1.7.1"
langchain-core = {path = "../../core", develop = true} langchain-core = { path = "../../core", develop = true }
[tool.poetry.group.dev] [tool.poetry.group.dev]
optional = true optional = true
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
langchain-core = {path = "../../core", develop = true} langchain-core = { path = "../../core", develop = true }
[tool.ruff.lint] [tool.ruff.lint]
select = [ select = [
"E", # pycodestyle "E", # pycodestyle
"F", # pyflakes "F", # pyflakes
"I", # isort "I", # isort
"T201", # print "T201", # print
] ]
@ -62,9 +62,7 @@ select = [
disallow_untyped_defs = "True" disallow_untyped_defs = "True"
[tool.coverage.run] [tool.coverage.run]
omit = [ omit = ["tests/*"]
"tests/*",
]
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]

View File

@ -123,7 +123,9 @@ def new(
typer.echo(f" cd ./{app_name}\n") typer.echo(f" cd ./{app_name}\n")
typer.echo("Then add templates with commands like:\n") typer.echo("Then add templates with commands like:\n")
typer.echo(" langchain app add extraction-openai-functions") typer.echo(" langchain app add extraction-openai-functions")
typer.echo(" langchain app add git+ssh://git@github.com/efriis/simple-pirate.git\n\n") typer.echo(
" langchain app add git+ssh://git@github.com/efriis/simple-pirate.git\n\n"
)
@app_cli.command() @app_cli.command()

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "langchain-cli" name = "langchain-cli"
version = "0.0.22" version = "0.0.23"
description = "CLI for interacting with LangChain" description = "CLI for interacting with LangChain"
authors = ["Erick Friis <erick@langchain.dev>"] authors = ["Erick Friis <erick@langchain.dev>"]
readme = "README.md" readme = "README.md"