diff --git a/langchain_benchmarks/__init__.py b/langchain_benchmarks/__init__.py index f7922812..3dc67486 100644 --- a/langchain_benchmarks/__init__.py +++ b/langchain_benchmarks/__init__.py @@ -1,3 +1,5 @@ +from importlib import metadata + from langchain_benchmarks.model_registration import model_registry from langchain_benchmarks.rate_limiting import RateLimiter from langchain_benchmarks.registration import registry @@ -6,8 +8,17 @@ download_public_dataset, ) +try: + __version__ = metadata.version(__package__) +except metadata.PackageNotFoundError: + # Case where package metadata is not available. + __version__ = "" +del metadata # optional, avoids polluting the results of dir(__package__) + + # Please keep this list sorted! __all__ = [ + "__version__", "clone_public_dataset", "download_public_dataset", "model_registry", diff --git a/langchain_benchmarks/tool_usage/agents/adapters.py b/langchain_benchmarks/tool_usage/agents/adapters.py index 29bd3ddf..be060f8e 100644 --- a/langchain_benchmarks/tool_usage/agents/adapters.py +++ b/langchain_benchmarks/tool_usage/agents/adapters.py @@ -1,4 +1,4 @@ -from typing import Optional, Callable, Any +from typing import Any, Callable, Optional from langchain.agents import AgentExecutor from langchain_core.runnables import Runnable, RunnableLambda, RunnablePassthrough diff --git a/langchain_benchmarks/tool_usage/agents/experimental/agent.py b/langchain_benchmarks/tool_usage/agents/experimental/agent.py index 14ba932d..87ada85e 100644 --- a/langchain_benchmarks/tool_usage/agents/experimental/agent.py +++ b/langchain_benchmarks/tool_usage/agents/experimental/agent.py @@ -6,7 +6,7 @@ from langchain.tools import StructuredTool from langchain_core.agents import AgentAction, AgentFinish from langchain_core.language_models import BaseChatModel, BaseLanguageModel -from langchain_core.messages import BaseMessage, HumanMessage, AIMessage +from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langchain_core.prompts import MessagesPlaceholder from typing_extensions import NotRequired, TypedDict @@ -14,10 +14,10 @@ from langchain_benchmarks.rate_limiting import with_rate_limit from langchain_benchmarks.tool_usage.agents.experimental.encoder import ( AstPrinter, + FunctionResult, TypeScriptEncoder, XMLEncoder, ) -from langchain_benchmarks.tool_usage.agents.experimental.encoder import FunctionResult from langchain_benchmarks.tool_usage.agents.experimental.prompts import ( _AGENT_INSTRUCTIONS_BLOB_STYLE, ) diff --git a/langchain_benchmarks/tool_usage/agents/experimental/parser.py b/langchain_benchmarks/tool_usage/agents/experimental/parser.py index 7be09776..002ddf02 100644 --- a/langchain_benchmarks/tool_usage/agents/experimental/parser.py +++ b/langchain_benchmarks/tool_usage/agents/experimental/parser.py @@ -1,6 +1,6 @@ import ast import re -from typing import Union, Dict, Optional +from typing import Dict, Optional, Union from langchain.agents import AgentOutputParser from langchain.pydantic_v1 import BaseModel, Field diff --git a/langchain_benchmarks/tool_usage/agents/experimental/tool_utils.py b/langchain_benchmarks/tool_usage/agents/experimental/tool_utils.py index 976fc061..04fed82b 100644 --- a/langchain_benchmarks/tool_usage/agents/experimental/tool_utils.py +++ b/langchain_benchmarks/tool_usage/agents/experimental/tool_utils.py @@ -6,8 +6,8 @@ from langchain.tools.base import StructuredTool from langchain_benchmarks.tool_usage.agents.experimental.encoder import ( - Parameter, FunctionDefinition, + Parameter, ) # PUBLIC API diff --git a/langchain_benchmarks/tool_usage/agents/openai_functions.py b/langchain_benchmarks/tool_usage/agents/openai_functions.py index 32186d02..46389ca8 100644 --- a/langchain_benchmarks/tool_usage/agents/openai_functions.py +++ b/langchain_benchmarks/tool_usage/agents/openai_functions.py @@ -13,7 +13,6 @@ from langchain_benchmarks.schema import ToolUsageTask from langchain_benchmarks.tool_usage.agents.adapters import apply_agent_executor_adapter - # PUBLIC API diff --git a/tests/unit_tests/agents/encoding_and_decoding/test_decoding.py b/tests/unit_tests/agents/encoding_and_decoding/test_decoding.py index 5a416cfa..5ed5da7a 100644 --- a/tests/unit_tests/agents/encoding_and_decoding/test_decoding.py +++ b/tests/unit_tests/agents/encoding_and_decoding/test_decoding.py @@ -1,5 +1,5 @@ import pytest -from langchain_core.agents import AgentFinish, AgentActionMessageLog +from langchain_core.agents import AgentActionMessageLog, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.messages import AIMessage diff --git a/tests/unit_tests/test_public_api.py b/tests/unit_tests/test_public_api.py index b6b57651..4134e77c 100644 --- a/tests/unit_tests/test_public_api.py +++ b/tests/unit_tests/test_public_api.py @@ -7,6 +7,7 @@ def test_public_api() -> None: # Please keep it sorted! assert __all__ == sorted( [ + "__version__", "clone_public_dataset", "download_public_dataset", "model_registry",