From 95c3e5f85f8ed8026a11e351b57bfae488d654c4 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Thu, 23 May 2024 13:09:38 -0700 Subject: [PATCH] cli: model name substitution fix, release 0.0.23 (#22089) --- .../integration_template/chat_models.py | 8 +++++--- .../integration_template/llms.py | 8 +++++--- .../integration_template/pyproject.toml | 20 +++++++++---------- libs/cli/langchain_cli/namespaces/app.py | 4 +++- libs/cli/pyproject.toml | 2 +- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/libs/cli/langchain_cli/integration_template/integration_template/chat_models.py b/libs/cli/langchain_cli/integration_template/integration_template/chat_models.py index df191524542..8835b4dde45 100644 --- a/libs/cli/langchain_cli/integration_template/integration_template/chat_models.py +++ b/libs/cli/langchain_cli/integration_template/integration_template/chat_models.py @@ -1,4 +1,5 @@ """__ModuleName__ chat models.""" + from typing import Any, AsyncIterator, Iterator, List, Optional from langchain_core.callbacks import ( @@ -29,6 +30,7 @@ class Chat__ModuleName__(BaseChatModel): """Return type of chat model.""" return "chat-__package_name_short__" + # TODO: This method must be implemented to generate chat responses. def _generate( self, messages: List[BaseMessage], @@ -38,7 +40,7 @@ class Chat__ModuleName__(BaseChatModel): ) -> ChatResult: raise NotImplementedError - # TODO: Implement if __model_name__ supports streaming. Otherwise delete method. + # TODO: Implement if Chat__ModuleName__ supports streaming. Otherwise delete method. def _stream( self, messages: List[BaseMessage], @@ -48,7 +50,7 @@ class Chat__ModuleName__(BaseChatModel): ) -> Iterator[ChatGenerationChunk]: raise NotImplementedError - # TODO: Implement if __model_name__ supports async streaming. Otherwise delete + # TODO: Implement if Chat__ModuleName__ supports async streaming. Otherwise delete # method. async def _astream( self, @@ -59,7 +61,7 @@ class Chat__ModuleName__(BaseChatModel): ) -> AsyncIterator[ChatGenerationChunk]: raise NotImplementedError - # TODO: Implement if __model_name__ supports async generation. Otherwise delete + # TODO: Implement if Chat__ModuleName__ supports async generation. Otherwise delete # method. async def _agenerate( self, diff --git a/libs/cli/langchain_cli/integration_template/integration_template/llms.py b/libs/cli/langchain_cli/integration_template/integration_template/llms.py index 562fc0f4001..675e95f158d 100644 --- a/libs/cli/langchain_cli/integration_template/integration_template/llms.py +++ b/libs/cli/langchain_cli/integration_template/integration_template/llms.py @@ -1,4 +1,5 @@ """__ModuleName__ large language models.""" + from typing import ( Any, AsyncIterator, @@ -32,6 +33,7 @@ class __ModuleName__LLM(BaseLLM): """Return type of LLM.""" return "__package_name_short__-llm" + # TODO: This method must be implemented to generate text completions. def _generate( self, prompts: List[str], @@ -41,7 +43,7 @@ class __ModuleName__LLM(BaseLLM): ) -> LLMResult: raise NotImplementedError - # TODO: Implement if __model_name__ supports async generation. Otherwise + # TODO: Implement if __ModuleName__LLM supports async generation. Otherwise # delete method. async def _agenerate( self, @@ -52,7 +54,7 @@ class __ModuleName__LLM(BaseLLM): ) -> LLMResult: raise NotImplementedError - # TODO: Implement if __model_name__ supports streaming. Otherwise delete method. + # TODO: Implement if __ModuleName__LLM supports streaming. Otherwise delete method. def _stream( self, prompt: str, @@ -62,7 +64,7 @@ class __ModuleName__LLM(BaseLLM): ) -> Iterator[GenerationChunk]: raise NotImplementedError - # TODO: Implement if __model_name__ supports async streaming. Otherwise delete + # TODO: Implement if __ModuleName__LLM supports async streaming. Otherwise delete # method. async def _astream( self, diff --git a/libs/cli/langchain_cli/integration_template/pyproject.toml b/libs/cli/langchain_cli/integration_template/pyproject.toml index 4b134979873..d7752864b0d 100644 --- a/libs/cli/langchain_cli/integration_template/pyproject.toml +++ b/libs/cli/langchain_cli/integration_template/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "__package_name__" -version = "0.0.1" +version = "0.1.0" description = "An integration package connecting __ModuleName__ and LangChain" authors = [] readme = "README.md" @@ -12,7 +12,7 @@ license = "MIT" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" -langchain-core = ">=0.1,<0.3" +langchain-core = "^0.2.0" [tool.poetry.group.test] optional = true @@ -21,7 +21,7 @@ optional = true pytest = "^7.4.3" pytest-asyncio = "^0.23.2" pytest-socket = "^0.7.0" -langchain-core = {path = "../../core", develop = true} +langchain-core = { path = "../../core", develop = true } [tool.poetry.group.codespell] optional = true @@ -42,19 +42,19 @@ ruff = "^0.1.8" [tool.poetry.group.typing.dependencies] mypy = "^1.7.1" -langchain-core = {path = "../../core", develop = true} +langchain-core = { path = "../../core", develop = true } [tool.poetry.group.dev] optional = true [tool.poetry.group.dev.dependencies] -langchain-core = {path = "../../core", develop = true} +langchain-core = { path = "../../core", develop = true } [tool.ruff.lint] select = [ - "E", # pycodestyle - "F", # pyflakes - "I", # isort + "E", # pycodestyle + "F", # pyflakes + "I", # isort "T201", # print ] @@ -62,9 +62,7 @@ select = [ disallow_untyped_defs = "True" [tool.coverage.run] -omit = [ - "tests/*", -] +omit = ["tests/*"] [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/libs/cli/langchain_cli/namespaces/app.py b/libs/cli/langchain_cli/namespaces/app.py index 03e8245c88d..9bf007652b4 100644 --- a/libs/cli/langchain_cli/namespaces/app.py +++ b/libs/cli/langchain_cli/namespaces/app.py @@ -123,7 +123,9 @@ def new( typer.echo(f" cd ./{app_name}\n") typer.echo("Then add templates with commands like:\n") 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() diff --git a/libs/cli/pyproject.toml b/libs/cli/pyproject.toml index 079f84dce5b..03b1bda1fe8 100644 --- a/libs/cli/pyproject.toml +++ b/libs/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langchain-cli" -version = "0.0.22" +version = "0.0.23" description = "CLI for interacting with LangChain" authors = ["Erick Friis "] readme = "README.md"