diff --git a/libs/langchain/langchain/__init__.py b/libs/langchain/langchain/__init__.py
index 0628b251a68..63de57ef4c2 100644
--- a/libs/langchain/langchain/__init__.py
+++ b/libs/langchain/langchain/__init__.py
@@ -1,4 +1,3 @@
-# ruff: noqa: E402
"""Main entrypoint into package."""
import warnings
@@ -391,50 +390,50 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "FAISS",
+ "Anthropic",
+ "ArxivAPIWrapper",
+ "Banana",
+ "BasePromptTemplate",
+ "CerebriumAI",
+ "Cohere",
+ "ConversationChain",
+ "ElasticVectorSearch",
+ "FewShotPromptTemplate",
+ "ForefrontAI",
+ "GoldenQueryAPIWrapper",
+ "GoogleSearchAPIWrapper",
+ "GoogleSerperAPIWrapper",
+ "GooseAI",
+ "HuggingFaceHub",
+ "HuggingFacePipeline",
+ "HuggingFaceTextGenInference",
+ "InMemoryDocstore",
"LLMChain",
"LLMCheckerChain",
"LLMMathChain",
- "ArxivAPIWrapper",
- "GoldenQueryAPIWrapper",
- "SelfAskWithSearchChain",
- "SerpAPIWrapper",
- "SerpAPIChain",
- "SearxSearchWrapper",
- "GoogleSearchAPIWrapper",
- "GoogleSerperAPIWrapper",
- "WolframAlphaAPIWrapper",
- "WikipediaAPIWrapper",
- "Anthropic",
- "Banana",
- "CerebriumAI",
- "Cohere",
- "ForefrontAI",
- "GooseAI",
+ "LlamaCpp",
+ "MRKLChain",
"Modal",
"OpenAI",
"Petals",
"PipelineAI",
- "StochasticAI",
- "Writer",
- "BasePromptTemplate",
- "Prompt",
- "FewShotPromptTemplate",
- "PromptTemplate",
- "ReActChain",
- "Wikipedia",
- "HuggingFaceHub",
- "SagemakerEndpoint",
- "HuggingFacePipeline",
- "SQLDatabase",
"PowerBIDataset",
- "FAISS",
- "MRKLChain",
- "VectorDBQA",
- "ElasticVectorSearch",
- "InMemoryDocstore",
- "ConversationChain",
- "VectorDBQAWithSourcesChain",
+ "Prompt",
+ "PromptTemplate",
"QAWithSourcesChain",
- "LlamaCpp",
- "HuggingFaceTextGenInference",
+ "ReActChain",
+ "SQLDatabase",
+ "SagemakerEndpoint",
+ "SearxSearchWrapper",
+ "SelfAskWithSearchChain",
+ "SerpAPIChain",
+ "SerpAPIWrapper",
+ "StochasticAI",
+ "VectorDBQA",
+ "VectorDBQAWithSourcesChain",
+ "Wikipedia",
+ "WikipediaAPIWrapper",
+ "WolframAlphaAPIWrapper",
+ "Writer",
]
diff --git a/libs/langchain/langchain/_api/__init__.py b/libs/langchain/langchain/_api/__init__.py
index 1f746db82aa..c80cf8c6631 100644
--- a/libs/langchain/langchain/_api/__init__.py
+++ b/libs/langchain/langchain/_api/__init__.py
@@ -19,10 +19,10 @@ from .deprecation import (
from .module_import import create_importer
__all__ = [
- "deprecated",
"LangChainDeprecationWarning",
+ "create_importer",
+ "deprecated",
"suppress_langchain_deprecation_warning",
"surface_langchain_deprecation_warnings",
"warn_deprecated",
- "create_importer",
]
diff --git a/libs/langchain/langchain/_api/deprecation.py b/libs/langchain/langchain/_api/deprecation.py
index 6d5f2cf6895..634e21944d7 100644
--- a/libs/langchain/langchain/_api/deprecation.py
+++ b/libs/langchain/langchain/_api/deprecation.py
@@ -15,9 +15,9 @@ AGENT_DEPRECATION_WARNING = (
"details, refer to the "
"`LangGraph documentation `_"
" as well as guides for "
- "`Migrating from AgentExecutor `_" # noqa: E501
+ "`Migrating from AgentExecutor `_"
" and LangGraph's "
- "`Pre-built ReAct agent `_." # noqa: E501
+ "`Pre-built ReAct agent `_."
)
@@ -27,6 +27,6 @@ __all__ = [
"LangChainPendingDeprecationWarning",
"deprecated",
"suppress_langchain_deprecation_warning",
- "warn_deprecated",
"surface_langchain_deprecation_warnings",
+ "warn_deprecated",
]
diff --git a/libs/langchain/langchain/_api/path.py b/libs/langchain/langchain/_api/path.py
index 5ee0fe817da..d5426862699 100644
--- a/libs/langchain/langchain/_api/path.py
+++ b/libs/langchain/langchain/_api/path.py
@@ -1,3 +1,3 @@
from langchain_core._api.path import as_import_path, get_relative_path
-__all__ = ["get_relative_path", "as_import_path"]
+__all__ = ["as_import_path", "get_relative_path"]
diff --git a/libs/langchain/langchain/adapters/openai.py b/libs/langchain/langchain/adapters/openai.py
index 445eccd56bd..79684273b46 100644
--- a/libs/langchain/langchain/adapters/openai.py
+++ b/libs/langchain/langchain/adapters/openai.py
@@ -47,17 +47,17 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "IndexableBaseModel",
- "Choice",
- "ChatCompletions",
- "ChoiceChunk",
+ "Chat",
+ "ChatCompletion",
"ChatCompletionChunk",
+ "ChatCompletions",
+ "Choice",
+ "ChoiceChunk",
+ "Completions",
+ "IndexableBaseModel",
+ "chat",
"convert_dict_to_message",
"convert_message_to_dict",
- "convert_openai_messages",
- "ChatCompletion",
"convert_messages_for_finetuning",
- "Completions",
- "Chat",
- "chat",
+ "convert_openai_messages",
]
diff --git a/libs/langchain/langchain/agents/__init__.py b/libs/langchain/langchain/agents/__init__.py
index 7e99899d38c..73533226520 100644
--- a/libs/langchain/langchain/agents/__init__.py
+++ b/libs/langchain/langchain/agents/__init__.py
@@ -154,29 +154,29 @@ __all__ = [
"ReActTextWorldAgent",
"SelfAskWithSearchChain",
"StructuredChatAgent",
+ "Tool",
+ "XMLAgent",
"ZeroShotAgent",
"create_json_agent",
+ "create_json_chat_agent",
+ "create_openai_functions_agent",
+ "create_openai_tools_agent",
"create_openapi_agent",
"create_pbi_agent",
"create_pbi_chat_agent",
+ "create_react_agent",
+ "create_self_ask_with_search_agent",
"create_spark_sql_agent",
"create_sql_agent",
+ "create_structured_chat_agent",
+ "create_tool_calling_agent",
"create_vectorstore_agent",
"create_vectorstore_router_agent",
+ "create_xml_agent",
"get_all_tool_names",
"initialize_agent",
"load_agent",
"load_huggingface_tool",
"load_tools",
- "XMLAgent",
- "create_openai_functions_agent",
- "create_xml_agent",
- "create_react_agent",
- "create_openai_tools_agent",
- "create_self_ask_with_search_agent",
- "create_json_chat_agent",
- "create_structured_chat_agent",
- "create_tool_calling_agent",
- "Tool",
"tool",
]
diff --git a/libs/langchain/langchain/agents/agent.py b/libs/langchain/langchain/agents/agent.py
index d0fa9d376a1..f860d40361c 100644
--- a/libs/langchain/langchain/agents/agent.py
+++ b/libs/langchain/langchain/agents/agent.py
@@ -1241,7 +1241,7 @@ class AgentExecutor(Chain):
:meta private:
"""
if self.return_intermediate_steps:
- return self._action_agent.return_values + ["intermediate_steps"]
+ return [*self._action_agent.return_values, "intermediate_steps"]
return self._action_agent.return_values
def lookup_tool(self, name: str) -> BaseTool:
@@ -1349,7 +1349,7 @@ class AgentExecutor(Chain):
"An output parsing error occurred. "
"In order to pass this error back to the agent and have it try "
"again, pass `handle_parsing_errors=True` to the AgentExecutor. "
- f"This is the error: {str(e)}"
+ f"This is the error: {e!s}"
)
raise ValueError(msg)
text = str(e)
@@ -1485,7 +1485,7 @@ class AgentExecutor(Chain):
"An output parsing error occurred. "
"In order to pass this error back to the agent and have it try "
"again, pass `handle_parsing_errors=True` to the AgentExecutor. "
- f"This is the error: {str(e)}"
+ f"This is the error: {e!s}"
)
raise ValueError(msg)
text = str(e)
diff --git a/libs/langchain/langchain/agents/agent_toolkits/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/__init__.py
index 3c8d3062ac4..e05174caad0 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/__init__.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/__init__.py
@@ -140,28 +140,28 @@ __all__ = [
"JiraToolkit",
"JsonToolkit",
"MultionToolkit",
- "NasaToolkit",
"NLAToolkit",
+ "NasaToolkit",
"O365Toolkit",
"OpenAPIToolkit",
"PlayWrightBrowserToolkit",
"PowerBIToolkit",
- "SlackToolkit",
- "SteamToolkit",
"SQLDatabaseToolkit",
+ "SlackToolkit",
"SparkSQLToolkit",
+ "SteamToolkit",
"VectorStoreInfo",
"VectorStoreRouterToolkit",
"VectorStoreToolkit",
"ZapierToolkit",
+ "create_conversational_retrieval_agent",
"create_json_agent",
"create_openapi_agent",
"create_pbi_agent",
"create_pbi_chat_agent",
+ "create_retriever_tool",
"create_spark_sql_agent",
"create_sql_agent",
"create_vectorstore_agent",
"create_vectorstore_router_agent",
- "create_conversational_retrieval_agent",
- "create_retriever_tool",
]
diff --git a/libs/langchain/langchain/agents/agent_toolkits/github/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/github/toolkit.py
index c5ce5db62d2..148525725d5 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/github/toolkit.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/github/toolkit.py
@@ -51,19 +51,19 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "NoInput",
- "GetIssue",
+ "BranchName",
"CommentOnIssue",
- "GetPR",
- "CreatePR",
"CreateFile",
- "ReadFile",
- "UpdateFile",
+ "CreatePR",
+ "CreateReviewRequest",
"DeleteFile",
"DirectoryPath",
- "BranchName",
- "SearchCode",
- "CreateReviewRequest",
- "SearchIssuesAndPRs",
+ "GetIssue",
+ "GetPR",
"GitHubToolkit",
+ "NoInput",
+ "ReadFile",
+ "SearchCode",
+ "SearchIssuesAndPRs",
+ "UpdateFile",
]
diff --git a/libs/langchain/langchain/agents/agent_toolkits/openapi/planner.py b/libs/langchain/langchain/agents/agent_toolkits/openapi/planner.py
index ad276207c0e..b9e27ded262 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/openapi/planner.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/openapi/planner.py
@@ -43,10 +43,10 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "RequestsGetToolWithParsing",
- "RequestsPostToolWithParsing",
- "RequestsPatchToolWithParsing",
- "RequestsPutToolWithParsing",
"RequestsDeleteToolWithParsing",
+ "RequestsGetToolWithParsing",
+ "RequestsPatchToolWithParsing",
+ "RequestsPostToolWithParsing",
+ "RequestsPutToolWithParsing",
"create_openapi_agent",
]
diff --git a/libs/langchain/langchain/agents/agent_toolkits/openapi/planner_prompt.py b/libs/langchain/langchain/agents/agent_toolkits/openapi/planner_prompt.py
index 6ab49fc66c1..27f64f184b1 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/openapi/planner_prompt.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/openapi/planner_prompt.py
@@ -83,21 +83,21 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "API_PLANNER_PROMPT",
- "API_PLANNER_TOOL_NAME",
- "API_PLANNER_TOOL_DESCRIPTION",
"API_CONTROLLER_PROMPT",
- "API_CONTROLLER_TOOL_NAME",
"API_CONTROLLER_TOOL_DESCRIPTION",
+ "API_CONTROLLER_TOOL_NAME",
"API_ORCHESTRATOR_PROMPT",
- "REQUESTS_GET_TOOL_DESCRIPTION",
+ "API_PLANNER_PROMPT",
+ "API_PLANNER_TOOL_DESCRIPTION",
+ "API_PLANNER_TOOL_NAME",
+ "PARSING_DELETE_PROMPT",
"PARSING_GET_PROMPT",
- "REQUESTS_POST_TOOL_DESCRIPTION",
- "PARSING_POST_PROMPT",
- "REQUESTS_PATCH_TOOL_DESCRIPTION",
"PARSING_PATCH_PROMPT",
- "REQUESTS_PUT_TOOL_DESCRIPTION",
+ "PARSING_POST_PROMPT",
"PARSING_PUT_PROMPT",
"REQUESTS_DELETE_TOOL_DESCRIPTION",
- "PARSING_DELETE_PROMPT",
+ "REQUESTS_GET_TOOL_DESCRIPTION",
+ "REQUESTS_PATCH_TOOL_DESCRIPTION",
+ "REQUESTS_POST_TOOL_DESCRIPTION",
+ "REQUESTS_PUT_TOOL_DESCRIPTION",
]
diff --git a/libs/langchain/langchain/agents/agent_toolkits/openapi/prompt.py b/libs/langchain/langchain/agents/agent_toolkits/openapi/prompt.py
index 7f124bad0d9..1f30bd4bbcb 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/openapi/prompt.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/openapi/prompt.py
@@ -26,4 +26,4 @@ def __getattr__(name: str) -> Any:
return _import_attribute(name)
-__all__ = ["OPENAPI_PREFIX", "OPENAPI_SUFFIX", "DESCRIPTION"]
+__all__ = ["DESCRIPTION", "OPENAPI_PREFIX", "OPENAPI_SUFFIX"]
diff --git a/libs/langchain/langchain/agents/agent_toolkits/openapi/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/openapi/toolkit.py
index bb20794b8e1..106c908fda2 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/openapi/toolkit.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/openapi/toolkit.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "RequestsToolkit",
"OpenAPIToolkit",
+ "RequestsToolkit",
]
diff --git a/libs/langchain/langchain/agents/agent_toolkits/powerbi/prompt.py b/libs/langchain/langchain/agents/agent_toolkits/powerbi/prompt.py
index 325dbe08613..386f9cac0c6 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/powerbi/prompt.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/powerbi/prompt.py
@@ -29,8 +29,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "POWERBI_PREFIX",
- "POWERBI_SUFFIX",
"POWERBI_CHAT_PREFIX",
"POWERBI_CHAT_SUFFIX",
+ "POWERBI_PREFIX",
+ "POWERBI_SUFFIX",
]
diff --git a/libs/langchain/langchain/agents/agent_toolkits/sql/prompt.py b/libs/langchain/langchain/agents/agent_toolkits/sql/prompt.py
index e06162b62b7..86ab8b6d5e7 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/sql/prompt.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/sql/prompt.py
@@ -26,4 +26,4 @@ def __getattr__(name: str) -> Any:
return _import_attribute(name)
-__all__ = ["SQL_PREFIX", "SQL_SUFFIX", "SQL_FUNCTIONS_SUFFIX"]
+__all__ = ["SQL_FUNCTIONS_SUFFIX", "SQL_PREFIX", "SQL_SUFFIX"]
diff --git a/libs/langchain/langchain/agents/format_scratchpad/__init__.py b/libs/langchain/langchain/agents/format_scratchpad/__init__.py
index c34745e55b4..39fc083d57e 100644
--- a/libs/langchain/langchain/agents/format_scratchpad/__init__.py
+++ b/libs/langchain/langchain/agents/format_scratchpad/__init__.py
@@ -16,10 +16,10 @@ from langchain.agents.format_scratchpad.tools import format_to_tool_messages
from langchain.agents.format_scratchpad.xml import format_xml
__all__ = [
- "format_xml",
+ "format_log_to_messages",
+ "format_log_to_str",
"format_to_openai_function_messages",
"format_to_openai_functions",
"format_to_tool_messages",
- "format_log_to_str",
- "format_log_to_messages",
+ "format_xml",
]
diff --git a/libs/langchain/langchain/agents/format_scratchpad/openai_functions.py b/libs/langchain/langchain/agents/format_scratchpad/openai_functions.py
index ee08a8f8a27..3055cc05545 100644
--- a/libs/langchain/langchain/agents/format_scratchpad/openai_functions.py
+++ b/libs/langchain/langchain/agents/format_scratchpad/openai_functions.py
@@ -20,8 +20,9 @@ def _convert_agent_action_to_messages(
the original tool invocation
"""
if isinstance(agent_action, AgentActionMessageLog):
- return list(agent_action.message_log) + [
- _create_function_message(agent_action, observation)
+ return [
+ *list(agent_action.message_log),
+ _create_function_message(agent_action, observation),
]
return [AIMessage(content=agent_action.log)]
diff --git a/libs/langchain/langchain/agents/format_scratchpad/tools.py b/libs/langchain/langchain/agents/format_scratchpad/tools.py
index 3c43ff4e0a8..422bafdf605 100644
--- a/libs/langchain/langchain/agents/format_scratchpad/tools.py
+++ b/libs/langchain/langchain/agents/format_scratchpad/tools.py
@@ -54,8 +54,9 @@ def format_to_tool_messages(
messages = []
for agent_action, observation in intermediate_steps:
if isinstance(agent_action, ToolAgentAction):
- new_messages = list(agent_action.message_log) + [
- _create_tool_message(agent_action, observation)
+ new_messages = [
+ *list(agent_action.message_log),
+ _create_tool_message(agent_action, observation),
]
messages.extend([new for new in new_messages if new not in messages])
else:
diff --git a/libs/langchain/langchain/agents/output_parsers/__init__.py b/libs/langchain/langchain/agents/output_parsers/__init__.py
index c5a8b97bdf3..a1d056e6e0d 100644
--- a/libs/langchain/langchain/agents/output_parsers/__init__.py
+++ b/libs/langchain/langchain/agents/output_parsers/__init__.py
@@ -25,11 +25,11 @@ from langchain.agents.output_parsers.tools import ToolsAgentOutputParser
from langchain.agents.output_parsers.xml import XMLAgentOutputParser
__all__ = [
+ "JSONAgentOutputParser",
+ "OpenAIFunctionsAgentOutputParser",
+ "ReActJsonSingleInputOutputParser",
"ReActSingleInputOutputParser",
"SelfAskOutputParser",
"ToolsAgentOutputParser",
- "ReActJsonSingleInputOutputParser",
- "OpenAIFunctionsAgentOutputParser",
"XMLAgentOutputParser",
- "JSONAgentOutputParser",
]
diff --git a/libs/langchain/langchain/agents/self_ask_with_search/base.py b/libs/langchain/langchain/agents/self_ask_with_search/base.py
index 63302caa751..9bf800be787 100644
--- a/libs/langchain/langchain/agents/self_ask_with_search/base.py
+++ b/libs/langchain/langchain/agents/self_ask_with_search/base.py
@@ -189,7 +189,7 @@ def create_self_ask_with_search_agent(
if len(tools) != 1:
msg = "This agent expects exactly one tool"
raise ValueError(msg)
- tool = list(tools)[0]
+ tool = next(iter(tools))
if tool.name != "Intermediate Answer":
msg = "This agent expects the tool to be named `Intermediate Answer`"
raise ValueError(msg)
diff --git a/libs/langchain/langchain/cache.py b/libs/langchain/langchain/cache.py
index e8cee3c8cd6..50e96cdd4b7 100644
--- a/libs/langchain/langchain/cache.py
+++ b/libs/langchain/langchain/cache.py
@@ -53,20 +53,20 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "FullLLMCache",
- "SQLAlchemyCache",
- "SQLiteCache",
- "UpstashRedisCache",
- "RedisCache",
- "RedisSemanticCache",
- "GPTCache",
- "MomentoCache",
- "InMemoryCache",
- "CassandraCache",
- "CassandraSemanticCache",
- "FullMd5LLMCache",
- "SQLAlchemyMd5Cache",
"AstraDBCache",
"AstraDBSemanticCache",
"AzureCosmosDBSemanticCache",
+ "CassandraCache",
+ "CassandraSemanticCache",
+ "FullLLMCache",
+ "FullMd5LLMCache",
+ "GPTCache",
+ "InMemoryCache",
+ "MomentoCache",
+ "RedisCache",
+ "RedisSemanticCache",
+ "SQLAlchemyCache",
+ "SQLAlchemyMd5Cache",
+ "SQLiteCache",
+ "UpstashRedisCache",
]
diff --git a/libs/langchain/langchain/callbacks/__init__.py b/libs/langchain/langchain/callbacks/__init__.py
index 92690fc9029..72355d3fe42 100644
--- a/libs/langchain/langchain/callbacks/__init__.py
+++ b/libs/langchain/langchain/callbacks/__init__.py
@@ -107,33 +107,33 @@ __all__ = [
"AimCallbackHandler",
"ArgillaCallbackHandler",
"ArizeCallbackHandler",
- "PromptLayerCallbackHandler",
"ArthurCallbackHandler",
+ "AsyncIteratorCallbackHandler",
"ClearMLCallbackHandler",
"CometCallbackHandler",
"ContextCallbackHandler",
"FileCallbackHandler",
+ "FinalStreamingStdOutCallbackHandler",
+ "FlyteCallbackHandler",
"HumanApprovalCallbackHandler",
"InfinoCallbackHandler",
- "MlflowCallbackHandler",
- "LLMonitorCallbackHandler",
- "OpenAICallbackHandler",
- "StdOutCallbackHandler",
- "AsyncIteratorCallbackHandler",
- "StreamingStdOutCallbackHandler",
- "FinalStreamingStdOutCallbackHandler",
"LLMThoughtLabeler",
+ "LLMonitorCallbackHandler",
+ "LabelStudioCallbackHandler",
"LangChainTracer",
+ "MlflowCallbackHandler",
+ "OpenAICallbackHandler",
+ "PromptLayerCallbackHandler",
+ "SageMakerCallbackHandler",
+ "StdOutCallbackHandler",
+ "StreamingStdOutCallbackHandler",
"StreamlitCallbackHandler",
+ "TrubricsCallbackHandler",
"WandbCallbackHandler",
"WhyLabsCallbackHandler",
+ "collect_runs",
"get_openai_callback",
"tracing_enabled",
"tracing_v2_enabled",
- "collect_runs",
"wandb_tracing_enabled",
- "FlyteCallbackHandler",
- "SageMakerCallbackHandler",
- "LabelStudioCallbackHandler",
- "TrubricsCallbackHandler",
]
diff --git a/libs/langchain/langchain/callbacks/aim_callback.py b/libs/langchain/langchain/callbacks/aim_callback.py
index aa57017a1f4..1badd3957ce 100644
--- a/libs/langchain/langchain/callbacks/aim_callback.py
+++ b/libs/langchain/langchain/callbacks/aim_callback.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "import_aim",
- "BaseMetadataCallbackHandler",
"AimCallbackHandler",
+ "BaseMetadataCallbackHandler",
+ "import_aim",
]
diff --git a/libs/langchain/langchain/callbacks/base.py b/libs/langchain/langchain/callbacks/base.py
index 49fab5ee7d5..f360dd6d3bf 100644
--- a/libs/langchain/langchain/callbacks/base.py
+++ b/libs/langchain/langchain/callbacks/base.py
@@ -16,14 +16,14 @@ from langchain_core.callbacks import (
)
__all__ = [
- "RetrieverManagerMixin",
- "LLMManagerMixin",
- "ChainManagerMixin",
- "ToolManagerMixin",
- "CallbackManagerMixin",
- "RunManagerMixin",
- "BaseCallbackHandler",
"AsyncCallbackHandler",
+ "BaseCallbackHandler",
"BaseCallbackManager",
+ "CallbackManagerMixin",
"Callbacks",
+ "ChainManagerMixin",
+ "LLMManagerMixin",
+ "RetrieverManagerMixin",
+ "RunManagerMixin",
+ "ToolManagerMixin",
]
diff --git a/libs/langchain/langchain/callbacks/human.py b/libs/langchain/langchain/callbacks/human.py
index 534dad96044..6cb2f95b851 100644
--- a/libs/langchain/langchain/callbacks/human.py
+++ b/libs/langchain/langchain/callbacks/human.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "HumanRejectedException",
- "HumanApprovalCallbackHandler",
"AsyncHumanApprovalCallbackHandler",
+ "HumanApprovalCallbackHandler",
+ "HumanRejectedException",
]
diff --git a/libs/langchain/langchain/callbacks/labelstudio_callback.py b/libs/langchain/langchain/callbacks/labelstudio_callback.py
index e12b49a1b80..790071ec11c 100644
--- a/libs/langchain/langchain/callbacks/labelstudio_callback.py
+++ b/libs/langchain/langchain/callbacks/labelstudio_callback.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "LabelStudioCallbackHandler",
"LabelStudioMode",
"get_default_label_configs",
- "LabelStudioCallbackHandler",
]
diff --git a/libs/langchain/langchain/callbacks/manager.py b/libs/langchain/langchain/callbacks/manager.py
index da6ce69ca78..97fa12fad0e 100644
--- a/libs/langchain/langchain/callbacks/manager.py
+++ b/libs/langchain/langchain/callbacks/manager.py
@@ -58,7 +58,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ahandle_event",
+ "AsyncCallbackManager",
"AsyncCallbackManagerForChainGroup",
"AsyncCallbackManagerForChainRun",
"AsyncCallbackManagerForLLMRun",
@@ -66,7 +66,6 @@ __all__ = [
"AsyncCallbackManagerForToolRun",
"AsyncParentRunManager",
"AsyncRunManager",
- "atrace_as_chain_group",
"BaseRunManager",
"CallbackManager",
"CallbackManagerForChainGroup",
@@ -75,13 +74,14 @@ __all__ = [
"CallbackManagerForRetrieverRun",
"CallbackManagerForToolRun",
"Callbacks",
- "AsyncCallbackManager",
+ "ParentRunManager",
+ "RunManager",
+ "ahandle_event",
+ "atrace_as_chain_group",
"collect_runs",
"env_var_is_set",
"get_openai_callback",
"handle_event",
- "ParentRunManager",
- "RunManager",
"trace_as_chain_group",
"tracing_enabled",
"tracing_v2_enabled",
diff --git a/libs/langchain/langchain/callbacks/mlflow_callback.py b/libs/langchain/langchain/callbacks/mlflow_callback.py
index 738c3a52333..c1ec26ab2eb 100644
--- a/libs/langchain/langchain/callbacks/mlflow_callback.py
+++ b/libs/langchain/langchain/callbacks/mlflow_callback.py
@@ -31,8 +31,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "MlflowCallbackHandler",
+ "MlflowLogger",
"analyze_text",
"construct_html_from_prompt_and_generation",
- "MlflowLogger",
- "MlflowCallbackHandler",
]
diff --git a/libs/langchain/langchain/callbacks/streamlit/mutable_expander.py b/libs/langchain/langchain/callbacks/streamlit/mutable_expander.py
index 756593ba0b0..f5209bb1709 100644
--- a/libs/langchain/langchain/callbacks/streamlit/mutable_expander.py
+++ b/libs/langchain/langchain/callbacks/streamlit/mutable_expander.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ChildType",
"ChildRecord",
+ "ChildType",
"MutableExpander",
]
diff --git a/libs/langchain/langchain/callbacks/streamlit/streamlit_callback_handler.py b/libs/langchain/langchain/callbacks/streamlit/streamlit_callback_handler.py
index 911561856d0..15d1660ae12 100644
--- a/libs/langchain/langchain/callbacks/streamlit/streamlit_callback_handler.py
+++ b/libs/langchain/langchain/callbacks/streamlit/streamlit_callback_handler.py
@@ -41,9 +41,9 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "LLMThoughtState",
- "ToolRecord",
- "LLMThoughtLabeler",
"LLMThought",
+ "LLMThoughtLabeler",
+ "LLMThoughtState",
"StreamlitCallbackHandler",
+ "ToolRecord",
]
diff --git a/libs/langchain/langchain/callbacks/tracers/__init__.py b/libs/langchain/langchain/callbacks/tracers/__init__.py
index 744c6b863d9..49c9be80f3a 100644
--- a/libs/langchain/langchain/callbacks/tracers/__init__.py
+++ b/libs/langchain/langchain/callbacks/tracers/__init__.py
@@ -31,8 +31,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
"ConsoleCallbackHandler",
"FunctionCallbackHandler",
- "LoggingCallbackHandler",
"LangChainTracer",
"LangChainTracerV1",
+ "LoggingCallbackHandler",
"WandbTracer",
]
diff --git a/libs/langchain/langchain/callbacks/tracers/comet.py b/libs/langchain/langchain/callbacks/tracers/comet.py
index e5433d95a29..d1cfe7d9068 100644
--- a/libs/langchain/langchain/callbacks/tracers/comet.py
+++ b/libs/langchain/langchain/callbacks/tracers/comet.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "import_comet_llm_api",
"CometTracer",
+ "import_comet_llm_api",
]
diff --git a/libs/langchain/langchain/callbacks/tracers/evaluation.py b/libs/langchain/langchain/callbacks/tracers/evaluation.py
index 7283a540efb..fc4be68b462 100644
--- a/libs/langchain/langchain/callbacks/tracers/evaluation.py
+++ b/libs/langchain/langchain/callbacks/tracers/evaluation.py
@@ -5,4 +5,4 @@ from langchain_core.tracers.evaluation import (
wait_for_all_evaluators,
)
-__all__ = ["wait_for_all_evaluators", "EvaluatorCallbackHandler"]
+__all__ = ["EvaluatorCallbackHandler", "wait_for_all_evaluators"]
diff --git a/libs/langchain/langchain/callbacks/tracers/log_stream.py b/libs/langchain/langchain/callbacks/tracers/log_stream.py
index 22b33c3768d..54cc24935fc 100644
--- a/libs/langchain/langchain/callbacks/tracers/log_stream.py
+++ b/libs/langchain/langchain/callbacks/tracers/log_stream.py
@@ -6,4 +6,4 @@ from langchain_core.tracers.log_stream import (
RunState,
)
-__all__ = ["LogEntry", "RunState", "RunLog", "RunLogPatch", "LogStreamCallbackHandler"]
+__all__ = ["LogEntry", "LogStreamCallbackHandler", "RunLog", "RunLogPatch", "RunState"]
diff --git a/libs/langchain/langchain/callbacks/tracers/stdout.py b/libs/langchain/langchain/callbacks/tracers/stdout.py
index 716e2c30ba2..5e96c73b751 100644
--- a/libs/langchain/langchain/callbacks/tracers/stdout.py
+++ b/libs/langchain/langchain/callbacks/tracers/stdout.py
@@ -3,4 +3,4 @@ from langchain_core.tracers.stdout import (
FunctionCallbackHandler,
)
-__all__ = ["FunctionCallbackHandler", "ConsoleCallbackHandler"]
+__all__ = ["ConsoleCallbackHandler", "FunctionCallbackHandler"]
diff --git a/libs/langchain/langchain/callbacks/utils.py b/libs/langchain/langchain/callbacks/utils.py
index b20381a8043..92c990a2bb4 100644
--- a/libs/langchain/langchain/callbacks/utils.py
+++ b/libs/langchain/langchain/callbacks/utils.py
@@ -37,12 +37,12 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "import_spacy",
- "import_pandas",
- "import_textstat",
+ "BaseMetadataCallbackHandler",
"_flatten_dict",
"flatten_dict",
"hash_string",
+ "import_pandas",
+ "import_spacy",
+ "import_textstat",
"load_json",
- "BaseMetadataCallbackHandler",
]
diff --git a/libs/langchain/langchain/chains/api/base.py b/libs/langchain/langchain/chains/api/base.py
index 88122b9781e..7fe4b9ce81a 100644
--- a/libs/langchain/langchain/chains/api/base.py
+++ b/libs/langchain/langchain/chains/api/base.py
@@ -61,7 +61,7 @@ try:
message=(
"This class is deprecated and will be removed in langchain 1.0. "
"See API reference for replacement: "
- "https://api.python.langchain.com/en/latest/chains/langchain.chains.api.base.APIChain.html" # noqa: E501
+ "https://api.python.langchain.com/en/latest/chains/langchain.chains.api.base.APIChain.html"
),
removal="1.0",
)
diff --git a/libs/langchain/langchain/chains/api/openapi/requests_chain.py b/libs/langchain/langchain/chains/api/openapi/requests_chain.py
index 0d221ae24c1..76e28a3a0fd 100644
--- a/libs/langchain/langchain/chains/api/openapi/requests_chain.py
+++ b/libs/langchain/langchain/chains/api/openapi/requests_chain.py
@@ -26,4 +26,4 @@ def __getattr__(name: str) -> Any:
return _import_attribute(name)
-__all__ = ["APIRequesterChain", "APIRequesterOutputParser", "REQUEST_TEMPLATE"]
+__all__ = ["REQUEST_TEMPLATE", "APIRequesterChain", "APIRequesterOutputParser"]
diff --git a/libs/langchain/langchain/chains/api/openapi/response_chain.py b/libs/langchain/langchain/chains/api/openapi/response_chain.py
index 86644762263..6b4485294b3 100644
--- a/libs/langchain/langchain/chains/api/openapi/response_chain.py
+++ b/libs/langchain/langchain/chains/api/openapi/response_chain.py
@@ -26,4 +26,4 @@ def __getattr__(name: str) -> Any:
return _import_attribute(name)
-__all__ = ["APIResponderChain", "APIResponderOutputParser", "RESPONSE_TEMPLATE"]
+__all__ = ["RESPONSE_TEMPLATE", "APIResponderChain", "APIResponderOutputParser"]
diff --git a/libs/langchain/langchain/chains/base.py b/libs/langchain/langchain/chains/base.py
index 1d63763a1ea..9052b7dd6a9 100644
--- a/libs/langchain/langchain/chains/base.py
+++ b/libs/langchain/langchain/chains/base.py
@@ -521,7 +521,7 @@ class Chain(RunnableSerializable[dict[str, Any], dict[str, Any]], ABC):
# If there are multiple input keys, but some get set by memory so that
# only one is not set, we can still figure out which key it is.
_input_keys = _input_keys.difference(self.memory.memory_variables)
- inputs = {list(_input_keys)[0]: inputs}
+ inputs = {next(iter(_input_keys)): inputs}
if self.memory is not None:
external_context = self.memory.load_memory_variables(inputs)
inputs = dict(inputs, **external_context)
@@ -545,7 +545,7 @@ class Chain(RunnableSerializable[dict[str, Any], dict[str, Any]], ABC):
# If there are multiple input keys, but some get set by memory so that
# only one is not set, we can still figure out which key it is.
_input_keys = _input_keys.difference(self.memory.memory_variables)
- inputs = {list(_input_keys)[0]: inputs}
+ inputs = {next(iter(_input_keys)): inputs}
if self.memory is not None:
external_context = await self.memory.aload_memory_variables(inputs)
inputs = dict(inputs, **external_context)
diff --git a/libs/langchain/langchain/chains/combine_documents/__init__.py b/libs/langchain/langchain/chains/combine_documents/__init__.py
index 6b038ec101c..5c468195faf 100644
--- a/libs/langchain/langchain/chains/combine_documents/__init__.py
+++ b/libs/langchain/langchain/chains/combine_documents/__init__.py
@@ -10,6 +10,6 @@ from langchain.chains.combine_documents.stuff import create_stuff_documents_chai
__all__ = [
"acollapse_docs",
"collapse_docs",
- "split_list_of_docs",
"create_stuff_documents_chain",
+ "split_list_of_docs",
]
diff --git a/libs/langchain/langchain/chains/combine_documents/base.py b/libs/langchain/langchain/chains/combine_documents/base.py
index 76f1290a861..d8f00a099bd 100644
--- a/libs/langchain/langchain/chains/combine_documents/base.py
+++ b/libs/langchain/langchain/chains/combine_documents/base.py
@@ -163,7 +163,7 @@ class BaseCombineDocumentsChain(Chain, ABC):
since="0.2.7",
alternative=(
"example in API reference with more detail: "
- "https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html" # noqa: E501
+ "https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html"
),
removal="1.0",
)
diff --git a/libs/langchain/langchain/chains/combine_documents/map_reduce.py b/libs/langchain/langchain/chains/combine_documents/map_reduce.py
index bd5201e826b..9f8d3dbcc2e 100644
--- a/libs/langchain/langchain/chains/combine_documents/map_reduce.py
+++ b/libs/langchain/langchain/chains/combine_documents/map_reduce.py
@@ -133,7 +133,7 @@ class MapReduceDocumentsChain(BaseCombineDocumentsChain):
"""
_output_keys = super().output_keys
if self.return_intermediate_steps:
- _output_keys = _output_keys + ["intermediate_steps"]
+ _output_keys = [*_output_keys, "intermediate_steps"]
return _output_keys
model_config = ConfigDict(
@@ -161,8 +161,7 @@ class MapReduceDocumentsChain(BaseCombineDocumentsChain):
)
values["reduce_documents_chain"] = reduce_chain
del values["combine_document_chain"]
- if "collapse_document_chain" in values:
- del values["collapse_document_chain"]
+ values.pop("collapse_document_chain", None)
return values
diff --git a/libs/langchain/langchain/chains/combine_documents/map_rerank.py b/libs/langchain/langchain/chains/combine_documents/map_rerank.py
index c84130a3bdd..632bcf2fe9d 100644
--- a/libs/langchain/langchain/chains/combine_documents/map_rerank.py
+++ b/libs/langchain/langchain/chains/combine_documents/map_rerank.py
@@ -24,7 +24,7 @@ from langchain.output_parsers.regex import RegexParser
message=(
"This class is deprecated. Please see the migration guide here for "
"a recommended replacement: "
- "https://python.langchain.com/docs/versions/migrating_chains/map_rerank_docs_chain/" # noqa: E501
+ "https://python.langchain.com/docs/versions/migrating_chains/map_rerank_docs_chain/"
),
)
class MapRerankDocumentsChain(BaseCombineDocumentsChain):
@@ -112,7 +112,7 @@ class MapRerankDocumentsChain(BaseCombineDocumentsChain):
"""
_output_keys = super().output_keys
if self.return_intermediate_steps:
- _output_keys = _output_keys + ["intermediate_steps"]
+ _output_keys = [*_output_keys, "intermediate_steps"]
if self.metadata_keys is not None:
_output_keys += self.metadata_keys
return _output_keys
diff --git a/libs/langchain/langchain/chains/combine_documents/refine.py b/libs/langchain/langchain/chains/combine_documents/refine.py
index 34ac3d65042..073d0173009 100644
--- a/libs/langchain/langchain/chains/combine_documents/refine.py
+++ b/libs/langchain/langchain/chains/combine_documents/refine.py
@@ -27,7 +27,7 @@ def _get_default_document_prompt() -> PromptTemplate:
message=(
"This class is deprecated. Please see the migration guide here for "
"a recommended replacement: "
- "https://python.langchain.com/docs/versions/migrating_chains/refine_docs_chain/" # noqa: E501
+ "https://python.langchain.com/docs/versions/migrating_chains/refine_docs_chain/"
),
)
class RefineDocumentsChain(BaseCombineDocumentsChain):
@@ -105,7 +105,7 @@ class RefineDocumentsChain(BaseCombineDocumentsChain):
"""
_output_keys = super().output_keys
if self.return_intermediate_steps:
- _output_keys = _output_keys + ["intermediate_steps"]
+ _output_keys = [*_output_keys, "intermediate_steps"]
return _output_keys
model_config = ConfigDict(
diff --git a/libs/langchain/langchain/chains/combine_documents/stuff.py b/libs/langchain/langchain/chains/combine_documents/stuff.py
index ab837c9de99..e862b35594f 100644
--- a/libs/langchain/langchain/chains/combine_documents/stuff.py
+++ b/libs/langchain/langchain/chains/combine_documents/stuff.py
@@ -102,7 +102,7 @@ def create_stuff_documents_chain(
message=(
"This class is deprecated. Use the `create_stuff_documents_chain` constructor "
"instead. See migration guide here: "
- "https://python.langchain.com/docs/versions/migrating_chains/stuff_docs_chain/" # noqa: E501
+ "https://python.langchain.com/docs/versions/migrating_chains/stuff_docs_chain/"
),
)
class StuffDocumentsChain(BaseCombineDocumentsChain):
diff --git a/libs/langchain/langchain/chains/constitutional_ai/base.py b/libs/langchain/langchain/chains/constitutional_ai/base.py
index cdcbb89d2d8..9e8a0b22cd4 100644
--- a/libs/langchain/langchain/chains/constitutional_ai/base.py
+++ b/libs/langchain/langchain/chains/constitutional_ai/base.py
@@ -19,7 +19,7 @@ from langchain.chains.llm import LLMChain
message=(
"This class is deprecated and will be removed in langchain 1.0. "
"See API reference for replacement: "
- "https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html" # noqa: E501
+ "https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html"
),
removal="1.0",
)
diff --git a/libs/langchain/langchain/chains/conversation/base.py b/libs/langchain/langchain/chains/conversation/base.py
index 314f3d7f4e9..fd7dea5d735 100644
--- a/libs/langchain/langchain/chains/conversation/base.py
+++ b/libs/langchain/langchain/chains/conversation/base.py
@@ -132,7 +132,7 @@ class ConversationChain(LLMChain):
)
raise ValueError(msg)
prompt_variables = self.prompt.input_variables
- expected_keys = memory_keys + [input_key]
+ expected_keys = [*memory_keys, input_key]
if set(expected_keys) != set(prompt_variables):
msg = (
"Got unexpected prompt input variables. The prompt expects "
diff --git a/libs/langchain/langchain/chains/conversation/memory.py b/libs/langchain/langchain/chains/conversation/memory.py
index 03230c4d62b..f569fd1b03d 100644
--- a/libs/langchain/langchain/chains/conversation/memory.py
+++ b/libs/langchain/langchain/chains/conversation/memory.py
@@ -34,12 +34,12 @@ def __getattr__(name: str) -> Any:
# This is only for backwards compatibility.
__all__ = [
- "ConversationSummaryBufferMemory",
- "ConversationSummaryMemory",
- "ConversationKGMemory",
+ "CombinedMemory",
+ "ConversationBufferMemory",
"ConversationBufferWindowMemory",
"ConversationEntityMemory",
- "ConversationBufferMemory",
- "CombinedMemory",
+ "ConversationKGMemory",
"ConversationStringBufferMemory",
+ "ConversationSummaryBufferMemory",
+ "ConversationSummaryMemory",
]
diff --git a/libs/langchain/langchain/chains/conversational_retrieval/base.py b/libs/langchain/langchain/chains/conversational_retrieval/base.py
index bb650f3f8e5..bbb6078f247 100644
--- a/libs/langchain/langchain/chains/conversational_retrieval/base.py
+++ b/libs/langchain/langchain/chains/conversational_retrieval/base.py
@@ -121,9 +121,9 @@ class BaseConversationalRetrievalChain(Chain):
"""
_output_keys = [self.output_key]
if self.return_source_documents:
- _output_keys = _output_keys + ["source_documents"]
+ _output_keys = [*_output_keys, "source_documents"]
if self.return_generated_question:
- _output_keys = _output_keys + ["generated_question"]
+ _output_keys = [*_output_keys, "generated_question"]
return _output_keys
@abstractmethod
diff --git a/libs/langchain/langchain/chains/ernie_functions/__init__.py b/libs/langchain/langchain/chains/ernie_functions/__init__.py
index fd2e5068189..b6da3255f6e 100644
--- a/libs/langchain/langchain/chains/ernie_functions/__init__.py
+++ b/libs/langchain/langchain/chains/ernie_functions/__init__.py
@@ -36,9 +36,9 @@ def __getattr__(name: str) -> Any:
__all__ = [
"convert_to_ernie_function",
- "create_structured_output_chain",
"create_ernie_fn_chain",
- "create_structured_output_runnable",
"create_ernie_fn_runnable",
+ "create_structured_output_chain",
+ "create_structured_output_runnable",
"get_ernie_output_parser",
]
diff --git a/libs/langchain/langchain/chains/graph_qa/cypher.py b/libs/langchain/langchain/chains/graph_qa/cypher.py
index fbddc52eb5e..d71a75d6e97 100644
--- a/libs/langchain/langchain/chains/graph_qa/cypher.py
+++ b/libs/langchain/langchain/chains/graph_qa/cypher.py
@@ -31,9 +31,9 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "GraphCypherQAChain",
+ "CYPHER_GENERATION_PROMPT",
"INTERMEDIATE_STEPS_KEY",
+ "GraphCypherQAChain",
"construct_schema",
"extract_cypher",
- "CYPHER_GENERATION_PROMPT",
]
diff --git a/libs/langchain/langchain/chains/graph_qa/falkordb.py b/libs/langchain/langchain/chains/graph_qa/falkordb.py
index 1aba6adff41..2f6832f06ea 100644
--- a/libs/langchain/langchain/chains/graph_qa/falkordb.py
+++ b/libs/langchain/langchain/chains/graph_qa/falkordb.py
@@ -26,4 +26,4 @@ def __getattr__(name: str) -> Any:
return _import_attribute(name)
-__all__ = ["FalkorDBQAChain", "INTERMEDIATE_STEPS_KEY", "extract_cypher"]
+__all__ = ["INTERMEDIATE_STEPS_KEY", "FalkorDBQAChain", "extract_cypher"]
diff --git a/libs/langchain/langchain/chains/graph_qa/gremlin.py b/libs/langchain/langchain/chains/graph_qa/gremlin.py
index 20a7be6ab82..65d5bcb0677 100644
--- a/libs/langchain/langchain/chains/graph_qa/gremlin.py
+++ b/libs/langchain/langchain/chains/graph_qa/gremlin.py
@@ -30,7 +30,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
"GRAPHDB_SPARQL_FIX_TEMPLATE",
- "GremlinQAChain",
"INTERMEDIATE_STEPS_KEY",
+ "GremlinQAChain",
"extract_gremlin",
]
diff --git a/libs/langchain/langchain/chains/graph_qa/neptune_sparql.py b/libs/langchain/langchain/chains/graph_qa/neptune_sparql.py
index f4445b65d35..507866159dc 100644
--- a/libs/langchain/langchain/chains/graph_qa/neptune_sparql.py
+++ b/libs/langchain/langchain/chains/graph_qa/neptune_sparql.py
@@ -30,7 +30,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
"INTERMEDIATE_STEPS_KEY",
- "NeptuneSparqlQAChain",
"SPARQL_GENERATION_TEMPLATE",
+ "NeptuneSparqlQAChain",
"extract_sparql",
]
diff --git a/libs/langchain/langchain/chains/graph_qa/prompts.py b/libs/langchain/langchain/chains/graph_qa/prompts.py
index 1b7ac181310..6f35601f091 100644
--- a/libs/langchain/langchain/chains/graph_qa/prompts.py
+++ b/libs/langchain/langchain/chains/graph_qa/prompts.py
@@ -74,7 +74,9 @@ __all__ = [
"AQL_FIX_TEMPLATE",
"AQL_GENERATION_TEMPLATE",
"AQL_QA_TEMPLATE",
+ "CYPHER_GENERATION_PROMPT",
"CYPHER_GENERATION_TEMPLATE",
+ "CYPHER_QA_PROMPT",
"CYPHER_QA_TEMPLATE",
"GRAPHDB_QA_TEMPLATE",
"GRAPHDB_SPARQL_FIX_TEMPLATE",
@@ -91,6 +93,4 @@ __all__ = [
"SPARQL_GENERATION_UPDATE_TEMPLATE",
"SPARQL_INTENT_TEMPLATE",
"SPARQL_QA_TEMPLATE",
- "CYPHER_QA_PROMPT",
- "CYPHER_GENERATION_PROMPT",
]
diff --git a/libs/langchain/langchain/chains/llm_math/base.py b/libs/langchain/langchain/chains/llm_math/base.py
index 674d599835b..012a49c6b4e 100644
--- a/libs/langchain/langchain/chains/llm_math/base.py
+++ b/libs/langchain/langchain/chains/llm_math/base.py
@@ -26,7 +26,7 @@ from langchain.chains.llm_math.prompt import PROMPT
message=(
"This class is deprecated and will be removed in langchain 1.0. "
"See API reference for replacement: "
- "https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html" # noqa: E501
+ "https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html"
),
removal="1.0",
)
diff --git a/libs/langchain/langchain/chains/mapreduce.py b/libs/langchain/langchain/chains/mapreduce.py
index 6e7842f221a..04627f58634 100644
--- a/libs/langchain/langchain/chains/mapreduce.py
+++ b/libs/langchain/langchain/chains/mapreduce.py
@@ -30,7 +30,7 @@ from langchain.chains.llm import LLMChain
removal="1.0",
message=(
"Refer to migration guide here for a recommended implementation using "
- "LangGraph: https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain/" # noqa: E501
+ "LangGraph: https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain/"
". See also LangGraph guides for map-reduce: "
"https://langchain-ai.github.io/langgraph/how-tos/map-reduce/."
),
diff --git a/libs/langchain/langchain/chains/openai_functions/__init__.py b/libs/langchain/langchain/chains/openai_functions/__init__.py
index 6312b619890..4dc4a79bb38 100644
--- a/libs/langchain/langchain/chains/openai_functions/__init__.py
+++ b/libs/langchain/langchain/chains/openai_functions/__init__.py
@@ -28,17 +28,17 @@ from langchain.chains.structured_output.base import (
__all__ = [
"convert_to_openai_function",
- "create_tagging_chain",
- "create_tagging_chain_pydantic",
- "create_extraction_chain_pydantic",
- "create_extraction_chain",
"create_citation_fuzzy_match_chain",
"create_citation_fuzzy_match_runnable",
- "create_qa_with_structure_chain",
- "create_qa_with_sources_chain",
- "create_structured_output_chain",
+ "create_extraction_chain",
+ "create_extraction_chain_pydantic",
"create_openai_fn_chain",
- "create_structured_output_runnable", # backwards compatibility
"create_openai_fn_runnable", # backwards compatibility
+ "create_qa_with_sources_chain",
+ "create_qa_with_structure_chain",
+ "create_structured_output_chain",
+ "create_structured_output_runnable", # backwards compatibility
+ "create_tagging_chain",
+ "create_tagging_chain_pydantic",
"get_openai_output_parser", # backwards compatibility
]
diff --git a/libs/langchain/langchain/chains/openai_functions/base.py b/libs/langchain/langchain/chains/openai_functions/base.py
index a6c020621c5..962541833cf 100644
--- a/libs/langchain/langchain/chains/openai_functions/base.py
+++ b/libs/langchain/langchain/chains/openai_functions/base.py
@@ -31,13 +31,13 @@ from langchain.chains.structured_output.base import (
)
__all__ = [
- "get_openai_output_parser",
- "create_openai_fn_runnable",
- "create_structured_output_runnable", # deprecated
- "create_openai_fn_chain", # deprecated
- "create_structured_output_chain", # deprecated
"PYTHON_TO_JSON_TYPES", # backwards compatibility
"convert_to_openai_function", # backwards compatibility
+ "create_openai_fn_chain", # deprecated
+ "create_openai_fn_runnable",
+ "create_structured_output_chain", # deprecated
+ "create_structured_output_runnable", # deprecated
+ "get_openai_output_parser",
]
diff --git a/libs/langchain/langchain/chains/openai_functions/openapi.py b/libs/langchain/langchain/chains/openai_functions/openapi.py
index 146e95cba5e..0c8f463eb07 100644
--- a/libs/langchain/langchain/chains/openai_functions/openapi.py
+++ b/libs/langchain/langchain/chains/openai_functions/openapi.py
@@ -69,7 +69,7 @@ def _openapi_params_to_json_schema(params: list[Parameter], spec: OpenAPISpec) -
if p.param_schema:
schema = spec.get_schema(p.param_schema)
else:
- media_type_schema = list(p.content.values())[0].media_type_schema
+ media_type_schema = next(iter(p.content.values())).media_type_schema
schema = spec.get_schema(media_type_schema)
if p.description and not schema.description:
schema.description = p.description
@@ -140,7 +140,7 @@ def openapi_spec_to_openai_fn(
schema.json(exclude_none=True)
)
if len(media_types) == 1:
- media_type, schema_dict = list(media_types.items())[0]
+ media_type, schema_dict = next(iter(media_types.items()))
key = "json" if media_type == "application/json" else "data"
request_args[key] = schema_dict
elif len(media_types) > 1:
@@ -242,7 +242,7 @@ class SimpleRequestChain(Chain):
message=(
"This function is deprecated and will be removed in langchain 1.0. "
"See API reference for replacement: "
- "https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.get_openapi_chain.html" # noqa: E501
+ "https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.get_openapi_chain.html"
),
removal="1.0",
)
diff --git a/libs/langchain/langchain/chains/openai_functions/qa_with_structure.py b/libs/langchain/langchain/chains/openai_functions/qa_with_structure.py
index e9579e9bce3..421f9ec73c5 100644
--- a/libs/langchain/langchain/chains/openai_functions/qa_with_structure.py
+++ b/libs/langchain/langchain/chains/openai_functions/qa_with_structure.py
@@ -32,7 +32,7 @@ class AnswerWithSources(BaseModel):
message=(
"This function is deprecated. Refer to this guide on retrieval and question "
"answering with structured responses: "
- "https://python.langchain.com/docs/how_to/qa_sources/#structure-sources-in-model-response" # noqa: E501
+ "https://python.langchain.com/docs/how_to/qa_sources/#structure-sources-in-model-response"
),
)
def create_qa_with_structure_chain(
@@ -115,7 +115,7 @@ def create_qa_with_structure_chain(
message=(
"This function is deprecated. Refer to this guide on retrieval and question "
"answering with sources: "
- "https://python.langchain.com/docs/how_to/qa_sources/#structure-sources-in-model-response" # noqa: E501
+ "https://python.langchain.com/docs/how_to/qa_sources/#structure-sources-in-model-response"
),
)
def create_qa_with_sources_chain(
diff --git a/libs/langchain/langchain/chains/qa_generation/base.py b/libs/langchain/langchain/chains/qa_generation/base.py
index 0a90acb023a..ca106a7fae6 100644
--- a/libs/langchain/langchain/chains/qa_generation/base.py
+++ b/libs/langchain/langchain/chains/qa_generation/base.py
@@ -19,7 +19,7 @@ from langchain.chains.qa_generation.prompt import PROMPT_SELECTOR
since="0.2.7",
alternative=(
"example in API reference with more detail: "
- "https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html" # noqa: E501
+ "https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html"
),
removal="1.0",
)
diff --git a/libs/langchain/langchain/chains/qa_with_sources/base.py b/libs/langchain/langchain/chains/qa_with_sources/base.py
index 7b2b371ee00..ac77e06a8de 100644
--- a/libs/langchain/langchain/chains/qa_with_sources/base.py
+++ b/libs/langchain/langchain/chains/qa_with_sources/base.py
@@ -118,7 +118,7 @@ class BaseQAWithSourcesChain(Chain, ABC):
"""
_output_keys = [self.answer_key, self.sources_answer_key]
if self.return_source_documents:
- _output_keys = _output_keys + ["source_documents"]
+ _output_keys = [*_output_keys, "source_documents"]
return _output_keys
@model_validator(mode="before")
diff --git a/libs/langchain/langchain/chains/qa_with_sources/loading.py b/libs/langchain/langchain/chains/qa_with_sources/loading.py
index 5bd0d4d1fde..9fd8a3587d5 100644
--- a/libs/langchain/langchain/chains/qa_with_sources/loading.py
+++ b/libs/langchain/langchain/chains/qa_with_sources/loading.py
@@ -167,10 +167,10 @@ def _load_refine_chain(
"https://python.langchain.com/docs/how_to/qa_sources/"
"\nSee also the following migration guides for replacements "
"based on `chain_type`:\n"
- "stuff: https://python.langchain.com/docs/versions/migrating_chains/stuff_docs_chain\n" # noqa: E501
- "map_reduce: https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain\n" # noqa: E501
- "refine: https://python.langchain.com/docs/versions/migrating_chains/refine_chain\n" # noqa: E501
- "map_rerank: https://python.langchain.com/docs/versions/migrating_chains/map_rerank_docs_chain\n" # noqa: E501
+ "stuff: https://python.langchain.com/docs/versions/migrating_chains/stuff_docs_chain\n"
+ "map_reduce: https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain\n"
+ "refine: https://python.langchain.com/docs/versions/migrating_chains/refine_chain\n"
+ "map_rerank: https://python.langchain.com/docs/versions/migrating_chains/map_rerank_docs_chain\n"
),
)
def load_qa_with_sources_chain(
diff --git a/libs/langchain/langchain/chains/query_constructor/ir.py b/libs/langchain/langchain/chains/query_constructor/ir.py
index f7140159677..60453c8f6d4 100644
--- a/libs/langchain/langchain/chains/query_constructor/ir.py
+++ b/libs/langchain/langchain/chains/query_constructor/ir.py
@@ -12,12 +12,12 @@ from langchain_core.structured_query import (
)
__all__ = [
- "Visitor",
- "Expr",
- "Operator",
"Comparator",
- "FilterDirective",
"Comparison",
+ "Expr",
+ "FilterDirective",
"Operation",
+ "Operator",
"StructuredQuery",
+ "Visitor",
]
diff --git a/libs/langchain/langchain/chains/question_answering/chain.py b/libs/langchain/langchain/chains/question_answering/chain.py
index 853fb00b0ae..e42444c6be6 100644
--- a/libs/langchain/langchain/chains/question_answering/chain.py
+++ b/libs/langchain/langchain/chains/question_answering/chain.py
@@ -229,10 +229,10 @@ def _load_refine_chain(
message=(
"This class is deprecated. See the following migration guides for replacements "
"based on `chain_type`:\n"
- "stuff: https://python.langchain.com/docs/versions/migrating_chains/stuff_docs_chain\n" # noqa: E501
- "map_reduce: https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain\n" # noqa: E501
- "refine: https://python.langchain.com/docs/versions/migrating_chains/refine_chain\n" # noqa: E501
- "map_rerank: https://python.langchain.com/docs/versions/migrating_chains/map_rerank_docs_chain\n" # noqa: E501
+ "stuff: https://python.langchain.com/docs/versions/migrating_chains/stuff_docs_chain\n"
+ "map_reduce: https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain\n"
+ "refine: https://python.langchain.com/docs/versions/migrating_chains/refine_chain\n"
+ "map_rerank: https://python.langchain.com/docs/versions/migrating_chains/map_rerank_docs_chain\n"
"\nSee also guides on retrieval and question-answering here: "
"https://python.langchain.com/docs/how_to/#qa-with-rag"
),
diff --git a/libs/langchain/langchain/chains/retrieval_qa/base.py b/libs/langchain/langchain/chains/retrieval_qa/base.py
index fbce2eac11c..a6a7da9fe2e 100644
--- a/libs/langchain/langchain/chains/retrieval_qa/base.py
+++ b/libs/langchain/langchain/chains/retrieval_qa/base.py
@@ -69,7 +69,7 @@ class BaseRetrievalQA(Chain):
"""
_output_keys = [self.output_key]
if self.return_source_documents:
- _output_keys = _output_keys + ["source_documents"]
+ _output_keys = [*_output_keys, "source_documents"]
return _output_keys
@classmethod
diff --git a/libs/langchain/langchain/chains/router/__init__.py b/libs/langchain/langchain/chains/router/__init__.py
index 5ccd5eac9e5..b948749683a 100644
--- a/libs/langchain/langchain/chains/router/__init__.py
+++ b/libs/langchain/langchain/chains/router/__init__.py
@@ -4,9 +4,9 @@ from langchain.chains.router.multi_prompt import MultiPromptChain
from langchain.chains.router.multi_retrieval_qa import MultiRetrievalQAChain
__all__ = [
- "RouterChain",
- "MultiRouteChain",
+ "LLMRouterChain",
"MultiPromptChain",
"MultiRetrievalQAChain",
- "LLMRouterChain",
+ "MultiRouteChain",
+ "RouterChain",
]
diff --git a/libs/langchain/langchain/chains/router/llm_router.py b/libs/langchain/langchain/chains/router/llm_router.py
index 2b74952d75b..b62845d0f5d 100644
--- a/libs/langchain/langchain/chains/router/llm_router.py
+++ b/libs/langchain/langchain/chains/router/llm_router.py
@@ -27,7 +27,7 @@ from langchain.chains.router.base import RouterChain
message=(
"Use RunnableLambda to select from multiple prompt templates. See example "
"in API reference: "
- "https://api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html" # noqa: E501
+ "https://api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html"
),
)
class LLMRouterChain(RouterChain):
diff --git a/libs/langchain/langchain/chains/router/multi_prompt.py b/libs/langchain/langchain/chains/router/multi_prompt.py
index 8b3f398b384..c57b63949b6 100644
--- a/libs/langchain/langchain/chains/router/multi_prompt.py
+++ b/libs/langchain/langchain/chains/router/multi_prompt.py
@@ -21,7 +21,7 @@ from langchain.chains.router.multi_prompt_prompt import MULTI_PROMPT_ROUTER_TEMP
removal="1.0",
message=(
"Please see migration guide here for recommended implementation: "
- "https://python.langchain.com/docs/versions/migrating_chains/multi_prompt_chain/" # noqa: E501
+ "https://python.langchain.com/docs/versions/migrating_chains/multi_prompt_chain/"
),
)
class MultiPromptChain(MultiRouteChain):
diff --git a/libs/langchain/langchain/chains/structured_output/__init__.py b/libs/langchain/langchain/chains/structured_output/__init__.py
index d387a7cbe4e..10bd6808bc7 100644
--- a/libs/langchain/langchain/chains/structured_output/__init__.py
+++ b/libs/langchain/langchain/chains/structured_output/__init__.py
@@ -3,4 +3,4 @@ from langchain.chains.structured_output.base import (
create_structured_output_runnable,
)
-__all__ = ["create_structured_output_runnable", "create_openai_fn_runnable"]
+__all__ = ["create_openai_fn_runnable", "create_structured_output_runnable"]
diff --git a/libs/langchain/langchain/chat_loaders/facebook_messenger.py b/libs/langchain/langchain/chat_loaders/facebook_messenger.py
index 37e2f18a3f2..46a5ea8eabe 100644
--- a/libs/langchain/langchain/chat_loaders/facebook_messenger.py
+++ b/libs/langchain/langchain/chat_loaders/facebook_messenger.py
@@ -29,4 +29,4 @@ def __getattr__(name: str) -> Any:
return import_lookup(name)
-__all__ = ["SingleFileFacebookMessengerChatLoader", "FolderFacebookMessengerChatLoader"]
+__all__ = ["FolderFacebookMessengerChatLoader", "SingleFileFacebookMessengerChatLoader"]
diff --git a/libs/langchain/langchain/chat_loaders/langsmith.py b/libs/langchain/langchain/chat_loaders/langsmith.py
index aa90fd429fd..066b9c538bf 100644
--- a/libs/langchain/langchain/chat_loaders/langsmith.py
+++ b/libs/langchain/langchain/chat_loaders/langsmith.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "LangSmithRunChatLoader",
"LangSmithDatasetChatLoader",
+ "LangSmithRunChatLoader",
]
diff --git a/libs/langchain/langchain/chat_loaders/utils.py b/libs/langchain/langchain/chat_loaders/utils.py
index 04570354f22..f557d761114 100644
--- a/libs/langchain/langchain/chat_loaders/utils.py
+++ b/libs/langchain/langchain/chat_loaders/utils.py
@@ -29,8 +29,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "merge_chat_runs_in_session",
- "merge_chat_runs",
- "map_ai_messages_in_session",
"map_ai_messages",
+ "map_ai_messages_in_session",
+ "merge_chat_runs",
+ "merge_chat_runs_in_session",
]
diff --git a/libs/langchain/langchain/chat_models/__init__.py b/libs/langchain/langchain/chat_models/__init__.py
index 17530d19392..0d7280ded3a 100644
--- a/libs/langchain/langchain/chat_models/__init__.py
+++ b/libs/langchain/langchain/chat_models/__init__.py
@@ -43,35 +43,35 @@ def __getattr__(name: str) -> None:
__all__ = [
- "init_chat_model",
- "ChatOpenAI",
- "BedrockChat",
"AzureChatOpenAI",
- "FakeListChatModel",
- "PromptLayerChatOpenAI",
+ "BedrockChat",
+ "ChatAnthropic",
+ "ChatAnyscale",
+ "ChatBaichuan",
+ "ChatCohere",
"ChatDatabricks",
"ChatEverlyAI",
- "ChatAnthropic",
- "ChatCohere",
+ "ChatFireworks",
"ChatGooglePalm",
- "ChatMlflow",
- "ChatMLflowAIGateway",
- "ChatOllama",
- "ChatVertexAI",
- "JinaChat",
- "HumanInputChatModel",
- "MiniMaxChat",
- "ChatAnyscale",
- "ChatLiteLLM",
- "ErnieBotChat",
+ "ChatHunyuan",
"ChatJavelinAIGateway",
"ChatKonko",
- "PaiEasChatEndpoint",
- "QianfanChatEndpoint",
- "ChatFireworks",
+ "ChatLiteLLM",
+ "ChatMLflowAIGateway",
+ "ChatMlflow",
+ "ChatOllama",
+ "ChatOpenAI",
+ "ChatVertexAI",
"ChatYandexGPT",
- "ChatBaichuan",
- "ChatHunyuan",
+ "ErnieBotChat",
+ "FakeListChatModel",
"GigaChat",
+ "HumanInputChatModel",
+ "JinaChat",
+ "MiniMaxChat",
+ "PaiEasChatEndpoint",
+ "PromptLayerChatOpenAI",
+ "QianfanChatEndpoint",
"VolcEngineMaasChat",
+ "init_chat_model",
]
diff --git a/libs/langchain/langchain/chat_models/anthropic.py b/libs/langchain/langchain/chat_models/anthropic.py
index aa925896172..6478cf11aa3 100644
--- a/libs/langchain/langchain/chat_models/anthropic.py
+++ b/libs/langchain/langchain/chat_models/anthropic.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "convert_messages_to_prompt_anthropic",
"ChatAnthropic",
+ "convert_messages_to_prompt_anthropic",
]
diff --git a/libs/langchain/langchain/chat_models/azureml_endpoint.py b/libs/langchain/langchain/chat_models/azureml_endpoint.py
index ebcc0fdccd3..3be1a3de387 100644
--- a/libs/langchain/langchain/chat_models/azureml_endpoint.py
+++ b/libs/langchain/langchain/chat_models/azureml_endpoint.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "LlamaContentFormatter",
"AzureMLChatOnlineEndpoint",
+ "LlamaContentFormatter",
]
diff --git a/libs/langchain/langchain/chat_models/base.py b/libs/langchain/langchain/chat_models/base.py
index dee5c5f7ff7..2c465d97567 100644
--- a/libs/langchain/langchain/chat_models/base.py
+++ b/libs/langchain/langchain/chat_models/base.py
@@ -31,12 +31,12 @@ from pydantic import BaseModel
from typing_extensions import TypeAlias, override
__all__ = [
- "init_chat_model",
# For backwards compatibility
"BaseChatModel",
"SimpleChatModel",
- "generate_from_stream",
"agenerate_from_stream",
+ "generate_from_stream",
+ "init_chat_model",
]
diff --git a/libs/langchain/langchain/chat_models/bedrock.py b/libs/langchain/langchain/chat_models/bedrock.py
index d2d28172846..3943f0276dc 100644
--- a/libs/langchain/langchain/chat_models/bedrock.py
+++ b/libs/langchain/langchain/chat_models/bedrock.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ChatPromptAdapter",
"BedrockChat",
+ "ChatPromptAdapter",
]
diff --git a/libs/langchain/langchain/chat_models/fake.py b/libs/langchain/langchain/chat_models/fake.py
index 261d5fa5f3f..8e7a05b365f 100644
--- a/libs/langchain/langchain/chat_models/fake.py
+++ b/libs/langchain/langchain/chat_models/fake.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "FakeMessagesListChatModel",
"FakeListChatModel",
+ "FakeMessagesListChatModel",
]
diff --git a/libs/langchain/langchain/chat_models/volcengine_maas.py b/libs/langchain/langchain/chat_models/volcengine_maas.py
index 9c4571140c2..858a2f0441e 100644
--- a/libs/langchain/langchain/chat_models/volcengine_maas.py
+++ b/libs/langchain/langchain/chat_models/volcengine_maas.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "convert_dict_to_message",
"VolcEngineMaasChat",
+ "convert_dict_to_message",
]
diff --git a/libs/langchain/langchain/docstore/base.py b/libs/langchain/langchain/docstore/base.py
index 34c0f197249..c5416c247ee 100644
--- a/libs/langchain/langchain/docstore/base.py
+++ b/libs/langchain/langchain/docstore/base.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "Docstore",
"AddableMixin",
+ "Docstore",
]
diff --git a/libs/langchain/langchain/document_loaders/__init__.py b/libs/langchain/langchain/document_loaders/__init__.py
index d5a6b9726ce..577ea730552 100644
--- a/libs/langchain/langchain/document_loaders/__init__.py
+++ b/libs/langchain/langchain/document_loaders/__init__.py
@@ -380,15 +380,13 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "AcreomLoader",
- "AsyncHtmlLoader",
- "AsyncChromiumLoader",
"AZLyricsLoader",
"AcreomLoader",
+ "AcreomLoader",
"AirbyteCDKLoader",
"AirbyteGongLoader",
- "AirbyteJSONLoader",
"AirbyteHubspotLoader",
+ "AirbyteJSONLoader",
"AirbyteSalesforceLoader",
"AirbyteShopifyLoader",
"AirbyteStripeLoader",
@@ -400,6 +398,8 @@ __all__ = [
"ArcGISLoader",
"ArxivLoader",
"AssemblyAIAudioTranscriptLoader",
+ "AsyncChromiumLoader",
+ "AsyncHtmlLoader",
"AsyncHtmlLoader",
"AzureAIDataLoader",
"AzureBlobStorageContainerLoader",
@@ -441,14 +441,14 @@ __all__ = [
"GCSDirectoryLoader",
"GCSFileLoader",
"GeoDataFrameLoader",
- "GithubFileLoader",
"GitHubIssuesLoader",
"GitLoader",
"GitbookLoader",
+ "GithubFileLoader",
"GoogleApiClient",
"GoogleApiYoutubeLoader",
- "GoogleSpeechToTextLoader",
"GoogleDriveLoader",
+ "GoogleSpeechToTextLoader",
"GutenbergLoader",
"HNLoader",
"HuggingFaceDatasetLoader",
@@ -458,8 +458,8 @@ __all__ = [
"IuguLoader",
"JSONLoader",
"JoplinLoader",
- "LarkSuiteDocLoader",
"LakeFSLoader",
+ "LarkSuiteDocLoader",
"MHTMLLoader",
"MWDumpLoader",
"MastodonTootsLoader",
@@ -483,13 +483,13 @@ __all__ = [
"PDFMinerLoader",
"PDFMinerPDFasHTMLLoader",
"PDFPlumberLoader",
+ "PagedPDFSplitter",
"PlaywrightURLLoader",
"PolarsDataFrameLoader",
"PsychicLoader",
"PubMedLoader",
"PyMuPDFLoader",
"PyPDFDirectoryLoader",
- "PagedPDFSplitter",
"PyPDFLoader",
"PyPDFium2Loader",
"PySparkDataFrameLoader",
@@ -513,9 +513,9 @@ __all__ = [
"TelegramChatApiLoader",
"TelegramChatFileLoader",
"TelegramChatLoader",
- "TensorflowDatasetLoader",
"TencentCOSDirectoryLoader",
"TencentCOSFileLoader",
+ "TensorflowDatasetLoader",
"TextLoader",
"ToMarkdownLoader",
"TomlLoader",
diff --git a/libs/langchain/langchain/document_loaders/airbyte.py b/libs/langchain/langchain/document_loaders/airbyte.py
index 57c4c6c5d30..8707f73416e 100644
--- a/libs/langchain/langchain/document_loaders/airbyte.py
+++ b/libs/langchain/langchain/document_loaders/airbyte.py
@@ -38,11 +38,11 @@ def __getattr__(name: str) -> Any:
__all__ = [
"AirbyteCDKLoader",
+ "AirbyteGongLoader",
"AirbyteHubspotLoader",
+ "AirbyteSalesforceLoader",
+ "AirbyteShopifyLoader",
"AirbyteStripeLoader",
"AirbyteTypeformLoader",
"AirbyteZendeskSupportLoader",
- "AirbyteShopifyLoader",
- "AirbyteSalesforceLoader",
- "AirbyteGongLoader",
]
diff --git a/libs/langchain/langchain/document_loaders/assemblyai.py b/libs/langchain/langchain/document_loaders/assemblyai.py
index 2cff9381a2d..b1fc724e1da 100644
--- a/libs/langchain/langchain/document_loaders/assemblyai.py
+++ b/libs/langchain/langchain/document_loaders/assemblyai.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "TranscriptFormat",
"AssemblyAIAudioTranscriptLoader",
+ "TranscriptFormat",
]
diff --git a/libs/langchain/langchain/document_loaders/base.py b/libs/langchain/langchain/document_loaders/base.py
index 4b0bf30b11e..ac8e0565a53 100644
--- a/libs/langchain/langchain/document_loaders/base.py
+++ b/libs/langchain/langchain/document_loaders/base.py
@@ -1,3 +1,3 @@
from langchain_core.document_loaders import BaseBlobParser, BaseLoader
-__all__ = ["BaseLoader", "BaseBlobParser"]
+__all__ = ["BaseBlobParser", "BaseLoader"]
diff --git a/libs/langchain/langchain/document_loaders/blob_loaders/__init__.py b/libs/langchain/langchain/document_loaders/blob_loaders/__init__.py
index 67898e4c2a9..d91d1658fad 100644
--- a/libs/langchain/langchain/document_loaders/blob_loaders/__init__.py
+++ b/libs/langchain/langchain/document_loaders/blob_loaders/__init__.py
@@ -29,8 +29,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "BlobLoader",
"Blob",
+ "BlobLoader",
"FileSystemBlobLoader",
"YoutubeAudioLoader",
]
diff --git a/libs/langchain/langchain/document_loaders/blockchain.py b/libs/langchain/langchain/document_loaders/blockchain.py
index b815c6e967b..8eb83e81b71 100644
--- a/libs/langchain/langchain/document_loaders/blockchain.py
+++ b/libs/langchain/langchain/document_loaders/blockchain.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "BlockchainType",
"BlockchainDocumentLoader",
+ "BlockchainType",
]
diff --git a/libs/langchain/langchain/document_loaders/chatgpt.py b/libs/langchain/langchain/document_loaders/chatgpt.py
index e9ab0934fd8..c117dec6445 100644
--- a/libs/langchain/langchain/document_loaders/chatgpt.py
+++ b/libs/langchain/langchain/document_loaders/chatgpt.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "concatenate_rows",
"ChatGPTLoader",
+ "concatenate_rows",
]
diff --git a/libs/langchain/langchain/document_loaders/confluence.py b/libs/langchain/langchain/document_loaders/confluence.py
index f91b828032a..71e4e8adf0d 100644
--- a/libs/langchain/langchain/document_loaders/confluence.py
+++ b/libs/langchain/langchain/document_loaders/confluence.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ContentFormat",
"ConfluenceLoader",
+ "ContentFormat",
]
diff --git a/libs/langchain/langchain/document_loaders/email.py b/libs/langchain/langchain/document_loaders/email.py
index 4d462e0a1a4..0ce8eb05c57 100644
--- a/libs/langchain/langchain/document_loaders/email.py
+++ b/libs/langchain/langchain/document_loaders/email.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "UnstructuredEmailLoader",
"OutlookMessageLoader",
+ "UnstructuredEmailLoader",
]
diff --git a/libs/langchain/langchain/document_loaders/facebook_chat.py b/libs/langchain/langchain/document_loaders/facebook_chat.py
index bdf5d219b70..34fb0a10e2e 100644
--- a/libs/langchain/langchain/document_loaders/facebook_chat.py
+++ b/libs/langchain/langchain/document_loaders/facebook_chat.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "concatenate_rows",
"FacebookChatLoader",
+ "concatenate_rows",
]
diff --git a/libs/langchain/langchain/document_loaders/notebook.py b/libs/langchain/langchain/document_loaders/notebook.py
index e29dcde56e2..ea0e7f7f9bb 100644
--- a/libs/langchain/langchain/document_loaders/notebook.py
+++ b/libs/langchain/langchain/document_loaders/notebook.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "NotebookLoader",
"concatenate_cells",
"remove_newlines",
- "NotebookLoader",
]
diff --git a/libs/langchain/langchain/document_loaders/parsers/__init__.py b/libs/langchain/langchain/document_loaders/parsers/__init__.py
index a0c3930e81b..2cf826708b8 100644
--- a/libs/langchain/langchain/document_loaders/parsers/__init__.py
+++ b/libs/langchain/langchain/document_loaders/parsers/__init__.py
@@ -53,6 +53,6 @@ __all__ = [
"PDFMinerParser",
"PDFPlumberParser",
"PyMuPDFParser",
- "PyPDFium2Parser",
"PyPDFParser",
+ "PyPDFium2Parser",
]
diff --git a/libs/langchain/langchain/document_loaders/parsers/docai.py b/libs/langchain/langchain/document_loaders/parsers/docai.py
index bdc293253b9..57f1baec2d6 100644
--- a/libs/langchain/langchain/document_loaders/parsers/docai.py
+++ b/libs/langchain/langchain/document_loaders/parsers/docai.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "DocAIParsingResults",
"DocAIParser",
+ "DocAIParsingResults",
]
diff --git a/libs/langchain/langchain/document_loaders/parsers/pdf.py b/libs/langchain/langchain/document_loaders/parsers/pdf.py
index 398134eed6b..f6924f2b53e 100644
--- a/libs/langchain/langchain/document_loaders/parsers/pdf.py
+++ b/libs/langchain/langchain/document_loaders/parsers/pdf.py
@@ -39,12 +39,12 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "extract_from_images_with_rapidocr",
- "PyPDFParser",
- "PDFMinerParser",
- "PyMuPDFParser",
- "PyPDFium2Parser",
- "PDFPlumberParser",
"AmazonTextractPDFParser",
"DocumentIntelligenceParser",
+ "PDFMinerParser",
+ "PDFPlumberParser",
+ "PyMuPDFParser",
+ "PyPDFParser",
+ "PyPDFium2Parser",
+ "extract_from_images_with_rapidocr",
]
diff --git a/libs/langchain/langchain/document_loaders/pdf.py b/libs/langchain/langchain/document_loaders/pdf.py
index 9e5a39ae467..8f50b2e6c69 100644
--- a/libs/langchain/langchain/document_loaders/pdf.py
+++ b/libs/langchain/langchain/document_loaders/pdf.py
@@ -49,17 +49,17 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "UnstructuredPDFLoader",
+ "AmazonTextractPDFLoader",
"BasePDFLoader",
+ "DocumentIntelligenceLoader",
+ "MathpixPDFLoader",
"OnlinePDFLoader",
- "PagedPDFSplitter",
- "PyPDFium2Loader",
- "PyPDFDirectoryLoader",
"PDFMinerLoader",
"PDFMinerPDFasHTMLLoader",
- "PyMuPDFLoader",
- "MathpixPDFLoader",
"PDFPlumberLoader",
- "AmazonTextractPDFLoader",
- "DocumentIntelligenceLoader",
+ "PagedPDFSplitter",
+ "PyMuPDFLoader",
+ "PyPDFDirectoryLoader",
+ "PyPDFium2Loader",
+ "UnstructuredPDFLoader",
]
diff --git a/libs/langchain/langchain/document_loaders/telegram.py b/libs/langchain/langchain/document_loaders/telegram.py
index 14523f65c49..f5499606db7 100644
--- a/libs/langchain/langchain/document_loaders/telegram.py
+++ b/libs/langchain/langchain/document_loaders/telegram.py
@@ -31,8 +31,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "concatenate_rows",
- "TelegramChatFileLoader",
- "text_to_docs",
"TelegramChatApiLoader",
+ "TelegramChatFileLoader",
+ "concatenate_rows",
+ "text_to_docs",
]
diff --git a/libs/langchain/langchain/document_loaders/unstructured.py b/libs/langchain/langchain/document_loaders/unstructured.py
index 242d3a07b7a..9911b388900 100644
--- a/libs/langchain/langchain/document_loaders/unstructured.py
+++ b/libs/langchain/langchain/document_loaders/unstructured.py
@@ -43,12 +43,12 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "satisfies_min_unstructured_version",
- "validate_unstructured_version",
+ "UnstructuredAPIFileIOLoader",
+ "UnstructuredAPIFileLoader",
"UnstructuredBaseLoader",
+ "UnstructuredFileIOLoader",
"UnstructuredFileLoader",
"get_elements_from_api",
- "UnstructuredAPIFileLoader",
- "UnstructuredFileIOLoader",
- "UnstructuredAPIFileIOLoader",
+ "satisfies_min_unstructured_version",
+ "validate_unstructured_version",
]
diff --git a/libs/langchain/langchain/document_loaders/url_playwright.py b/libs/langchain/langchain/document_loaders/url_playwright.py
index dd692cf5097..acbd0182839 100644
--- a/libs/langchain/langchain/document_loaders/url_playwright.py
+++ b/libs/langchain/langchain/document_loaders/url_playwright.py
@@ -28,6 +28,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
"PlaywrightEvaluator",
- "UnstructuredHtmlEvaluator",
"PlaywrightURLLoader",
+ "UnstructuredHtmlEvaluator",
]
diff --git a/libs/langchain/langchain/document_loaders/whatsapp_chat.py b/libs/langchain/langchain/document_loaders/whatsapp_chat.py
index 3fc2133e497..d37aa09f987 100644
--- a/libs/langchain/langchain/document_loaders/whatsapp_chat.py
+++ b/libs/langchain/langchain/document_loaders/whatsapp_chat.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "concatenate_rows",
"WhatsAppChatLoader",
+ "concatenate_rows",
]
diff --git a/libs/langchain/langchain/document_loaders/youtube.py b/libs/langchain/langchain/document_loaders/youtube.py
index cf696783121..a36445c2c6c 100644
--- a/libs/langchain/langchain/document_loaders/youtube.py
+++ b/libs/langchain/langchain/document_loaders/youtube.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "YoutubeLoader",
- "GoogleApiYoutubeLoader",
"GoogleApiClient",
+ "GoogleApiYoutubeLoader",
+ "YoutubeLoader",
]
diff --git a/libs/langchain/langchain/document_transformers/__init__.py b/libs/langchain/langchain/document_transformers/__init__.py
index adfd277c33d..e3bd8ab87a3 100644
--- a/libs/langchain/langchain/document_transformers/__init__.py
+++ b/libs/langchain/langchain/document_transformers/__init__.py
@@ -63,15 +63,15 @@ def __getattr__(name: str) -> Any:
__all__ = [
"BeautifulSoupTransformer",
+ "DoctranPropertyExtractor",
"DoctranQATransformer",
"DoctranTextTranslator",
- "DoctranPropertyExtractor",
"EmbeddingsClusteringFilter",
"EmbeddingsRedundantFilter",
"GoogleTranslateTransformer",
- "get_stateful_documents",
+ "Html2TextTransformer",
"LongContextReorder",
"NucliaTextTransformer",
"OpenAIMetadataTagger",
- "Html2TextTransformer",
+ "get_stateful_documents",
]
diff --git a/libs/langchain/langchain/document_transformers/embeddings_redundant_filter.py b/libs/langchain/langchain/document_transformers/embeddings_redundant_filter.py
index 2230444af6f..cb79b88c20b 100644
--- a/libs/langchain/langchain/document_transformers/embeddings_redundant_filter.py
+++ b/libs/langchain/langchain/document_transformers/embeddings_redundant_filter.py
@@ -41,10 +41,10 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "EmbeddingsRedundantFilter",
"EmbeddingsClusteringFilter",
+ "EmbeddingsRedundantFilter",
"_DocumentWithState",
- "get_stateful_documents",
- "_get_embeddings_from_stateful_docs",
"_filter_similar_embeddings",
+ "_get_embeddings_from_stateful_docs",
+ "get_stateful_documents",
]
diff --git a/libs/langchain/langchain/embeddings/__init__.py b/libs/langchain/langchain/embeddings/__init__.py
index 8c8ef661c53..87b20ba4e80 100644
--- a/libs/langchain/langchain/embeddings/__init__.py
+++ b/libs/langchain/langchain/embeddings/__init__.py
@@ -187,8 +187,8 @@ __all__ = [
"ErnieEmbeddings",
"FakeEmbeddings",
"FastEmbedEmbeddings",
- "GooglePalmEmbeddings",
"GPT4AllEmbeddings",
+ "GooglePalmEmbeddings",
"GradientEmbeddings",
"HuggingFaceBgeEmbeddings",
"HuggingFaceEmbeddings",
diff --git a/libs/langchain/langchain/embeddings/base.py b/libs/langchain/langchain/embeddings/base.py
index eea04a10f94..40f50418ae6 100644
--- a/libs/langchain/langchain/embeddings/base.py
+++ b/libs/langchain/langchain/embeddings/base.py
@@ -229,6 +229,6 @@ def init_embeddings(
__all__ = [
- "init_embeddings",
"Embeddings", # This one is for backwards compatibility
+ "init_embeddings",
]
diff --git a/libs/langchain/langchain/embeddings/fake.py b/libs/langchain/langchain/embeddings/fake.py
index 8b17af0cb9f..9ba9421e3e0 100644
--- a/libs/langchain/langchain/embeddings/fake.py
+++ b/libs/langchain/langchain/embeddings/fake.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "FakeEmbeddings",
"DeterministicFakeEmbedding",
+ "FakeEmbeddings",
]
diff --git a/libs/langchain/langchain/embeddings/huggingface.py b/libs/langchain/langchain/embeddings/huggingface.py
index 5627bbedbb6..d473ae9fbc6 100644
--- a/libs/langchain/langchain/embeddings/huggingface.py
+++ b/libs/langchain/langchain/embeddings/huggingface.py
@@ -29,8 +29,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "HuggingFaceEmbeddings",
- "HuggingFaceInstructEmbeddings",
"HuggingFaceBgeEmbeddings",
+ "HuggingFaceEmbeddings",
"HuggingFaceInferenceAPIEmbeddings",
+ "HuggingFaceInstructEmbeddings",
]
diff --git a/libs/langchain/langchain/evaluation/__init__.py b/libs/langchain/langchain/evaluation/__init__.py
index df95a44ea20..22afbccf4eb 100644
--- a/libs/langchain/langchain/evaluation/__init__.py
+++ b/libs/langchain/langchain/evaluation/__init__.py
@@ -95,34 +95,34 @@ from langchain.evaluation.string_distance import (
)
__all__ = [
- "EvaluatorType",
- "ExactMatchStringEvaluator",
- "RegexMatchStringEvaluator",
- "PairwiseStringEvalChain",
- "LabeledPairwiseStringEvalChain",
- "QAEvalChain",
- "CotQAEvalChain",
+ "AgentTrajectoryEvaluator",
"ContextQAEvalChain",
- "StringEvaluator",
- "PairwiseStringEvaluator",
- "TrajectoryEvalChain",
- "CriteriaEvalChain",
+ "CotQAEvalChain",
"Criteria",
+ "CriteriaEvalChain",
"EmbeddingDistance",
"EmbeddingDistanceEvalChain",
+ "EvaluatorType",
+ "ExactMatchStringEvaluator",
+ "JsonEditDistanceEvaluator",
+ "JsonEqualityEvaluator",
+ "JsonSchemaEvaluator",
+ "JsonValidityEvaluator",
+ "LabeledCriteriaEvalChain",
+ "LabeledPairwiseStringEvalChain",
+ "LabeledScoreStringEvalChain",
"PairwiseEmbeddingDistanceEvalChain",
+ "PairwiseStringDistanceEvalChain",
+ "PairwiseStringEvalChain",
+ "PairwiseStringEvaluator",
+ "QAEvalChain",
+ "RegexMatchStringEvaluator",
+ "ScoreStringEvalChain",
"StringDistance",
"StringDistanceEvalChain",
- "PairwiseStringDistanceEvalChain",
- "LabeledCriteriaEvalChain",
- "load_evaluators",
- "load_evaluator",
+ "StringEvaluator",
+ "TrajectoryEvalChain",
"load_dataset",
- "AgentTrajectoryEvaluator",
- "ScoreStringEvalChain",
- "LabeledScoreStringEvalChain",
- "JsonValidityEvaluator",
- "JsonEqualityEvaluator",
- "JsonEditDistanceEvaluator",
- "JsonSchemaEvaluator",
+ "load_evaluator",
+ "load_evaluators",
]
diff --git a/libs/langchain/langchain/evaluation/comparison/__init__.py b/libs/langchain/langchain/evaluation/comparison/__init__.py
index 28359913754..2b2d5c47e2a 100644
--- a/libs/langchain/langchain/evaluation/comparison/__init__.py
+++ b/libs/langchain/langchain/evaluation/comparison/__init__.py
@@ -33,4 +33,4 @@ from langchain.evaluation.comparison.eval_chain import (
PairwiseStringEvalChain,
)
-__all__ = ["PairwiseStringEvalChain", "LabeledPairwiseStringEvalChain"]
+__all__ = ["LabeledPairwiseStringEvalChain", "PairwiseStringEvalChain"]
diff --git a/libs/langchain/langchain/evaluation/criteria/__init__.py b/libs/langchain/langchain/evaluation/criteria/__init__.py
index 6440c8c0eac..e8ab983bab6 100644
--- a/libs/langchain/langchain/evaluation/criteria/__init__.py
+++ b/libs/langchain/langchain/evaluation/criteria/__init__.py
@@ -53,4 +53,4 @@ from langchain.evaluation.criteria.eval_chain import (
LabeledCriteriaEvalChain,
)
-__all__ = ["CriteriaEvalChain", "LabeledCriteriaEvalChain", "Criteria"]
+__all__ = ["Criteria", "CriteriaEvalChain", "LabeledCriteriaEvalChain"]
diff --git a/libs/langchain/langchain/evaluation/qa/__init__.py b/libs/langchain/langchain/evaluation/qa/__init__.py
index 4677fa1f449..15b33219cc5 100644
--- a/libs/langchain/langchain/evaluation/qa/__init__.py
+++ b/libs/langchain/langchain/evaluation/qa/__init__.py
@@ -7,4 +7,4 @@ from langchain.evaluation.qa.eval_chain import (
)
from langchain.evaluation.qa.generate_chain import QAGenerateChain
-__all__ = ["QAEvalChain", "QAGenerateChain", "ContextQAEvalChain", "CotQAEvalChain"]
+__all__ = ["ContextQAEvalChain", "CotQAEvalChain", "QAEvalChain", "QAGenerateChain"]
diff --git a/libs/langchain/langchain/evaluation/scoring/__init__.py b/libs/langchain/langchain/evaluation/scoring/__init__.py
index 29b414bcdf5..0d780659f6a 100644
--- a/libs/langchain/langchain/evaluation/scoring/__init__.py
+++ b/libs/langchain/langchain/evaluation/scoring/__init__.py
@@ -28,4 +28,4 @@ from langchain.evaluation.scoring.eval_chain import (
ScoreStringEvalChain,
)
-__all__ = ["ScoreStringEvalChain", "LabeledScoreStringEvalChain"]
+__all__ = ["LabeledScoreStringEvalChain", "ScoreStringEvalChain"]
diff --git a/libs/langchain/langchain/evaluation/scoring/eval_chain.py b/libs/langchain/langchain/evaluation/scoring/eval_chain.py
index aa3d307fb59..4ae86e00547 100644
--- a/libs/langchain/langchain/evaluation/scoring/eval_chain.py
+++ b/libs/langchain/langchain/evaluation/scoring/eval_chain.py
@@ -133,7 +133,7 @@ class ScoreStringResultOutputParser(BaseOutputParser[dict]):
if match:
verdict = match.group(1)
- if not match or verdict not in list("123456789") + ["10"]:
+ if not match or verdict not in [*list("123456789"), "10"]:
msg = (
f"Invalid output: {text}. "
"Output must contain a double bracketed string\
diff --git a/libs/langchain/langchain/graphs/__init__.py b/libs/langchain/langchain/graphs/__init__.py
index 58210016b22..cf645c6b082 100644
--- a/libs/langchain/langchain/graphs/__init__.py
+++ b/libs/langchain/langchain/graphs/__init__.py
@@ -44,14 +44,14 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "MemgraphGraph",
- "NetworkxEntityGraph",
- "Neo4jGraph",
- "NebulaGraph",
- "NeptuneGraph",
- "KuzuGraph",
- "HugeGraph",
- "RdfGraph",
"ArangoGraph",
"FalkorDBGraph",
+ "HugeGraph",
+ "KuzuGraph",
+ "MemgraphGraph",
+ "NebulaGraph",
+ "Neo4jGraph",
+ "NeptuneGraph",
+ "NetworkxEntityGraph",
+ "RdfGraph",
]
diff --git a/libs/langchain/langchain/graphs/graph_document.py b/libs/langchain/langchain/graphs/graph_document.py
index 6848bca961c..c2520be4642 100644
--- a/libs/langchain/langchain/graphs/graph_document.py
+++ b/libs/langchain/langchain/graphs/graph_document.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "GraphDocument",
"Node",
"Relationship",
- "GraphDocument",
]
diff --git a/libs/langchain/langchain/graphs/networkx_graph.py b/libs/langchain/langchain/graphs/networkx_graph.py
index 1b360f15b85..b0842394355 100644
--- a/libs/langchain/langchain/graphs/networkx_graph.py
+++ b/libs/langchain/langchain/graphs/networkx_graph.py
@@ -30,7 +30,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
"KnowledgeTriple",
- "parse_triples",
- "get_entities",
"NetworkxEntityGraph",
+ "get_entities",
+ "parse_triples",
]
diff --git a/libs/langchain/langchain/indexes/__init__.py b/libs/langchain/langchain/indexes/__init__.py
index 11b95a38e33..c4e282cfdf0 100644
--- a/libs/langchain/langchain/indexes/__init__.py
+++ b/libs/langchain/langchain/indexes/__init__.py
@@ -40,11 +40,11 @@ def __getattr__(name: str) -> Any:
__all__ = [
- # Keep sorted
- "aindex",
"GraphIndexCreator",
- "index",
"IndexingResult",
"SQLRecordManager",
"VectorstoreIndexCreator",
+ # Keep sorted
+ "aindex",
+ "index",
]
diff --git a/libs/langchain/langchain/llms/__init__.py b/libs/langchain/langchain/llms/__init__.py
index 30337d8f360..f108db5fe8a 100644
--- a/libs/langchain/langchain/llms/__init__.py
+++ b/libs/langchain/langchain/llms/__init__.py
@@ -566,6 +566,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
"AI21",
+ "RWKV",
+ "VLLM",
"AlephAlpha",
"AmazonAPIGateway",
"Anthropic",
@@ -591,8 +593,8 @@ __all__ = [
"FakeListLLM",
"Fireworks",
"ForefrontAI",
- "GigaChat",
"GPT4All",
+ "GigaChat",
"GooglePalm",
"GooseAI",
"GradientLLM",
@@ -601,18 +603,20 @@ __all__ = [
"HuggingFacePipeline",
"HuggingFaceTextGenInference",
"HumanInputLLM",
+ "JavelinAIGateway",
"KoboldApiLLM",
"LlamaCpp",
- "TextGen",
"ManifestWrapper",
"Minimax",
"MlflowAIGateway",
"Modal",
"MosaicML",
- "Nebula",
"NIBittensorLLM",
"NLPCloud",
+ "Nebula",
+ "OctoAIEndpoint",
"Ollama",
+ "OpaquePrompts",
"OpenAI",
"OpenAIChat",
"OpenLLM",
@@ -624,28 +628,24 @@ __all__ = [
"PredictionGuard",
"PromptLayerOpenAI",
"PromptLayerOpenAIChat",
- "OpaquePrompts",
- "RWKV",
+ "QianfanLLMEndpoint",
"Replicate",
"SagemakerEndpoint",
"SelfHostedHuggingFaceLLM",
"SelfHostedPipeline",
"StochasticAI",
+ "TextGen",
"TitanTakeoff",
"TitanTakeoffPro",
"Tongyi",
+ "VLLMOpenAI",
"VertexAI",
"VertexAIModelGarden",
- "VLLM",
- "VLLMOpenAI",
+ "VolcEngineMaasLLM",
"WatsonxLLM",
"Writer",
- "OctoAIEndpoint",
"Xinference",
- "JavelinAIGateway",
- "QianfanLLMEndpoint",
"YandexGPT",
- "VolcEngineMaasLLM",
]
diff --git a/libs/langchain/langchain/llms/ai21.py b/libs/langchain/langchain/llms/ai21.py
index 7bdb2168cd5..306d2036182 100644
--- a/libs/langchain/langchain/llms/ai21.py
+++ b/libs/langchain/langchain/llms/ai21.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "AI21PenaltyData",
"AI21",
+ "AI21PenaltyData",
]
diff --git a/libs/langchain/langchain/llms/azureml_endpoint.py b/libs/langchain/langchain/llms/azureml_endpoint.py
index 6b47cfbb87f..cbe04f1cde8 100644
--- a/libs/langchain/langchain/llms/azureml_endpoint.py
+++ b/libs/langchain/langchain/llms/azureml_endpoint.py
@@ -38,11 +38,11 @@ def __getattr__(name: str) -> Any:
__all__ = [
"AzureMLEndpointClient",
- "ContentFormatterBase",
- "GPT2ContentFormatter",
- "OSSContentFormatter",
- "HFContentFormatter",
- "DollyContentFormatter",
- "CustomOpenAIContentFormatter",
"AzureMLOnlineEndpoint",
+ "ContentFormatterBase",
+ "CustomOpenAIContentFormatter",
+ "DollyContentFormatter",
+ "GPT2ContentFormatter",
+ "HFContentFormatter",
+ "OSSContentFormatter",
]
diff --git a/libs/langchain/langchain/llms/base.py b/libs/langchain/langchain/llms/base.py
index 85bd0dd232c..335fbadbcfc 100644
--- a/libs/langchain/langchain/llms/base.py
+++ b/libs/langchain/langchain/llms/base.py
@@ -6,7 +6,7 @@ from langchain_core.language_models.llms import (
)
__all__ = [
- "BaseLanguageModel",
- "BaseLLM",
"LLM",
+ "BaseLLM",
+ "BaseLanguageModel",
]
diff --git a/libs/langchain/langchain/llms/bedrock.py b/libs/langchain/langchain/llms/bedrock.py
index 052bc8a7a73..c97f94be124 100644
--- a/libs/langchain/langchain/llms/bedrock.py
+++ b/libs/langchain/langchain/llms/bedrock.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "BedrockBase",
"Bedrock",
+ "BedrockBase",
]
diff --git a/libs/langchain/langchain/llms/gradient_ai.py b/libs/langchain/langchain/llms/gradient_ai.py
index 83dbd686978..5c286c62b62 100644
--- a/libs/langchain/langchain/llms/gradient_ai.py
+++ b/libs/langchain/langchain/llms/gradient_ai.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "TrainResult",
"GradientLLM",
+ "TrainResult",
]
diff --git a/libs/langchain/langchain/llms/loading.py b/libs/langchain/langchain/llms/loading.py
index 7517da6b940..2fde6e394e2 100644
--- a/libs/langchain/langchain/llms/loading.py
+++ b/libs/langchain/langchain/llms/loading.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "load_llm_from_config",
"load_llm",
+ "load_llm_from_config",
]
diff --git a/libs/langchain/langchain/llms/openai.py b/libs/langchain/langchain/llms/openai.py
index 8f88b4b0537..ead0be7a19f 100644
--- a/libs/langchain/langchain/llms/openai.py
+++ b/libs/langchain/langchain/llms/openai.py
@@ -25,8 +25,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "AzureOpenAI",
"BaseOpenAI",
"OpenAI",
- "AzureOpenAI",
"OpenAIChat",
]
diff --git a/libs/langchain/langchain/llms/sagemaker_endpoint.py b/libs/langchain/langchain/llms/sagemaker_endpoint.py
index 101f6e66559..beb467e42a3 100644
--- a/libs/langchain/langchain/llms/sagemaker_endpoint.py
+++ b/libs/langchain/langchain/llms/sagemaker_endpoint.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SagemakerEndpoint",
"LLMContentHandler",
+ "SagemakerEndpoint",
]
diff --git a/libs/langchain/langchain/load/dump.py b/libs/langchain/langchain/load/dump.py
index fd9552018c8..473f57ab093 100644
--- a/libs/langchain/langchain/load/dump.py
+++ b/libs/langchain/langchain/load/dump.py
@@ -1,3 +1,3 @@
from langchain_core.load.dump import default, dumpd, dumps
-__all__ = ["default", "dumps", "dumpd"]
+__all__ = ["default", "dumpd", "dumps"]
diff --git a/libs/langchain/langchain/load/load.py b/libs/langchain/langchain/load/load.py
index 5a32ea081f0..2415a3db51b 100644
--- a/libs/langchain/langchain/load/load.py
+++ b/libs/langchain/langchain/load/load.py
@@ -1,3 +1,3 @@
from langchain_core.load.load import Reviver, load, loads
-__all__ = ["Reviver", "loads", "load"]
+__all__ = ["Reviver", "load", "loads"]
diff --git a/libs/langchain/langchain/load/serializable.py b/libs/langchain/langchain/load/serializable.py
index d1c0772d61d..d20850ad0b7 100644
--- a/libs/langchain/langchain/load/serializable.py
+++ b/libs/langchain/langchain/load/serializable.py
@@ -10,10 +10,10 @@ from langchain_core.load.serializable import (
__all__ = [
"BaseSerialized",
- "SerializedConstructor",
- "SerializedSecret",
- "SerializedNotImplemented",
- "try_neq_default",
"Serializable",
+ "SerializedConstructor",
+ "SerializedNotImplemented",
+ "SerializedSecret",
"to_json_not_implemented",
+ "try_neq_default",
]
diff --git a/libs/langchain/langchain/memory/__init__.py b/libs/langchain/langchain/memory/__init__.py
index de0281c8288..b47225522b5 100644
--- a/libs/langchain/langchain/memory/__init__.py
+++ b/libs/langchain/langchain/memory/__init__.py
@@ -139,15 +139,15 @@ __all__ = [
"ReadOnlySharedMemory",
"RedisChatMessageHistory",
"RedisEntityStore",
- "SingleStoreDBChatMessageHistory",
"SQLChatMessageHistory",
"SQLiteEntityStore",
"SimpleMemory",
+ "SingleStoreDBChatMessageHistory",
"StreamlitChatMessageHistory",
+ "UpstashRedisChatMessageHistory",
+ "UpstashRedisEntityStore",
"VectorStoreRetrieverMemory",
"XataChatMessageHistory",
"ZepChatMessageHistory",
"ZepMemory",
- "UpstashRedisEntityStore",
- "UpstashRedisChatMessageHistory",
]
diff --git a/libs/langchain/langchain/memory/buffer.py b/libs/langchain/langchain/memory/buffer.py
index 394acdf2bd5..1bd8a48b884 100644
--- a/libs/langchain/langchain/memory/buffer.py
+++ b/libs/langchain/langchain/memory/buffer.py
@@ -150,7 +150,7 @@ class ConversationStringBufferMemory(BaseMemory):
if len(outputs) != 1:
msg = f"One output key expected, got {outputs.keys()}"
raise ValueError(msg)
- output_key = list(outputs.keys())[0]
+ output_key = next(iter(outputs.keys()))
else:
output_key = self.output_key
human = f"{self.human_prefix}: " + inputs[prompt_input_key]
diff --git a/libs/langchain/langchain/memory/chat_memory.py b/libs/langchain/langchain/memory/chat_memory.py
index f8bfde0db1f..4a18ce8d44d 100644
--- a/libs/langchain/langchain/memory/chat_memory.py
+++ b/libs/langchain/langchain/memory/chat_memory.py
@@ -49,7 +49,7 @@ class BaseChatMemory(BaseMemory, ABC):
prompt_input_key = self.input_key
if self.output_key is None:
if len(outputs) == 1:
- output_key = list(outputs.keys())[0]
+ output_key = next(iter(outputs.keys()))
elif "output" in outputs:
output_key = "output"
warnings.warn(
diff --git a/libs/langchain/langchain/memory/chat_message_histories/__init__.py b/libs/langchain/langchain/memory/chat_message_histories/__init__.py
index 91910137f62..367aee4f472 100644
--- a/libs/langchain/langchain/memory/chat_message_histories/__init__.py
+++ b/libs/langchain/langchain/memory/chat_message_histories/__init__.py
@@ -75,8 +75,8 @@ __all__ = [
"PostgresChatMessageHistory",
"RedisChatMessageHistory",
"RocksetChatMessageHistory",
- "SingleStoreDBChatMessageHistory",
"SQLChatMessageHistory",
+ "SingleStoreDBChatMessageHistory",
"StreamlitChatMessageHistory",
"UpstashRedisChatMessageHistory",
"XataChatMessageHistory",
diff --git a/libs/langchain/langchain/memory/entity.py b/libs/langchain/langchain/memory/entity.py
index c52eb5e6b85..861857fa2c9 100644
--- a/libs/langchain/langchain/memory/entity.py
+++ b/libs/langchain/langchain/memory/entity.py
@@ -348,7 +348,7 @@ class SQLiteEntityStore(BaseEntityStore):
def get(self, key: str, default: Optional[str] = None) -> Optional[str]:
"""Retrieves a value, safely quoting the table name."""
# `?` placeholder is used for the value to prevent SQL injection
- # noqa since we validate for malicious table/session names in `__init__`
+ # Ignore S608 since we validate for malicious table/session names in `__init__`
query = f'SELECT value FROM "{self.full_table_name}" WHERE key = ?' # noqa: S608
cursor = self._execute_query(query, (key,))
result = cursor.fetchone()
@@ -358,7 +358,7 @@ class SQLiteEntityStore(BaseEntityStore):
"""Inserts or replaces a value, safely quoting the table name."""
if not value:
return self.delete(key)
- # noqa since we validate for malicious table/session names in `__init__`
+ # Ignore S608 since we validate for malicious table/session names in `__init__`
query = (
"INSERT OR REPLACE INTO " # noqa: S608
f'"{self.full_table_name}" (key, value) VALUES (?, ?)'
@@ -368,19 +368,19 @@ class SQLiteEntityStore(BaseEntityStore):
def delete(self, key: str) -> None:
"""Deletes a key-value pair, safely quoting the table name."""
- # noqa since we validate for malicious table/session names in `__init__`
+ # Ignore S608 since we validate for malicious table/session names in `__init__`
query = f'DELETE FROM "{self.full_table_name}" WHERE key = ?' # noqa: S608
self._execute_query(query, (key,))
def exists(self, key: str) -> bool:
"""Checks for the existence of a key, safely quoting the table name."""
- # noqa since we validate for malicious table/session names in `__init__`
+ # Ignore S608 since we validate for malicious table/session names in `__init__`
query = f'SELECT 1 FROM "{self.full_table_name}" WHERE key = ? LIMIT 1' # noqa: S608
cursor = self._execute_query(query, (key,))
return cursor.fetchone() is not None
def clear(self) -> None:
- # noqa since we validate for malicious table/session names in `__init__`
+ # Ignore S608 since we validate for malicious table/session names in `__init__`
query = f"""
DELETE FROM {self.full_table_name}
""" # noqa: S608
diff --git a/libs/langchain/langchain/memory/summary.py b/libs/langchain/langchain/memory/summary.py
index c604704e397..98825a10c37 100644
--- a/libs/langchain/langchain/memory/summary.py
+++ b/libs/langchain/langchain/memory/summary.py
@@ -22,7 +22,7 @@ from langchain.memory.prompt import SUMMARY_PROMPT
removal="1.0",
message=(
"Refer here for how to incorporate summaries of conversation history: "
- "https://langchain-ai.github.io/langgraph/how-tos/memory/add-summary-conversation-history/" # noqa: E501
+ "https://langchain-ai.github.io/langgraph/how-tos/memory/add-summary-conversation-history/"
),
)
class SummarizerMixin(BaseModel):
diff --git a/libs/langchain/langchain/memory/utils.py b/libs/langchain/langchain/memory/utils.py
index 79b0504415f..6415d3b597f 100644
--- a/libs/langchain/langchain/memory/utils.py
+++ b/libs/langchain/langchain/memory/utils.py
@@ -14,7 +14,7 @@ def get_prompt_input_key(inputs: dict[str, Any], memory_variables: list[str]) ->
"""
# "stop" is a special key that can be passed as input but is not used to
# format the prompt.
- prompt_input_keys = list(set(inputs).difference(memory_variables + ["stop"]))
+ prompt_input_keys = list(set(inputs).difference([*memory_variables, "stop"]))
if len(prompt_input_keys) != 1:
msg = f"One input key expected got {prompt_input_keys}"
raise ValueError(msg)
diff --git a/libs/langchain/langchain/memory/vectorstore_token_buffer_memory.py b/libs/langchain/langchain/memory/vectorstore_token_buffer_memory.py
index 6235b9ed23f..b839bb1d514 100644
--- a/libs/langchain/langchain/memory/vectorstore_token_buffer_memory.py
+++ b/libs/langchain/langchain/memory/vectorstore_token_buffer_memory.py
@@ -167,7 +167,6 @@ class ConversationVectorStoreTokenBufferMemory(ConversationTokenBufferMemory):
self._pop_and_store_interaction(buffer)
def _pop_and_store_interaction(self, buffer: list[BaseMessage]) -> None:
- input_ = buffer.pop(0)
output = buffer.pop(0)
timestamp = self._timestamps.pop(0).strftime(TIMESTAMP_FORMAT)
# Split AI output into smaller chunks to avoid creating documents
@@ -175,7 +174,7 @@ class ConversationVectorStoreTokenBufferMemory(ConversationTokenBufferMemory):
ai_chunks = self._split_long_ai_text(str(output.content))
for index, chunk in enumerate(ai_chunks):
self.memory_retriever.save_context(
- {"Human": f"<{timestamp}/00> {str(input_.content)}"},
+ {"Human": f"<{timestamp}/00> {input.content!s}"},
{"AI": f"<{timestamp}/{index:02}> {chunk}"},
)
diff --git a/libs/langchain/langchain/output_parsers/__init__.py b/libs/langchain/langchain/output_parsers/__init__.py
index c06b7713c65..bff4ddb8f20 100644
--- a/libs/langchain/langchain/output_parsers/__init__.py
+++ b/libs/langchain/langchain/output_parsers/__init__.py
@@ -67,12 +67,15 @@ __all__ = [
"DatetimeOutputParser",
"EnumOutputParser",
"GuardrailsOutputParser",
+ "JsonOutputKeyToolsParser",
+ "JsonOutputToolsParser",
"ListOutputParser",
"MarkdownListOutputParser",
"NumberedListOutputParser",
"OutputFixingParser",
"PandasDataFrameOutputParser",
"PydanticOutputParser",
+ "PydanticToolsParser",
"RegexDictParser",
"RegexParser",
"ResponseSchema",
@@ -80,8 +83,5 @@ __all__ = [
"RetryWithErrorOutputParser",
"StructuredOutputParser",
"XMLOutputParser",
- "JsonOutputToolsParser",
- "PydanticToolsParser",
- "JsonOutputKeyToolsParser",
"YamlOutputParser",
]
diff --git a/libs/langchain/langchain/output_parsers/json.py b/libs/langchain/langchain/output_parsers/json.py
index 20b06e3bcaa..a7b52d89e43 100644
--- a/libs/langchain/langchain/output_parsers/json.py
+++ b/libs/langchain/langchain/output_parsers/json.py
@@ -9,7 +9,7 @@ from langchain_core.utils.json import (
__all__ = [
"SimpleJsonOutputParser",
- "parse_partial_json",
- "parse_json_markdown",
"parse_and_check_json_markdown",
+ "parse_json_markdown",
+ "parse_partial_json",
]
diff --git a/libs/langchain/langchain/output_parsers/list.py b/libs/langchain/langchain/output_parsers/list.py
index b5ffd8a3ab7..d8001bce75a 100644
--- a/libs/langchain/langchain/output_parsers/list.py
+++ b/libs/langchain/langchain/output_parsers/list.py
@@ -6,8 +6,8 @@ from langchain_core.output_parsers.list import (
)
__all__ = [
- "ListOutputParser",
"CommaSeparatedListOutputParser",
- "NumberedListOutputParser",
+ "ListOutputParser",
"MarkdownListOutputParser",
+ "NumberedListOutputParser",
]
diff --git a/libs/langchain/langchain/output_parsers/openai_functions.py b/libs/langchain/langchain/output_parsers/openai_functions.py
index 800b66b652c..607e3472644 100644
--- a/libs/langchain/langchain/output_parsers/openai_functions.py
+++ b/libs/langchain/langchain/output_parsers/openai_functions.py
@@ -6,8 +6,8 @@ from langchain_core.output_parsers.openai_functions import (
)
__all__ = [
- "PydanticOutputFunctionsParser",
- "PydanticAttrOutputFunctionsParser",
- "JsonOutputFunctionsParser",
"JsonKeyOutputFunctionsParser",
+ "JsonOutputFunctionsParser",
+ "PydanticAttrOutputFunctionsParser",
+ "PydanticOutputFunctionsParser",
]
diff --git a/libs/langchain/langchain/output_parsers/openai_tools.py b/libs/langchain/langchain/output_parsers/openai_tools.py
index 57a1a667226..bf7b62e88f6 100644
--- a/libs/langchain/langchain/output_parsers/openai_tools.py
+++ b/libs/langchain/langchain/output_parsers/openai_tools.py
@@ -4,4 +4,4 @@ from langchain_core.output_parsers.openai_tools import (
PydanticToolsParser,
)
-__all__ = ["PydanticToolsParser", "JsonOutputToolsParser", "JsonOutputKeyToolsParser"]
+__all__ = ["JsonOutputKeyToolsParser", "JsonOutputToolsParser", "PydanticToolsParser"]
diff --git a/libs/langchain/langchain/prompts/__init__.py b/libs/langchain/langchain/prompts/__init__.py
index 63ace4e2717..7a4ae58c78d 100644
--- a/libs/langchain/langchain/prompts/__init__.py
+++ b/libs/langchain/langchain/prompts/__init__.py
@@ -82,6 +82,7 @@ __all__ = [
"BasePromptTemplate",
"ChatMessagePromptTemplate",
"ChatPromptTemplate",
+ "FewShotChatMessagePromptTemplate",
"FewShotPromptTemplate",
"FewShotPromptWithTemplates",
"HumanMessagePromptTemplate",
@@ -90,11 +91,10 @@ __all__ = [
"MessagesPlaceholder",
"NGramOverlapExampleSelector",
"PipelinePromptTemplate",
+ "Prompt",
"PromptTemplate",
"SemanticSimilarityExampleSelector",
"StringPromptTemplate",
"SystemMessagePromptTemplate",
"load_prompt",
- "FewShotChatMessagePromptTemplate",
- "Prompt",
]
diff --git a/libs/langchain/langchain/prompts/base.py b/libs/langchain/langchain/prompts/base.py
index a315ec92d8e..085bda5b939 100644
--- a/libs/langchain/langchain/prompts/base.py
+++ b/libs/langchain/langchain/prompts/base.py
@@ -10,12 +10,12 @@ from langchain_core.prompts import (
from langchain_core.prompts.string import _get_jinja2_variables_from_template
__all__ = [
- "jinja2_formatter",
- "validate_jinja2",
- "check_valid_template",
- "get_template_variables",
- "StringPromptTemplate",
"BasePromptTemplate",
+ "StringPromptTemplate",
"StringPromptValue",
"_get_jinja2_variables_from_template",
+ "check_valid_template",
+ "get_template_variables",
+ "jinja2_formatter",
+ "validate_jinja2",
]
diff --git a/libs/langchain/langchain/prompts/chat.py b/libs/langchain/langchain/prompts/chat.py
index cf3403e941e..c79534b12cc 100644
--- a/libs/langchain/langchain/prompts/chat.py
+++ b/libs/langchain/langchain/prompts/chat.py
@@ -16,22 +16,22 @@ from langchain_core.prompts.chat import (
)
__all__ = [
+ "AIMessagePromptTemplate",
+ "BaseChatPromptTemplate",
"BaseMessagePromptTemplate",
- "MessagesPlaceholder",
"BaseStringMessagePromptTemplate",
"ChatMessagePromptTemplate",
- "HumanMessagePromptTemplate",
- "AIMessagePromptTemplate",
- "SystemMessagePromptTemplate",
- "BaseChatPromptTemplate",
"ChatPromptTemplate",
"ChatPromptValue",
"ChatPromptValueConcrete",
- "_convert_to_message",
- "_create_template_from_message_type",
- "MessagePromptTemplateT",
+ "HumanMessagePromptTemplate",
"MessageLike",
"MessageLikeRepresentation",
+ "MessagePromptTemplateT",
+ "MessagesPlaceholder",
+ "SystemMessagePromptTemplate",
+ "_convert_to_message",
+ "_create_template_from_message_type",
]
from langchain_core.prompts.message import BaseMessagePromptTemplate
diff --git a/libs/langchain/langchain/prompts/example_selector/semantic_similarity.py b/libs/langchain/langchain/prompts/example_selector/semantic_similarity.py
index e921236d878..4942632bced 100644
--- a/libs/langchain/langchain/prompts/example_selector/semantic_similarity.py
+++ b/libs/langchain/langchain/prompts/example_selector/semantic_similarity.py
@@ -5,7 +5,7 @@ from langchain_core.example_selectors.semantic_similarity import (
)
__all__ = [
- "sorted_values",
- "SemanticSimilarityExampleSelector",
"MaxMarginalRelevanceExampleSelector",
+ "SemanticSimilarityExampleSelector",
+ "sorted_values",
]
diff --git a/libs/langchain/langchain/prompts/few_shot.py b/libs/langchain/langchain/prompts/few_shot.py
index 67b3106271d..d3f64d21407 100644
--- a/libs/langchain/langchain/prompts/few_shot.py
+++ b/libs/langchain/langchain/prompts/few_shot.py
@@ -5,7 +5,7 @@ from langchain_core.prompts.few_shot import (
)
__all__ = [
- "FewShotPromptTemplate",
"FewShotChatMessagePromptTemplate",
+ "FewShotPromptTemplate",
"_FewShotPromptTemplateMixin",
]
diff --git a/libs/langchain/langchain/prompts/loading.py b/libs/langchain/langchain/prompts/loading.py
index b1dfcd90691..ecc52f68925 100644
--- a/libs/langchain/langchain/prompts/loading.py
+++ b/libs/langchain/langchain/prompts/loading.py
@@ -11,13 +11,13 @@ from langchain_core.prompts.loading import (
from langchain_core.utils.loading import try_load_from_hub
__all__ = [
- "load_prompt_from_config",
- "load_prompt",
- "try_load_from_hub",
"_load_examples",
"_load_few_shot_prompt",
"_load_output_parser",
"_load_prompt",
"_load_prompt_from_file",
"_load_template",
+ "load_prompt",
+ "load_prompt_from_config",
+ "try_load_from_hub",
]
diff --git a/libs/langchain/langchain/prompts/prompt.py b/libs/langchain/langchain/prompts/prompt.py
index 5e35f878bac..e11c5a49bd3 100644
--- a/libs/langchain/langchain/prompts/prompt.py
+++ b/libs/langchain/langchain/prompts/prompt.py
@@ -3,4 +3,4 @@ from langchain_core.prompts.prompt import PromptTemplate
# For backwards compatibility.
Prompt = PromptTemplate
-__all__ = ["PromptTemplate", "Prompt"]
+__all__ = ["Prompt", "PromptTemplate"]
diff --git a/libs/langchain/langchain/retrievers/__init__.py b/libs/langchain/langchain/retrievers/__init__.py
index ba28b14cd7c..4e5540a21c6 100644
--- a/libs/langchain/langchain/retrievers/__init__.py
+++ b/libs/langchain/langchain/retrievers/__init__.py
@@ -148,8 +148,8 @@ __all__ = [
"GoogleDocumentAIWarehouseRetriever",
"GoogleVertexAIMultiTurnSearchRetriever",
"GoogleVertexAISearchRetriever",
- "KayAiRetriever",
"KNNRetriever",
+ "KayAiRetriever",
"LlamaIndexGraphRetriever",
"LlamaIndexRetriever",
"MergerRetriever",
@@ -157,22 +157,22 @@ __all__ = [
"MilvusRetriever",
"MultiQueryRetriever",
"MultiVectorRetriever",
+ "NeuralDBRetriever",
"OutlineRetriever",
"ParentDocumentRetriever",
"PineconeHybridSearchRetriever",
"PubMedRetriever",
- "RemoteLangChainRetriever",
"RePhraseQueryRetriever",
- "SelfQueryRetriever",
+ "RemoteLangChainRetriever",
"SVMRetriever",
- "TavilySearchAPIRetriever",
+ "SelfQueryRetriever",
"TFIDFRetriever",
+ "TavilySearchAPIRetriever",
"TimeWeightedVectorStoreRetriever",
"VespaRetriever",
"WeaviateHybridSearchRetriever",
"WebResearchRetriever",
"WikipediaRetriever",
"ZepRetriever",
- "NeuralDBRetriever",
"ZillizRetriever",
]
diff --git a/libs/langchain/langchain/retrievers/bedrock.py b/libs/langchain/langchain/retrievers/bedrock.py
index 25558d924b1..24237bff934 100644
--- a/libs/langchain/langchain/retrievers/bedrock.py
+++ b/libs/langchain/langchain/retrievers/bedrock.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "VectorSearchConfig",
- "RetrievalConfig",
"AmazonKnowledgeBasesRetriever",
+ "RetrievalConfig",
+ "VectorSearchConfig",
]
diff --git a/libs/langchain/langchain/retrievers/bm25.py b/libs/langchain/langchain/retrievers/bm25.py
index e5dc4195228..0539c8f86b5 100644
--- a/libs/langchain/langchain/retrievers/bm25.py
+++ b/libs/langchain/langchain/retrievers/bm25.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "default_preprocessing_func",
"BM25Retriever",
+ "default_preprocessing_func",
]
diff --git a/libs/langchain/langchain/retrievers/docarray.py b/libs/langchain/langchain/retrievers/docarray.py
index 7f433c58597..429f3fb81d2 100644
--- a/libs/langchain/langchain/retrievers/docarray.py
+++ b/libs/langchain/langchain/retrievers/docarray.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SearchType",
"DocArrayRetriever",
+ "SearchType",
]
diff --git a/libs/langchain/langchain/retrievers/document_compressors/__init__.py b/libs/langchain/langchain/retrievers/document_compressors/__init__.py
index c9590d7e671..2afd3a9260e 100644
--- a/libs/langchain/langchain/retrievers/document_compressors/__init__.py
+++ b/libs/langchain/langchain/retrievers/document_compressors/__init__.py
@@ -33,12 +33,12 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "CohereRerank",
+ "CrossEncoderReranker",
"DocumentCompressorPipeline",
"EmbeddingsFilter",
"FlashrankRerank",
- "LLMListwiseRerank",
"LLMChainExtractor",
"LLMChainFilter",
- "CohereRerank",
- "CrossEncoderReranker",
+ "LLMListwiseRerank",
]
diff --git a/libs/langchain/langchain/retrievers/google_vertex_ai_search.py b/libs/langchain/langchain/retrievers/google_vertex_ai_search.py
index 1f8a71de6ca..71b167f59a4 100644
--- a/libs/langchain/langchain/retrievers/google_vertex_ai_search.py
+++ b/libs/langchain/langchain/retrievers/google_vertex_ai_search.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "GoogleVertexAISearchRetriever",
- "GoogleVertexAIMultiTurnSearchRetriever",
"GoogleCloudEnterpriseSearchRetriever",
+ "GoogleVertexAIMultiTurnSearchRetriever",
+ "GoogleVertexAISearchRetriever",
]
diff --git a/libs/langchain/langchain/retrievers/kendra.py b/libs/langchain/langchain/retrievers/kendra.py
index 824c6569cf4..1d68af913dc 100644
--- a/libs/langchain/langchain/retrievers/kendra.py
+++ b/libs/langchain/langchain/retrievers/kendra.py
@@ -49,18 +49,18 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "AdditionalResultAttribute",
+ "AdditionalResultAttributeValue",
+ "AmazonKendraRetriever",
+ "DocumentAttribute",
+ "DocumentAttributeValue",
+ "Highlight",
+ "QueryResult",
+ "QueryResultItem",
+ "ResultItem",
+ "RetrieveResult",
+ "RetrieveResultItem",
+ "TextWithHighLights",
"clean_excerpt",
"combined_text",
- "Highlight",
- "TextWithHighLights",
- "AdditionalResultAttributeValue",
- "AdditionalResultAttribute",
- "DocumentAttributeValue",
- "DocumentAttribute",
- "ResultItem",
- "QueryResultItem",
- "RetrieveResultItem",
- "QueryResult",
- "RetrieveResult",
- "AmazonKendraRetriever",
]
diff --git a/libs/langchain/langchain/retrievers/llama_index.py b/libs/langchain/langchain/retrievers/llama_index.py
index a86b9e0d3df..2551e8ca943 100644
--- a/libs/langchain/langchain/retrievers/llama_index.py
+++ b/libs/langchain/langchain/retrievers/llama_index.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "LlamaIndexRetriever",
"LlamaIndexGraphRetriever",
+ "LlamaIndexRetriever",
]
diff --git a/libs/langchain/langchain/retrievers/milvus.py b/libs/langchain/langchain/retrievers/milvus.py
index bd9fd8536bb..e0db238c221 100644
--- a/libs/langchain/langchain/retrievers/milvus.py
+++ b/libs/langchain/langchain/retrievers/milvus.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "MilvusRetriever",
"MilvusRetreiver",
+ "MilvusRetriever",
]
diff --git a/libs/langchain/langchain/retrievers/zilliz.py b/libs/langchain/langchain/retrievers/zilliz.py
index 3b07c57c3b9..32c40f5b587 100644
--- a/libs/langchain/langchain/retrievers/zilliz.py
+++ b/libs/langchain/langchain/retrievers/zilliz.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ZillizRetriever",
"ZillizRetreiver",
+ "ZillizRetriever",
]
diff --git a/libs/langchain/langchain/schema/__init__.py b/libs/langchain/langchain/schema/__init__.py
index 7853f3ec525..6c8c4f61a0a 100644
--- a/libs/langchain/langchain/schema/__init__.py
+++ b/libs/langchain/langchain/schema/__init__.py
@@ -43,40 +43,40 @@ Memory = BaseMemory
_message_to_dict = message_to_dict
__all__ = [
- "BaseCache",
- "BaseMemory",
- "BaseStore",
- "AgentFinish",
+ "RUN_KEY",
+ "AIMessage",
"AgentAction",
- "Document",
+ "AgentFinish",
+ "BaseCache",
"BaseChatMessageHistory",
"BaseDocumentTransformer",
+ "BaseLLMOutputParser",
+ "BaseMemory",
"BaseMessage",
- "ChatMessage",
- "FunctionMessage",
- "HumanMessage",
- "AIMessage",
- "SystemMessage",
- "messages_from_dict",
- "messages_to_dict",
- "message_to_dict",
- "_message_to_dict",
- "_message_from_dict",
- "get_buffer_string",
- "RunInfo",
- "LLMResult",
- "ChatResult",
- "ChatGeneration",
- "Generation",
- "PromptValue",
- "LangChainException",
+ "BaseOutputParser",
+ "BasePromptTemplate",
"BaseRetriever",
- "RUN_KEY",
+ "BaseStore",
+ "ChatGeneration",
+ "ChatMessage",
+ "ChatResult",
+ "Document",
+ "FunctionMessage",
+ "Generation",
+ "HumanMessage",
+ "LLMResult",
+ "LangChainException",
"Memory",
"OutputParserException",
+ "PromptValue",
+ "RunInfo",
"StrOutputParser",
- "BaseOutputParser",
- "BaseLLMOutputParser",
- "BasePromptTemplate",
+ "SystemMessage",
+ "_message_from_dict",
+ "_message_to_dict",
"format_document",
+ "get_buffer_string",
+ "message_to_dict",
+ "messages_from_dict",
+ "messages_to_dict",
]
diff --git a/libs/langchain/langchain/schema/cache.py b/libs/langchain/langchain/schema/cache.py
index 8407af18c83..d74e1c4cae6 100644
--- a/libs/langchain/langchain/schema/cache.py
+++ b/libs/langchain/langchain/schema/cache.py
@@ -1,3 +1,3 @@
from langchain_core.caches import RETURN_VAL_TYPE, BaseCache
-__all__ = ["BaseCache", "RETURN_VAL_TYPE"]
+__all__ = ["RETURN_VAL_TYPE", "BaseCache"]
diff --git a/libs/langchain/langchain/schema/callbacks/base.py b/libs/langchain/langchain/schema/callbacks/base.py
index ab2053a075c..945344a2234 100644
--- a/libs/langchain/langchain/schema/callbacks/base.py
+++ b/libs/langchain/langchain/schema/callbacks/base.py
@@ -11,13 +11,13 @@ from langchain_core.callbacks.base import (
)
__all__ = [
- "RetrieverManagerMixin",
- "LLMManagerMixin",
- "ChainManagerMixin",
- "ToolManagerMixin",
- "CallbackManagerMixin",
- "RunManagerMixin",
- "BaseCallbackHandler",
"AsyncCallbackHandler",
+ "BaseCallbackHandler",
"BaseCallbackManager",
+ "CallbackManagerMixin",
+ "ChainManagerMixin",
+ "LLMManagerMixin",
+ "RetrieverManagerMixin",
+ "RunManagerMixin",
+ "ToolManagerMixin",
]
diff --git a/libs/langchain/langchain/schema/callbacks/manager.py b/libs/langchain/langchain/schema/callbacks/manager.py
index a459e1bb697..221abe68c77 100644
--- a/libs/langchain/langchain/schema/callbacks/manager.py
+++ b/libs/langchain/langchain/schema/callbacks/manager.py
@@ -28,28 +28,28 @@ from langchain_core.tracers.context import (
from langchain_core.utils.env import env_var_is_set
__all__ = [
- "tracing_enabled",
- "tracing_v2_enabled",
- "collect_runs",
- "trace_as_chain_group",
- "handle_event",
- "BaseRunManager",
- "RunManager",
- "ParentRunManager",
- "AsyncRunManager",
- "AsyncParentRunManager",
- "CallbackManagerForLLMRun",
- "AsyncCallbackManagerForLLMRun",
- "CallbackManagerForChainRun",
- "AsyncCallbackManagerForChainRun",
- "CallbackManagerForToolRun",
- "AsyncCallbackManagerForToolRun",
- "CallbackManagerForRetrieverRun",
- "AsyncCallbackManagerForRetrieverRun",
- "CallbackManager",
- "CallbackManagerForChainGroup",
"AsyncCallbackManager",
"AsyncCallbackManagerForChainGroup",
- "register_configure_hook",
+ "AsyncCallbackManagerForChainRun",
+ "AsyncCallbackManagerForLLMRun",
+ "AsyncCallbackManagerForRetrieverRun",
+ "AsyncCallbackManagerForToolRun",
+ "AsyncParentRunManager",
+ "AsyncRunManager",
+ "BaseRunManager",
+ "CallbackManager",
+ "CallbackManagerForChainGroup",
+ "CallbackManagerForChainRun",
+ "CallbackManagerForLLMRun",
+ "CallbackManagerForRetrieverRun",
+ "CallbackManagerForToolRun",
+ "ParentRunManager",
+ "RunManager",
+ "collect_runs",
"env_var_is_set",
+ "handle_event",
+ "register_configure_hook",
+ "trace_as_chain_group",
+ "tracing_enabled",
+ "tracing_v2_enabled",
]
diff --git a/libs/langchain/langchain/schema/callbacks/tracers/base.py b/libs/langchain/langchain/schema/callbacks/tracers/base.py
index 833f30d4df3..6288d12655c 100644
--- a/libs/langchain/langchain/schema/callbacks/tracers/base.py
+++ b/libs/langchain/langchain/schema/callbacks/tracers/base.py
@@ -1,4 +1,4 @@
from langchain_core.exceptions import TracerException
from langchain_core.tracers.base import BaseTracer
-__all__ = ["TracerException", "BaseTracer"]
+__all__ = ["BaseTracer", "TracerException"]
diff --git a/libs/langchain/langchain/schema/callbacks/tracers/evaluation.py b/libs/langchain/langchain/schema/callbacks/tracers/evaluation.py
index 363c74fcc85..4c7dd113fe2 100644
--- a/libs/langchain/langchain/schema/callbacks/tracers/evaluation.py
+++ b/libs/langchain/langchain/schema/callbacks/tracers/evaluation.py
@@ -3,4 +3,4 @@ from langchain_core.tracers.evaluation import (
wait_for_all_evaluators,
)
-__all__ = ["wait_for_all_evaluators", "EvaluatorCallbackHandler"]
+__all__ = ["EvaluatorCallbackHandler", "wait_for_all_evaluators"]
diff --git a/libs/langchain/langchain/schema/callbacks/tracers/langchain.py b/libs/langchain/langchain/schema/callbacks/tracers/langchain.py
index 8415dfab945..dc8b0f0d05c 100644
--- a/libs/langchain/langchain/schema/callbacks/tracers/langchain.py
+++ b/libs/langchain/langchain/schema/callbacks/tracers/langchain.py
@@ -5,4 +5,4 @@ from langchain_core.tracers.langchain import (
wait_for_all_tracers,
)
-__all__ = ["log_error_once", "wait_for_all_tracers", "get_client", "LangChainTracer"]
+__all__ = ["LangChainTracer", "get_client", "log_error_once", "wait_for_all_tracers"]
diff --git a/libs/langchain/langchain/schema/callbacks/tracers/langchain_v1.py b/libs/langchain/langchain/schema/callbacks/tracers/langchain_v1.py
index fca2d7590f1..c0668cd2efe 100644
--- a/libs/langchain/langchain/schema/callbacks/tracers/langchain_v1.py
+++ b/libs/langchain/langchain/schema/callbacks/tracers/langchain_v1.py
@@ -1,3 +1,3 @@
from langchain_core.tracers.langchain_v1 import LangChainTracerV1, get_headers
-__all__ = ["get_headers", "LangChainTracerV1"]
+__all__ = ["LangChainTracerV1", "get_headers"]
diff --git a/libs/langchain/langchain/schema/callbacks/tracers/log_stream.py b/libs/langchain/langchain/schema/callbacks/tracers/log_stream.py
index ef3dd946d66..54cc24935fc 100644
--- a/libs/langchain/langchain/schema/callbacks/tracers/log_stream.py
+++ b/libs/langchain/langchain/schema/callbacks/tracers/log_stream.py
@@ -6,4 +6,4 @@ from langchain_core.tracers.log_stream import (
RunState,
)
-__all__ = ["LogEntry", "RunState", "RunLogPatch", "RunLog", "LogStreamCallbackHandler"]
+__all__ = ["LogEntry", "LogStreamCallbackHandler", "RunLog", "RunLogPatch", "RunState"]
diff --git a/libs/langchain/langchain/schema/callbacks/tracers/schemas.py b/libs/langchain/langchain/schema/callbacks/tracers/schemas.py
index 6fb49dbf724..e8f34027d34 100644
--- a/libs/langchain/langchain/schema/callbacks/tracers/schemas.py
+++ b/libs/langchain/langchain/schema/callbacks/tracers/schemas.py
@@ -13,15 +13,15 @@ from langchain_core.tracers.schemas import (
)
__all__ = [
+ "BaseRun",
+ "ChainRun",
+ "LLMRun",
+ "Run",
"RunTypeEnum",
+ "ToolRun",
+ "TracerSession",
+ "TracerSessionBase",
+ "TracerSessionV1",
"TracerSessionV1Base",
"TracerSessionV1Create",
- "TracerSessionV1",
- "TracerSessionBase",
- "TracerSession",
- "BaseRun",
- "LLMRun",
- "ChainRun",
- "ToolRun",
- "Run",
]
diff --git a/libs/langchain/langchain/schema/callbacks/tracers/stdout.py b/libs/langchain/langchain/schema/callbacks/tracers/stdout.py
index b2ef6fdcfec..fdd6b80cd2f 100644
--- a/libs/langchain/langchain/schema/callbacks/tracers/stdout.py
+++ b/libs/langchain/langchain/schema/callbacks/tracers/stdout.py
@@ -6,8 +6,8 @@ from langchain_core.tracers.stdout import (
)
__all__ = [
- "try_json_stringify",
- "elapsed",
- "FunctionCallbackHandler",
"ConsoleCallbackHandler",
+ "FunctionCallbackHandler",
+ "elapsed",
+ "try_json_stringify",
]
diff --git a/libs/langchain/langchain/schema/document.py b/libs/langchain/langchain/schema/document.py
index 8b5b254be95..266f6afbae9 100644
--- a/libs/langchain/langchain/schema/document.py
+++ b/libs/langchain/langchain/schema/document.py
@@ -1,3 +1,3 @@
from langchain_core.documents import BaseDocumentTransformer, Document
-__all__ = ["Document", "BaseDocumentTransformer"]
+__all__ = ["BaseDocumentTransformer", "Document"]
diff --git a/libs/langchain/langchain/schema/language_model.py b/libs/langchain/langchain/schema/language_model.py
index 63a0292bed8..99e5921dd83 100644
--- a/libs/langchain/langchain/schema/language_model.py
+++ b/libs/langchain/langchain/schema/language_model.py
@@ -7,9 +7,9 @@ from langchain_core.language_models import (
from langchain_core.language_models.base import _get_token_ids_default_method
__all__ = [
- "get_tokenizer",
"BaseLanguageModel",
- "_get_token_ids_default_method",
"LanguageModelInput",
"LanguageModelOutput",
+ "_get_token_ids_default_method",
+ "get_tokenizer",
]
diff --git a/libs/langchain/langchain/schema/messages.py b/libs/langchain/langchain/schema/messages.py
index 2c42e6091e5..0cae2fa4a85 100644
--- a/libs/langchain/langchain/schema/messages.py
+++ b/libs/langchain/langchain/schema/messages.py
@@ -26,26 +26,26 @@ from langchain_core.messages import (
_message_to_dict = message_to_dict
__all__ = [
- "get_buffer_string",
- "BaseMessage",
- "merge_content",
- "BaseMessageChunk",
- "HumanMessage",
- "HumanMessageChunk",
"AIMessage",
"AIMessageChunk",
- "SystemMessage",
- "SystemMessageChunk",
- "FunctionMessage",
- "FunctionMessageChunk",
- "ToolMessage",
- "ToolMessageChunk",
+ "AnyMessage",
+ "BaseMessage",
+ "BaseMessageChunk",
"ChatMessage",
"ChatMessageChunk",
- "messages_to_dict",
- "messages_from_dict",
- "_message_to_dict",
+ "FunctionMessage",
+ "FunctionMessageChunk",
+ "HumanMessage",
+ "HumanMessageChunk",
+ "SystemMessage",
+ "SystemMessageChunk",
+ "ToolMessage",
+ "ToolMessageChunk",
"_message_from_dict",
+ "_message_to_dict",
+ "get_buffer_string",
+ "merge_content",
"message_to_dict",
- "AnyMessage",
+ "messages_from_dict",
+ "messages_to_dict",
]
diff --git a/libs/langchain/langchain/schema/output.py b/libs/langchain/langchain/schema/output.py
index 970986df560..bb08d5751e8 100644
--- a/libs/langchain/langchain/schema/output.py
+++ b/libs/langchain/langchain/schema/output.py
@@ -9,11 +9,11 @@ from langchain_core.outputs import (
)
__all__ = [
- "Generation",
- "GenerationChunk",
"ChatGeneration",
"ChatGenerationChunk",
- "RunInfo",
"ChatResult",
+ "Generation",
+ "GenerationChunk",
"LLMResult",
+ "RunInfo",
]
diff --git a/libs/langchain/langchain/schema/output_parser.py b/libs/langchain/langchain/schema/output_parser.py
index b0d8e03a7b9..0b2652cafdd 100644
--- a/libs/langchain/langchain/schema/output_parser.py
+++ b/libs/langchain/langchain/schema/output_parser.py
@@ -13,13 +13,13 @@ from langchain_core.output_parsers.base import T
NoOpOutputParser = StrOutputParser
__all__ = [
- "BaseLLMOutputParser",
+ "BaseCumulativeTransformOutputParser",
"BaseGenerationOutputParser",
+ "BaseLLMOutputParser",
"BaseOutputParser",
"BaseTransformOutputParser",
- "BaseCumulativeTransformOutputParser",
"NoOpOutputParser",
- "StrOutputParser",
"OutputParserException",
+ "StrOutputParser",
"T",
]
diff --git a/libs/langchain/langchain/schema/runnable/__init__.py b/libs/langchain/langchain/schema/runnable/__init__.py
index c76c6ffb93b..995bf67121e 100644
--- a/libs/langchain/langchain/schema/runnable/__init__.py
+++ b/libs/langchain/langchain/schema/runnable/__init__.py
@@ -38,13 +38,11 @@ from langchain_core.runnables.utils import (
__all__ = [
"ConfigurableField",
- "ConfigurableFieldSingleOption",
"ConfigurableFieldMultiOption",
- "patch_config",
+ "ConfigurableFieldSingleOption",
"RouterInput",
"RouterRunnable",
"Runnable",
- "RunnableSerializable",
"RunnableBinding",
"RunnableBranch",
"RunnableConfig",
@@ -54,5 +52,7 @@ __all__ = [
"RunnableParallel",
"RunnablePassthrough",
"RunnableSequence",
+ "RunnableSerializable",
"RunnableWithFallbacks",
+ "patch_config",
]
diff --git a/libs/langchain/langchain/schema/runnable/base.py b/libs/langchain/langchain/schema/runnable/base.py
index c9bde22100f..c55cc4130d6 100644
--- a/libs/langchain/langchain/schema/runnable/base.py
+++ b/libs/langchain/langchain/schema/runnable/base.py
@@ -20,19 +20,19 @@ RunnableMap = RunnableParallel
__all__ = [
"Input",
- "Output",
- "RunnableLike",
"Other",
+ "Output",
"Runnable",
- "RunnableSerializable",
- "RunnableSequence",
- "RunnableParallel",
+ "RunnableBinding",
+ "RunnableBindingBase",
+ "RunnableEach",
+ "RunnableEachBase",
"RunnableGenerator",
"RunnableLambda",
- "RunnableEachBase",
- "RunnableEach",
- "RunnableBindingBase",
- "RunnableBinding",
+ "RunnableLike",
"RunnableMap",
+ "RunnableParallel",
+ "RunnableSequence",
+ "RunnableSerializable",
"coerce_to_runnable",
]
diff --git a/libs/langchain/langchain/schema/runnable/config.py b/libs/langchain/langchain/schema/runnable/config.py
index af0179f9755..88caa14b012 100644
--- a/libs/langchain/langchain/schema/runnable/config.py
+++ b/libs/langchain/langchain/schema/runnable/config.py
@@ -15,13 +15,13 @@ from langchain_core.runnables.config import (
__all__ = [
"EmptyDict",
"RunnableConfig",
- "ensure_config",
- "get_config_list",
- "patch_config",
- "merge_configs",
"acall_func_with_variable_args",
"call_func_with_variable_args",
- "get_callback_manager_for_config",
+ "ensure_config",
"get_async_callback_manager_for_config",
+ "get_callback_manager_for_config",
+ "get_config_list",
"get_executor_for_config",
+ "merge_configs",
+ "patch_config",
]
diff --git a/libs/langchain/langchain/schema/runnable/configurable.py b/libs/langchain/langchain/schema/runnable/configurable.py
index a1463d57466..4e0ac78e56c 100644
--- a/libs/langchain/langchain/schema/runnable/configurable.py
+++ b/libs/langchain/langchain/schema/runnable/configurable.py
@@ -8,8 +8,8 @@ from langchain_core.runnables.configurable import (
__all__ = [
"DynamicRunnable",
+ "RunnableConfigurableAlternatives",
"RunnableConfigurableFields",
"StrEnum",
- "RunnableConfigurableAlternatives",
"make_options_spec",
]
diff --git a/libs/langchain/langchain/schema/runnable/history.py b/libs/langchain/langchain/schema/runnable/history.py
index 423b192be68..54fde648628 100644
--- a/libs/langchain/langchain/schema/runnable/history.py
+++ b/libs/langchain/langchain/schema/runnable/history.py
@@ -5,7 +5,7 @@ from langchain_core.runnables.history import (
)
__all__ = [
- "RunnableWithMessageHistory",
"GetSessionHistoryCallable",
"MessagesOrDictWithMessages",
+ "RunnableWithMessageHistory",
]
diff --git a/libs/langchain/langchain/schema/runnable/passthrough.py b/libs/langchain/langchain/schema/runnable/passthrough.py
index aed683d3843..b9a4d84b3e1 100644
--- a/libs/langchain/langchain/schema/runnable/passthrough.py
+++ b/libs/langchain/langchain/schema/runnable/passthrough.py
@@ -5,4 +5,4 @@ from langchain_core.runnables.passthrough import (
identity,
)
-__all__ = ["aidentity", "identity", "RunnablePassthrough", "RunnableAssign"]
+__all__ = ["RunnableAssign", "RunnablePassthrough", "aidentity", "identity"]
diff --git a/libs/langchain/langchain/schema/runnable/utils.py b/libs/langchain/langchain/schema/runnable/utils.py
index 1a03a6afbc3..7e9ce44567c 100644
--- a/libs/langchain/langchain/schema/runnable/utils.py
+++ b/libs/langchain/langchain/schema/runnable/utils.py
@@ -25,27 +25,27 @@ from langchain_core.runnables.utils import (
)
__all__ = [
- "accepts_run_manager",
- "accepts_config",
- "IsLocalDict",
- "IsFunctionArgDict",
- "GetLambdaSource",
- "get_function_first_arg_dict_keys",
- "get_lambda_source",
- "indent_lines_after_first",
+ "Addable",
"AddableDict",
- "SupportsAdd",
- "add",
+ "AnyConfigurableField",
"ConfigurableField",
- "ConfigurableFieldSingleOption",
"ConfigurableFieldMultiOption",
+ "ConfigurableFieldSingleOption",
"ConfigurableFieldSpec",
- "get_unique_config_specs",
+ "GetLambdaSource",
+ "Input",
+ "IsFunctionArgDict",
+ "IsLocalDict",
+ "Output",
+ "SupportsAdd",
"aadd",
+ "accepts_config",
+ "accepts_run_manager",
+ "add",
"gated_coro",
"gather_with_concurrency",
- "Input",
- "Output",
- "Addable",
- "AnyConfigurableField",
+ "get_function_first_arg_dict_keys",
+ "get_lambda_source",
+ "get_unique_config_specs",
+ "indent_lines_after_first",
]
diff --git a/libs/langchain/langchain/schema/vectorstore.py b/libs/langchain/langchain/schema/vectorstore.py
index 776dbce00dc..4accfef0b84 100644
--- a/libs/langchain/langchain/schema/vectorstore.py
+++ b/libs/langchain/langchain/schema/vectorstore.py
@@ -1,3 +1,3 @@
from langchain_core.vectorstores import VST, VectorStore, VectorStoreRetriever
-__all__ = ["VectorStore", "VectorStoreRetriever", "VST"]
+__all__ = ["VST", "VectorStore", "VectorStoreRetriever"]
diff --git a/libs/langchain/langchain/smith/__init__.py b/libs/langchain/langchain/smith/__init__.py
index 2c6c1af61c2..ffdf2dd4d19 100644
--- a/libs/langchain/langchain/smith/__init__.py
+++ b/libs/langchain/langchain/smith/__init__.py
@@ -96,7 +96,7 @@ from langchain.smith.evaluation import (
)
__all__ = [
+ "RunEvalConfig",
"arun_on_dataset",
"run_on_dataset",
- "RunEvalConfig",
]
diff --git a/libs/langchain/langchain/smith/evaluation/__init__.py b/libs/langchain/langchain/smith/evaluation/__init__.py
index 125dfdcfcec..56e4a117081 100644
--- a/libs/langchain/langchain/smith/evaluation/__init__.py
+++ b/libs/langchain/langchain/smith/evaluation/__init__.py
@@ -61,8 +61,8 @@ from langchain.smith.evaluation.string_run_evaluator import StringRunEvaluatorCh
__all__ = [
"InputFormatError",
+ "RunEvalConfig",
+ "StringRunEvaluatorChain",
"arun_on_dataset",
"run_on_dataset",
- "StringRunEvaluatorChain",
- "RunEvalConfig",
]
diff --git a/libs/langchain/langchain/smith/evaluation/runner_utils.py b/libs/langchain/langchain/smith/evaluation/runner_utils.py
index d65d9e6a511..45546f864cf 100644
--- a/libs/langchain/langchain/smith/evaluation/runner_utils.py
+++ b/libs/langchain/langchain/smith/evaluation/runner_utils.py
@@ -512,7 +512,7 @@ def _determine_reference_key(
)
raise ValueError(msg)
elif example_outputs and len(example_outputs) == 1:
- reference_key = list(example_outputs)[0]
+ reference_key = next(iter(example_outputs))
else:
reference_key = None
return reference_key
@@ -693,9 +693,8 @@ async def _arun_llm(
"""
if input_mapper is not None:
prompt_or_messages = input_mapper(inputs)
- if (
- isinstance(prompt_or_messages, str)
- or isinstance(prompt_or_messages, list)
+ if isinstance(prompt_or_messages, str) or (
+ isinstance(prompt_or_messages, list)
and all(isinstance(msg, BaseMessage) for msg in prompt_or_messages)
):
return await llm.ainvoke(
@@ -810,7 +809,7 @@ async def _arun_llm_or_chain(
logger.warning(
f"{chain_or_llm} failed for example {example.id} "
f"with inputs {example.inputs}"
- f"\n{repr(e)}"
+ f"\n{e!r}"
)
result = EvalError(Error=e)
return result
@@ -846,9 +845,8 @@ def _run_llm(
# Most of this is legacy code; we could probably remove a lot of it.
if input_mapper is not None:
prompt_or_messages = input_mapper(inputs)
- if (
- isinstance(prompt_or_messages, str)
- or isinstance(prompt_or_messages, list)
+ if isinstance(prompt_or_messages, str) or (
+ isinstance(prompt_or_messages, list)
and all(isinstance(msg, BaseMessage) for msg in prompt_or_messages)
):
llm_output: Union[str, BaseMessage] = llm.invoke(
@@ -1094,9 +1092,7 @@ class _DatasetRunContainer:
project_id=self.project.id,
)
except Exception as e:
- logger.error(
- f"Error running batch evaluator {repr(evaluator)}: {e}"
- )
+ logger.error(f"Error running batch evaluator {evaluator!r}: {e}")
return aggregate_feedback
def _collect_metrics(self) -> tuple[dict[str, _RowResult], dict[str, Run]]:
@@ -1157,14 +1153,14 @@ class _DatasetRunContainer:
agg_feedback = results.get_aggregate_feedback()
_display_aggregate_results(agg_feedback)
except Exception as e:
- logger.debug(f"Failed to print aggregate feedback: {repr(e)}")
+ logger.debug(f"Failed to print aggregate feedback: {e!r}")
try:
# Closing the project permits name changing and metric optimizations
self.client.update_project(
self.project.id, end_time=datetime.now(timezone.utc)
)
except Exception as e:
- logger.debug(f"Failed to close project: {repr(e)}")
+ logger.debug(f"Failed to close project: {e!r}")
return results
@classmethod
diff --git a/libs/langchain/langchain/smith/evaluation/string_run_evaluator.py b/libs/langchain/langchain/smith/evaluation/string_run_evaluator.py
index d08d029165e..0c07887b97e 100644
--- a/libs/langchain/langchain/smith/evaluation/string_run_evaluator.py
+++ b/libs/langchain/langchain/smith/evaluation/string_run_evaluator.py
@@ -219,7 +219,7 @@ class StringExampleMapper(Serializable):
" specify a reference_key."
)
raise ValueError(msg)
- output = list(example.outputs.values())[0]
+ output = next(iter(example.outputs.values()))
elif self.reference_key not in example.outputs:
msg = (
f"Example {example.id} does not have reference key"
diff --git a/libs/langchain/langchain/storage/__init__.py b/libs/langchain/langchain/storage/__init__.py
index 1ccdfab2d0f..095638630b0 100644
--- a/libs/langchain/langchain/storage/__init__.py
+++ b/libs/langchain/langchain/storage/__init__.py
@@ -44,8 +44,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "create_kv_docstore",
- "create_lc_store",
"EncoderBackedStore",
"InMemoryByteStore",
"InMemoryStore",
@@ -54,4 +52,6 @@ __all__ = [
"RedisStore",
"UpstashRedisByteStore",
"UpstashRedisStore",
+ "create_kv_docstore",
+ "create_lc_store",
]
diff --git a/libs/langchain/langchain/storage/in_memory.py b/libs/langchain/langchain/storage/in_memory.py
index 24c4df6f425..296bc19a02d 100644
--- a/libs/langchain/langchain/storage/in_memory.py
+++ b/libs/langchain/langchain/storage/in_memory.py
@@ -7,7 +7,7 @@ primarily for unit testing purposes.
from langchain_core.stores import InMemoryBaseStore, InMemoryByteStore, InMemoryStore
__all__ = [
- "InMemoryStore",
"InMemoryBaseStore",
"InMemoryByteStore",
+ "InMemoryStore",
]
diff --git a/libs/langchain/langchain/storage/upstash_redis.py b/libs/langchain/langchain/storage/upstash_redis.py
index 59f3b10699d..35aba2ed098 100644
--- a/libs/langchain/langchain/storage/upstash_redis.py
+++ b/libs/langchain/langchain/storage/upstash_redis.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "UpstashRedisStore",
"UpstashRedisByteStore",
+ "UpstashRedisStore",
]
diff --git a/libs/langchain/langchain/text_splitter.py b/libs/langchain/langchain/text_splitter.py
index 9303f0c6ede..039140b08d1 100644
--- a/libs/langchain/langchain/text_splitter.py
+++ b/libs/langchain/langchain/text_splitter.py
@@ -27,24 +27,24 @@ from langchain_text_splitters.sentence_transformers import (
from langchain_text_splitters.spacy import SpacyTextSplitter
__all__ = [
- "TokenTextSplitter",
- "TextSplitter",
- "Tokenizer",
- "Language",
- "RecursiveCharacterTextSplitter",
- "RecursiveJsonSplitter",
- "LatexTextSplitter",
- "PythonCodeTextSplitter",
- "KonlpyTextSplitter",
- "SpacyTextSplitter",
- "NLTKTextSplitter",
- "split_text_on_tokens",
- "SentenceTransformersTokenTextSplitter",
+ "CharacterTextSplitter",
"ElementType",
- "HeaderType",
- "LineType",
"HTMLHeaderTextSplitter",
+ "HeaderType",
+ "KonlpyTextSplitter",
+ "Language",
+ "LatexTextSplitter",
+ "LineType",
"MarkdownHeaderTextSplitter",
"MarkdownTextSplitter",
- "CharacterTextSplitter",
+ "NLTKTextSplitter",
+ "PythonCodeTextSplitter",
+ "RecursiveCharacterTextSplitter",
+ "RecursiveJsonSplitter",
+ "SentenceTransformersTokenTextSplitter",
+ "SpacyTextSplitter",
+ "TextSplitter",
+ "TokenTextSplitter",
+ "Tokenizer",
+ "split_text_on_tokens",
]
diff --git a/libs/langchain/langchain/tools/__init__.py b/libs/langchain/langchain/tools/__init__.py
index 55ea272212c..1451ab170a6 100644
--- a/libs/langchain/langchain/tools/__init__.py
+++ b/libs/langchain/langchain/tools/__init__.py
@@ -85,10 +85,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "StructuredTool",
- "BaseTool",
- "tool",
- "Tool",
"AINAppOps",
"AINOwnerOps",
"AINRuleOps",
@@ -106,6 +102,7 @@ __all__ = [
"BaseRequestsTool",
"BaseSQLDatabaseTool",
"BaseSparkSQLTool",
+ "BaseTool",
"BearlyInterpreterTool",
"BingSearchResults",
"BingSearchRun",
@@ -141,8 +138,6 @@ __all__ = [
"GoogleSearchRun",
"GoogleSerperResults",
"GoogleSerperRun",
- "SearchAPIResults",
- "SearchAPIRun",
"HumanInputRun",
"IFTTTWebhook",
"InfoPowerBITool",
@@ -169,20 +164,21 @@ __all__ = [
"OpenAPISpec",
"OpenWeatherMapQueryRun",
"PubmedQueryRun",
- "RedditSearchRun",
"QueryCheckerTool",
"QueryPowerBITool",
"QuerySQLCheckerTool",
"QuerySQLDataBaseTool",
"QuerySparkSQLTool",
"ReadFileTool",
+ "RedditSearchRun",
"RequestsDeleteTool",
"RequestsGetTool",
"RequestsPatchTool",
"RequestsPostTool",
"RequestsPutTool",
- "SteamWebAPIQueryRun",
"SceneXplainTool",
+ "SearchAPIResults",
+ "SearchAPIRun",
"SearxSearchResults",
"SearxSearchRun",
"ShellTool",
@@ -191,9 +187,12 @@ __all__ = [
"SlackScheduleMessage",
"SlackSendMessage",
"SleepTool",
- "StdInInquireTool",
"StackExchangeTool",
+ "StdInInquireTool",
+ "SteamWebAPIQueryRun",
"SteamshipImageGenerationTool",
+ "StructuredTool",
+ "Tool",
"VectorStoreQATool",
"VectorStoreQAWithSourcesTool",
"WikipediaQueryRun",
@@ -204,4 +203,5 @@ __all__ = [
"ZapierNLAListActions",
"ZapierNLARunAction",
"format_tool_to_openai_function",
+ "tool",
]
diff --git a/libs/langchain/langchain/tools/ainetwork/app.py b/libs/langchain/langchain/tools/ainetwork/app.py
index a28e83008da..ce01f9dbd56 100644
--- a/libs/langchain/langchain/tools/ainetwork/app.py
+++ b/libs/langchain/langchain/tools/ainetwork/app.py
@@ -24,7 +24,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "AINAppOps",
"AppOperationType",
"AppSchema",
- "AINAppOps",
]
diff --git a/libs/langchain/langchain/tools/ainetwork/base.py b/libs/langchain/langchain/tools/ainetwork/base.py
index 608c882fa90..20e14d6b398 100644
--- a/libs/langchain/langchain/tools/ainetwork/base.py
+++ b/libs/langchain/langchain/tools/ainetwork/base.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "OperationType",
"AINBaseTool",
+ "OperationType",
]
diff --git a/libs/langchain/langchain/tools/ainetwork/owner.py b/libs/langchain/langchain/tools/ainetwork/owner.py
index 1cf8259d72b..381a80b3701 100644
--- a/libs/langchain/langchain/tools/ainetwork/owner.py
+++ b/libs/langchain/langchain/tools/ainetwork/owner.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "RuleSchema",
"AINOwnerOps",
+ "RuleSchema",
]
diff --git a/libs/langchain/langchain/tools/ainetwork/rule.py b/libs/langchain/langchain/tools/ainetwork/rule.py
index 564960485ae..1404ef0beae 100644
--- a/libs/langchain/langchain/tools/ainetwork/rule.py
+++ b/libs/langchain/langchain/tools/ainetwork/rule.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "RuleSchema",
"AINRuleOps",
+ "RuleSchema",
]
diff --git a/libs/langchain/langchain/tools/ainetwork/transfer.py b/libs/langchain/langchain/tools/ainetwork/transfer.py
index 2aa04dd9fd3..25c60629a49 100644
--- a/libs/langchain/langchain/tools/ainetwork/transfer.py
+++ b/libs/langchain/langchain/tools/ainetwork/transfer.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "TransferSchema",
"AINTransfer",
+ "TransferSchema",
]
diff --git a/libs/langchain/langchain/tools/ainetwork/value.py b/libs/langchain/langchain/tools/ainetwork/value.py
index f2a5876f543..ab8d5ab9969 100644
--- a/libs/langchain/langchain/tools/ainetwork/value.py
+++ b/libs/langchain/langchain/tools/ainetwork/value.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ValueSchema",
"AINValueOps",
+ "ValueSchema",
]
diff --git a/libs/langchain/langchain/tools/amadeus/closest_airport.py b/libs/langchain/langchain/tools/amadeus/closest_airport.py
index e51baaa39ab..71c38dc91c4 100644
--- a/libs/langchain/langchain/tools/amadeus/closest_airport.py
+++ b/libs/langchain/langchain/tools/amadeus/closest_airport.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ClosestAirportSchema",
"AmadeusClosestAirport",
+ "ClosestAirportSchema",
]
diff --git a/libs/langchain/langchain/tools/amadeus/flight_search.py b/libs/langchain/langchain/tools/amadeus/flight_search.py
index b83247b206b..34ce3fe29a6 100644
--- a/libs/langchain/langchain/tools/amadeus/flight_search.py
+++ b/libs/langchain/langchain/tools/amadeus/flight_search.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "FlightSearchSchema",
"AmadeusFlightSearch",
+ "FlightSearchSchema",
]
diff --git a/libs/langchain/langchain/tools/azure_cognitive_services/__init__.py b/libs/langchain/langchain/tools/azure_cognitive_services/__init__.py
index 7922cd4fb86..572a55dc574 100644
--- a/libs/langchain/langchain/tools/azure_cognitive_services/__init__.py
+++ b/libs/langchain/langchain/tools/azure_cognitive_services/__init__.py
@@ -33,8 +33,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "AzureCogsImageAnalysisTool",
"AzureCogsFormRecognizerTool",
+ "AzureCogsImageAnalysisTool",
"AzureCogsSpeech2TextTool",
"AzureCogsText2SpeechTool",
"AzureCogsTextAnalyticsHealthTool",
diff --git a/libs/langchain/langchain/tools/base.py b/libs/langchain/langchain/tools/base.py
index ff81eaa8956..ecacb95349e 100644
--- a/libs/langchain/langchain/tools/base.py
+++ b/libs/langchain/langchain/tools/base.py
@@ -9,11 +9,11 @@ from langchain_core.tools import (
)
__all__ = [
- "SchemaAnnotationError",
- "create_schema_from_function",
- "ToolException",
"BaseTool",
- "Tool",
+ "SchemaAnnotationError",
"StructuredTool",
+ "Tool",
+ "ToolException",
+ "create_schema_from_function",
"tool",
]
diff --git a/libs/langchain/langchain/tools/bearly/tool.py b/libs/langchain/langchain/tools/bearly/tool.py
index 64af4a9c4c8..c57e5bc1b40 100644
--- a/libs/langchain/langchain/tools/bearly/tool.py
+++ b/libs/langchain/langchain/tools/bearly/tool.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "BearlyInterpreterTool",
"BearlyInterpreterToolArguments",
"FileInfo",
- "BearlyInterpreterTool",
]
diff --git a/libs/langchain/langchain/tools/bing_search/__init__.py b/libs/langchain/langchain/tools/bing_search/__init__.py
index 517695ad634..1f8906ca5e5 100644
--- a/libs/langchain/langchain/tools/bing_search/__init__.py
+++ b/libs/langchain/langchain/tools/bing_search/__init__.py
@@ -24,6 +24,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "BingSearchRun",
"BingSearchResults",
+ "BingSearchRun",
]
diff --git a/libs/langchain/langchain/tools/bing_search/tool.py b/libs/langchain/langchain/tools/bing_search/tool.py
index 20f887149b0..894747fceaa 100644
--- a/libs/langchain/langchain/tools/bing_search/tool.py
+++ b/libs/langchain/langchain/tools/bing_search/tool.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "BingSearchRun",
"BingSearchResults",
+ "BingSearchRun",
]
diff --git a/libs/langchain/langchain/tools/dataforseo_api_search/__init__.py b/libs/langchain/langchain/tools/dataforseo_api_search/__init__.py
index 2fdf6e4f863..04ace1e69b8 100644
--- a/libs/langchain/langchain/tools/dataforseo_api_search/__init__.py
+++ b/libs/langchain/langchain/tools/dataforseo_api_search/__init__.py
@@ -29,6 +29,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "DataForSeoAPISearchRun",
"DataForSeoAPISearchResults",
+ "DataForSeoAPISearchRun",
]
diff --git a/libs/langchain/langchain/tools/dataforseo_api_search/tool.py b/libs/langchain/langchain/tools/dataforseo_api_search/tool.py
index 8d1b02852be..f7041977246 100644
--- a/libs/langchain/langchain/tools/dataforseo_api_search/tool.py
+++ b/libs/langchain/langchain/tools/dataforseo_api_search/tool.py
@@ -27,6 +27,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "DataForSeoAPISearchRun",
"DataForSeoAPISearchResults",
+ "DataForSeoAPISearchRun",
]
diff --git a/libs/langchain/langchain/tools/ddg_search/tool.py b/libs/langchain/langchain/tools/ddg_search/tool.py
index e386ac3551f..79de66770e8 100644
--- a/libs/langchain/langchain/tools/ddg_search/tool.py
+++ b/libs/langchain/langchain/tools/ddg_search/tool.py
@@ -26,7 +26,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
"DDGInput",
- "DuckDuckGoSearchRun",
"DuckDuckGoSearchResults",
+ "DuckDuckGoSearchRun",
"DuckDuckGoSearchTool",
]
diff --git a/libs/langchain/langchain/tools/e2b_data_analysis/tool.py b/libs/langchain/langchain/tools/e2b_data_analysis/tool.py
index 479c5eae283..d79dd9fb20f 100644
--- a/libs/langchain/langchain/tools/e2b_data_analysis/tool.py
+++ b/libs/langchain/langchain/tools/e2b_data_analysis/tool.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "UploadedFile",
- "E2BDataAnalysisToolArguments",
"E2BDataAnalysisTool",
+ "E2BDataAnalysisToolArguments",
+ "UploadedFile",
]
diff --git a/libs/langchain/langchain/tools/edenai/__init__.py b/libs/langchain/langchain/tools/edenai/__init__.py
index 3c33655d61c..5b20a3e819d 100644
--- a/libs/langchain/langchain/tools/edenai/__init__.py
+++ b/libs/langchain/langchain/tools/edenai/__init__.py
@@ -43,8 +43,8 @@ __all__ = [
"EdenAiObjectDetectionTool",
"EdenAiParsingIDTool",
"EdenAiParsingInvoiceTool",
- "EdenAiTextToSpeechTool",
"EdenAiSpeechToTextTool",
"EdenAiTextModerationTool",
+ "EdenAiTextToSpeechTool",
"EdenaiTool",
]
diff --git a/libs/langchain/langchain/tools/file_management/__init__.py b/libs/langchain/langchain/tools/file_management/__init__.py
index bb0c3bec162..e317d44b200 100644
--- a/libs/langchain/langchain/tools/file_management/__init__.py
+++ b/libs/langchain/langchain/tools/file_management/__init__.py
@@ -40,8 +40,8 @@ __all__ = [
"CopyFileTool",
"DeleteFileTool",
"FileSearchTool",
+ "ListDirectoryTool",
"MoveFileTool",
"ReadFileTool",
"WriteFileTool",
- "ListDirectoryTool",
]
diff --git a/libs/langchain/langchain/tools/file_management/copy.py b/libs/langchain/langchain/tools/file_management/copy.py
index 308d882eab0..38bc848c8a6 100644
--- a/libs/langchain/langchain/tools/file_management/copy.py
+++ b/libs/langchain/langchain/tools/file_management/copy.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "FileCopyInput",
"CopyFileTool",
+ "FileCopyInput",
]
diff --git a/libs/langchain/langchain/tools/file_management/delete.py b/libs/langchain/langchain/tools/file_management/delete.py
index 01943a7b254..616516f6021 100644
--- a/libs/langchain/langchain/tools/file_management/delete.py
+++ b/libs/langchain/langchain/tools/file_management/delete.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "FileDeleteInput",
"DeleteFileTool",
+ "FileDeleteInput",
]
diff --git a/libs/langchain/langchain/tools/gmail/__init__.py b/libs/langchain/langchain/tools/gmail/__init__.py
index 59e81e9f694..24daa53f8f7 100644
--- a/libs/langchain/langchain/tools/gmail/__init__.py
+++ b/libs/langchain/langchain/tools/gmail/__init__.py
@@ -34,8 +34,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
"GmailCreateDraft",
- "GmailSendMessage",
- "GmailSearch",
"GmailGetMessage",
"GmailGetThread",
+ "GmailSearch",
+ "GmailSendMessage",
]
diff --git a/libs/langchain/langchain/tools/gmail/get_message.py b/libs/langchain/langchain/tools/gmail/get_message.py
index fea9ab4f02f..4720068f384 100644
--- a/libs/langchain/langchain/tools/gmail/get_message.py
+++ b/libs/langchain/langchain/tools/gmail/get_message.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SearchArgsSchema",
"GmailGetMessage",
+ "SearchArgsSchema",
]
diff --git a/libs/langchain/langchain/tools/gmail/search.py b/libs/langchain/langchain/tools/gmail/search.py
index 07278cffae6..9f04a7da379 100644
--- a/libs/langchain/langchain/tools/gmail/search.py
+++ b/libs/langchain/langchain/tools/gmail/search.py
@@ -24,7 +24,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "GmailSearch",
"Resource",
"SearchArgsSchema",
- "GmailSearch",
]
diff --git a/libs/langchain/langchain/tools/gmail/send_message.py b/libs/langchain/langchain/tools/gmail/send_message.py
index 94b8fdd39b6..c9f864160e3 100644
--- a/libs/langchain/langchain/tools/gmail/send_message.py
+++ b/libs/langchain/langchain/tools/gmail/send_message.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SendMessageSchema",
"GmailSendMessage",
+ "SendMessageSchema",
]
diff --git a/libs/langchain/langchain/tools/google_search/__init__.py b/libs/langchain/langchain/tools/google_search/__init__.py
index 0d1da9422bd..e5e88512eaa 100644
--- a/libs/langchain/langchain/tools/google_search/__init__.py
+++ b/libs/langchain/langchain/tools/google_search/__init__.py
@@ -24,6 +24,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "GoogleSearchRun",
"GoogleSearchResults",
+ "GoogleSearchRun",
]
diff --git a/libs/langchain/langchain/tools/google_search/tool.py b/libs/langchain/langchain/tools/google_search/tool.py
index 8484216e0e5..bc73774b346 100644
--- a/libs/langchain/langchain/tools/google_search/tool.py
+++ b/libs/langchain/langchain/tools/google_search/tool.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "GoogleSearchRun",
"GoogleSearchResults",
+ "GoogleSearchRun",
]
diff --git a/libs/langchain/langchain/tools/google_serper/__init__.py b/libs/langchain/langchain/tools/google_serper/__init__.py
index 9fe3a567b29..ad20b9bab41 100644
--- a/libs/langchain/langchain/tools/google_serper/__init__.py
+++ b/libs/langchain/langchain/tools/google_serper/__init__.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "GoogleSerperRun",
"GoogleSerperResults",
+ "GoogleSerperRun",
]
diff --git a/libs/langchain/langchain/tools/google_serper/tool.py b/libs/langchain/langchain/tools/google_serper/tool.py
index 9ccbf937d3d..8ef0c3765e7 100644
--- a/libs/langchain/langchain/tools/google_serper/tool.py
+++ b/libs/langchain/langchain/tools/google_serper/tool.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "GoogleSerperRun",
"GoogleSerperResults",
+ "GoogleSerperRun",
]
diff --git a/libs/langchain/langchain/tools/json/tool.py b/libs/langchain/langchain/tools/json/tool.py
index f4812cf50e2..5edf1c798d2 100644
--- a/libs/langchain/langchain/tools/json/tool.py
+++ b/libs/langchain/langchain/tools/json/tool.py
@@ -24,7 +24,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "JsonSpec",
- "JsonListKeysTool",
"JsonGetValueTool",
+ "JsonListKeysTool",
+ "JsonSpec",
]
diff --git a/libs/langchain/langchain/tools/memorize/tool.py b/libs/langchain/langchain/tools/memorize/tool.py
index d0e72223ce5..3eb0b171c18 100644
--- a/libs/langchain/langchain/tools/memorize/tool.py
+++ b/libs/langchain/langchain/tools/memorize/tool.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "TrainableLLM",
"Memorize",
+ "TrainableLLM",
]
diff --git a/libs/langchain/langchain/tools/multion/__init__.py b/libs/langchain/langchain/tools/multion/__init__.py
index c3030878cc5..008add06af0 100644
--- a/libs/langchain/langchain/tools/multion/__init__.py
+++ b/libs/langchain/langchain/tools/multion/__init__.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "MultionCloseSession",
"MultionCreateSession",
"MultionUpdateSession",
- "MultionCloseSession",
]
diff --git a/libs/langchain/langchain/tools/multion/update_session.py b/libs/langchain/langchain/tools/multion/update_session.py
index e49da10ea98..1ea53af6b8b 100644
--- a/libs/langchain/langchain/tools/multion/update_session.py
+++ b/libs/langchain/langchain/tools/multion/update_session.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "UpdateSessionSchema",
"MultionUpdateSession",
+ "UpdateSessionSchema",
]
diff --git a/libs/langchain/langchain/tools/office365/__init__.py b/libs/langchain/langchain/tools/office365/__init__.py
index d2108510a68..abee304b3ee 100644
--- a/libs/langchain/langchain/tools/office365/__init__.py
+++ b/libs/langchain/langchain/tools/office365/__init__.py
@@ -33,9 +33,9 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "O365CreateDraftMessage",
"O365SearchEmails",
"O365SearchEvents",
- "O365CreateDraftMessage",
- "O365SendMessage",
"O365SendEvent",
+ "O365SendMessage",
]
diff --git a/libs/langchain/langchain/tools/office365/events_search.py b/libs/langchain/langchain/tools/office365/events_search.py
index 1a4a82e0a12..e7b958eb0bf 100644
--- a/libs/langchain/langchain/tools/office365/events_search.py
+++ b/libs/langchain/langchain/tools/office365/events_search.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SearchEventsInput",
"O365SearchEvents",
+ "SearchEventsInput",
]
diff --git a/libs/langchain/langchain/tools/office365/messages_search.py b/libs/langchain/langchain/tools/office365/messages_search.py
index 5ae016bf7c1..62fe766be02 100644
--- a/libs/langchain/langchain/tools/office365/messages_search.py
+++ b/libs/langchain/langchain/tools/office365/messages_search.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SearchEmailsInput",
"O365SearchEmails",
+ "SearchEmailsInput",
]
diff --git a/libs/langchain/langchain/tools/office365/send_event.py b/libs/langchain/langchain/tools/office365/send_event.py
index 4b7d11a3fe3..c11bde74b26 100644
--- a/libs/langchain/langchain/tools/office365/send_event.py
+++ b/libs/langchain/langchain/tools/office365/send_event.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SendEventSchema",
"O365SendEvent",
+ "SendEventSchema",
]
diff --git a/libs/langchain/langchain/tools/office365/send_message.py b/libs/langchain/langchain/tools/office365/send_message.py
index 09949f67217..cd64d201796 100644
--- a/libs/langchain/langchain/tools/office365/send_message.py
+++ b/libs/langchain/langchain/tools/office365/send_message.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SendMessageSchema",
"O365SendMessage",
+ "SendMessageSchema",
]
diff --git a/libs/langchain/langchain/tools/openapi/utils/api_models.py b/libs/langchain/langchain/tools/openapi/utils/api_models.py
index a587d635cbd..72aad25ca3c 100644
--- a/libs/langchain/langchain/tools/openapi/utils/api_models.py
+++ b/libs/langchain/langchain/tools/openapi/utils/api_models.py
@@ -41,14 +41,14 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "PRIMITIVE_TYPES",
- "APIPropertyLocation",
- "SUPPORTED_LOCATIONS",
"INVALID_LOCATION_TEMPL",
+ "PRIMITIVE_TYPES",
"SCHEMA_TYPE",
- "APIPropertyBase",
- "APIProperty",
- "APIRequestBodyProperty",
- "APIRequestBody",
+ "SUPPORTED_LOCATIONS",
"APIOperation",
+ "APIProperty",
+ "APIPropertyBase",
+ "APIPropertyLocation",
+ "APIRequestBody",
+ "APIRequestBodyProperty",
]
diff --git a/libs/langchain/langchain/tools/playwright/__init__.py b/libs/langchain/langchain/tools/playwright/__init__.py
index 352088c202e..bd8c90bc0c7 100644
--- a/libs/langchain/langchain/tools/playwright/__init__.py
+++ b/libs/langchain/langchain/tools/playwright/__init__.py
@@ -37,11 +37,11 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "NavigateTool",
- "NavigateBackTool",
- "ExtractTextTool",
- "ExtractHyperlinksTool",
- "GetElementsTool",
"ClickTool",
"CurrentWebPageTool",
+ "ExtractHyperlinksTool",
+ "ExtractTextTool",
+ "GetElementsTool",
+ "NavigateBackTool",
+ "NavigateTool",
]
diff --git a/libs/langchain/langchain/tools/playwright/click.py b/libs/langchain/langchain/tools/playwright/click.py
index 75e601d1afa..92d8498fb2a 100644
--- a/libs/langchain/langchain/tools/playwright/click.py
+++ b/libs/langchain/langchain/tools/playwright/click.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ClickToolInput",
"ClickTool",
+ "ClickToolInput",
]
diff --git a/libs/langchain/langchain/tools/playwright/extract_hyperlinks.py b/libs/langchain/langchain/tools/playwright/extract_hyperlinks.py
index e8320e6de7e..0cdd9575e7c 100644
--- a/libs/langchain/langchain/tools/playwright/extract_hyperlinks.py
+++ b/libs/langchain/langchain/tools/playwright/extract_hyperlinks.py
@@ -27,6 +27,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ExtractHyperlinksToolInput",
"ExtractHyperlinksTool",
+ "ExtractHyperlinksToolInput",
]
diff --git a/libs/langchain/langchain/tools/playwright/get_elements.py b/libs/langchain/langchain/tools/playwright/get_elements.py
index 75d6d7768aa..a1df91015e6 100644
--- a/libs/langchain/langchain/tools/playwright/get_elements.py
+++ b/libs/langchain/langchain/tools/playwright/get_elements.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "GetElementsToolInput",
"GetElementsTool",
+ "GetElementsToolInput",
]
diff --git a/libs/langchain/langchain/tools/playwright/navigate.py b/libs/langchain/langchain/tools/playwright/navigate.py
index 734ef229eef..c185754c3b7 100644
--- a/libs/langchain/langchain/tools/playwright/navigate.py
+++ b/libs/langchain/langchain/tools/playwright/navigate.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "NavigateToolInput",
"NavigateTool",
+ "NavigateToolInput",
]
diff --git a/libs/langchain/langchain/tools/plugin.py b/libs/langchain/langchain/tools/plugin.py
index 47c71e8e7d4..8db6f8fbb59 100644
--- a/libs/langchain/langchain/tools/plugin.py
+++ b/libs/langchain/langchain/tools/plugin.py
@@ -25,8 +25,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ApiConfig",
"AIPlugin",
- "AIPluginToolSchema",
"AIPluginTool",
+ "AIPluginToolSchema",
+ "ApiConfig",
]
diff --git a/libs/langchain/langchain/tools/powerbi/tool.py b/libs/langchain/langchain/tools/powerbi/tool.py
index 3cd4166738c..92663ae967f 100644
--- a/libs/langchain/langchain/tools/powerbi/tool.py
+++ b/libs/langchain/langchain/tools/powerbi/tool.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "QueryPowerBITool",
"InfoPowerBITool",
"ListPowerBITool",
+ "QueryPowerBITool",
]
diff --git a/libs/langchain/langchain/tools/reddit_search/tool.py b/libs/langchain/langchain/tools/reddit_search/tool.py
index 29c9bed96fd..e8645b06d06 100644
--- a/libs/langchain/langchain/tools/reddit_search/tool.py
+++ b/libs/langchain/langchain/tools/reddit_search/tool.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "RedditSearchSchema",
"RedditSearchRun",
+ "RedditSearchSchema",
]
diff --git a/libs/langchain/langchain/tools/render.py b/libs/langchain/langchain/tools/render.py
index c97546016c3..cbe6e2bb0e9 100644
--- a/libs/langchain/langchain/tools/render.py
+++ b/libs/langchain/langchain/tools/render.py
@@ -16,8 +16,8 @@ from langchain_core.utils.function_calling import (
)
__all__ = [
+ "format_tool_to_openai_function",
+ "format_tool_to_openai_tool",
"render_text_description",
"render_text_description_and_args",
- "format_tool_to_openai_tool",
- "format_tool_to_openai_function",
]
diff --git a/libs/langchain/langchain/tools/requests/tool.py b/libs/langchain/langchain/tools/requests/tool.py
index 9a7efd6f5ea..693f10a01b0 100644
--- a/libs/langchain/langchain/tools/requests/tool.py
+++ b/libs/langchain/langchain/tools/requests/tool.py
@@ -34,9 +34,9 @@ def __getattr__(name: str) -> Any:
__all__ = [
"BaseRequestsTool",
- "RequestsGetTool",
- "RequestsPostTool",
- "RequestsPatchTool",
- "RequestsPutTool",
"RequestsDeleteTool",
+ "RequestsGetTool",
+ "RequestsPatchTool",
+ "RequestsPostTool",
+ "RequestsPutTool",
]
diff --git a/libs/langchain/langchain/tools/searchapi/tool.py b/libs/langchain/langchain/tools/searchapi/tool.py
index 18c69cb69cf..52d05d60520 100644
--- a/libs/langchain/langchain/tools/searchapi/tool.py
+++ b/libs/langchain/langchain/tools/searchapi/tool.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SearchAPIRun",
"SearchAPIResults",
+ "SearchAPIRun",
]
diff --git a/libs/langchain/langchain/tools/searx_search/tool.py b/libs/langchain/langchain/tools/searx_search/tool.py
index 94b4e560208..4d0d35f4117 100644
--- a/libs/langchain/langchain/tools/searx_search/tool.py
+++ b/libs/langchain/langchain/tools/searx_search/tool.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SearxSearchRun",
"SearxSearchResults",
+ "SearxSearchRun",
]
diff --git a/libs/langchain/langchain/tools/slack/get_message.py b/libs/langchain/langchain/tools/slack/get_message.py
index 8969bae32af..6eff6eaab1a 100644
--- a/libs/langchain/langchain/tools/slack/get_message.py
+++ b/libs/langchain/langchain/tools/slack/get_message.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SlackGetMessageSchema",
"SlackGetMessage",
+ "SlackGetMessageSchema",
]
diff --git a/libs/langchain/langchain/tools/spark_sql/tool.py b/libs/langchain/langchain/tools/spark_sql/tool.py
index afec32b09d3..d1b3e5b1206 100644
--- a/libs/langchain/langchain/tools/spark_sql/tool.py
+++ b/libs/langchain/langchain/tools/spark_sql/tool.py
@@ -32,8 +32,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
"BaseSparkSQLTool",
- "QuerySparkSQLTool",
"InfoSparkSQLTool",
"ListSparkSQLTool",
"QueryCheckerTool",
+ "QuerySparkSQLTool",
]
diff --git a/libs/langchain/langchain/tools/sql_database/tool.py b/libs/langchain/langchain/tools/sql_database/tool.py
index 1df1d645a1a..ea75a5795b0 100644
--- a/libs/langchain/langchain/tools/sql_database/tool.py
+++ b/libs/langchain/langchain/tools/sql_database/tool.py
@@ -32,8 +32,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
"BaseSQLDatabaseTool",
- "QuerySQLDataBaseTool",
"InfoSQLDatabaseTool",
"ListSQLDatabaseTool",
"QuerySQLCheckerTool",
+ "QuerySQLDataBaseTool",
]
diff --git a/libs/langchain/langchain/tools/tavily_search/__init__.py b/libs/langchain/langchain/tools/tavily_search/__init__.py
index 17a9bc59fd1..1c86551132c 100644
--- a/libs/langchain/langchain/tools/tavily_search/__init__.py
+++ b/libs/langchain/langchain/tools/tavily_search/__init__.py
@@ -27,6 +27,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "TavilySearchResults",
"TavilyAnswer",
+ "TavilySearchResults",
]
diff --git a/libs/langchain/langchain/tools/tavily_search/tool.py b/libs/langchain/langchain/tools/tavily_search/tool.py
index fabf4efac73..ed98e485f23 100644
--- a/libs/langchain/langchain/tools/tavily_search/tool.py
+++ b/libs/langchain/langchain/tools/tavily_search/tool.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "TavilyAnswer",
"TavilyInput",
"TavilySearchResults",
- "TavilyAnswer",
]
diff --git a/libs/langchain/langchain/tools/zapier/__init__.py b/libs/langchain/langchain/tools/zapier/__init__.py
index 573590b041a..8820520a3ed 100644
--- a/libs/langchain/langchain/tools/zapier/__init__.py
+++ b/libs/langchain/langchain/tools/zapier/__init__.py
@@ -24,6 +24,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ZapierNLARunAction",
"ZapierNLAListActions",
+ "ZapierNLARunAction",
]
diff --git a/libs/langchain/langchain/tools/zapier/tool.py b/libs/langchain/langchain/tools/zapier/tool.py
index b69ab3f32f2..3211624589c 100644
--- a/libs/langchain/langchain/tools/zapier/tool.py
+++ b/libs/langchain/langchain/tools/zapier/tool.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ZapierNLARunAction",
"ZapierNLAListActions",
+ "ZapierNLARunAction",
]
diff --git a/libs/langchain/langchain/utilities/__init__.py b/libs/langchain/langchain/utilities/__init__.py
index 1ee41550b55..818d6d8310a 100644
--- a/libs/langchain/langchain/utilities/__init__.py
+++ b/libs/langchain/langchain/utilities/__init__.py
@@ -130,13 +130,13 @@ __all__ = [
"DuckDuckGoSearchAPIWrapper",
"GoldenQueryAPIWrapper",
"GoogleFinanceAPIWrapper",
- "GoogleLensAPIWrapper",
"GoogleJobsAPIWrapper",
+ "GoogleLensAPIWrapper",
"GooglePlacesAPIWrapper",
"GoogleScholarAPIWrapper",
- "GoogleTrendsAPIWrapper",
"GoogleSearchAPIWrapper",
"GoogleSerperAPIWrapper",
+ "GoogleTrendsAPIWrapper",
"GraphQLAPIWrapper",
"JiraAPIWrapper",
"LambdaWrapper",
@@ -150,7 +150,7 @@ __all__ = [
"PowerBIDataset",
"PubMedAPIWrapper",
"Requests",
- "SteamWebAPIWrapper",
+ "RequestsWrapper",
"SQLDatabase",
"SceneXplainAPIWrapper",
"SearchApiAPIWrapper",
@@ -158,8 +158,8 @@ __all__ = [
"SerpAPIWrapper",
"SparkSQL",
"StackExchangeAPIWrapper",
+ "SteamWebAPIWrapper",
"TensorflowDatasets",
- "RequestsWrapper",
"TextRequestsWrapper",
"TwilioAPIWrapper",
"WikipediaAPIWrapper",
diff --git a/libs/langchain/langchain/utilities/arcee.py b/libs/langchain/langchain/utilities/arcee.py
index db6adef3127..5a4268af67b 100644
--- a/libs/langchain/langchain/utilities/arcee.py
+++ b/libs/langchain/langchain/utilities/arcee.py
@@ -35,11 +35,11 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ArceeRoute",
- "DALMFilterType",
- "DALMFilter",
- "ArceeDocumentSource",
"ArceeDocument",
"ArceeDocumentAdapter",
+ "ArceeDocumentSource",
+ "ArceeRoute",
"ArceeWrapper",
+ "DALMFilter",
+ "DALMFilterType",
]
diff --git a/libs/langchain/langchain/utilities/clickup.py b/libs/langchain/langchain/utilities/clickup.py
index d7a6d1265ef..c03c7f25b73 100644
--- a/libs/langchain/langchain/utilities/clickup.py
+++ b/libs/langchain/langchain/utilities/clickup.py
@@ -35,11 +35,11 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "Component",
- "Task",
"CUList",
- "Member",
- "Team",
- "Space",
"ClickupAPIWrapper",
+ "Component",
+ "Member",
+ "Space",
+ "Task",
+ "Team",
]
diff --git a/libs/langchain/langchain/utilities/opaqueprompts.py b/libs/langchain/langchain/utilities/opaqueprompts.py
index 07780a9d99a..3316792dbe5 100644
--- a/libs/langchain/langchain/utilities/opaqueprompts.py
+++ b/libs/langchain/langchain/utilities/opaqueprompts.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "sanitize",
"desanitize",
+ "sanitize",
]
diff --git a/libs/langchain/langchain/utilities/sql_database.py b/libs/langchain/langchain/utilities/sql_database.py
index c5648057ac7..3bce1dafa18 100644
--- a/libs/langchain/langchain/utilities/sql_database.py
+++ b/libs/langchain/langchain/utilities/sql_database.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "truncate_word",
"SQLDatabase",
+ "truncate_word",
]
diff --git a/libs/langchain/langchain/utilities/vertexai.py b/libs/langchain/langchain/utilities/vertexai.py
index 6b9fca5cd87..68073c77d62 100644
--- a/libs/langchain/langchain/utilities/vertexai.py
+++ b/libs/langchain/langchain/utilities/vertexai.py
@@ -30,7 +30,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
"create_retry_decorator",
- "raise_vertex_import_error",
- "init_vertexai",
"get_client_info",
+ "init_vertexai",
+ "raise_vertex_import_error",
]
diff --git a/libs/langchain/langchain/utils/__init__.py b/libs/langchain/langchain/utils/__init__.py
index edd3840a3cd..a21d0370978 100644
--- a/libs/langchain/langchain/utils/__init__.py
+++ b/libs/langchain/langchain/utils/__init__.py
@@ -60,12 +60,12 @@ __all__ = [
"convert_to_secret_str",
"cosine_similarity",
"cosine_similarity_top_k",
+ "formatter",
"get_bolded_text",
"get_color_mapping",
"get_colored_text",
"get_from_dict_or_env",
"get_from_env",
- "formatter",
"get_pydantic_field_names",
"guard_import",
"mock_now",
diff --git a/libs/langchain/langchain/utils/aiter.py b/libs/langchain/langchain/utils/aiter.py
index cab956b5d07..1ba006d6afc 100644
--- a/libs/langchain/langchain/utils/aiter.py
+++ b/libs/langchain/langchain/utils/aiter.py
@@ -1,3 +1,3 @@
from langchain_core.utils.aiter import NoLock, Tee, py_anext
-__all__ = ["py_anext", "NoLock", "Tee"]
+__all__ = ["NoLock", "Tee", "py_anext"]
diff --git a/libs/langchain/langchain/utils/html.py b/libs/langchain/langchain/utils/html.py
index a5684b2e07a..efe6d725c99 100644
--- a/libs/langchain/langchain/utils/html.py
+++ b/libs/langchain/langchain/utils/html.py
@@ -9,11 +9,11 @@ from langchain_core.utils.html import (
)
__all__ = [
+ "DEFAULT_LINK_REGEX",
"PREFIXES_TO_IGNORE",
+ "PREFIXES_TO_IGNORE_REGEX",
"SUFFIXES_TO_IGNORE",
"SUFFIXES_TO_IGNORE_REGEX",
- "PREFIXES_TO_IGNORE_REGEX",
- "DEFAULT_LINK_REGEX",
- "find_all_links",
"extract_sub_links",
+ "find_all_links",
]
diff --git a/libs/langchain/langchain/utils/input.py b/libs/langchain/langchain/utils/input.py
index 563cc506076..bff9f875d85 100644
--- a/libs/langchain/langchain/utils/input.py
+++ b/libs/langchain/langchain/utils/input.py
@@ -5,4 +5,4 @@ from langchain_core.utils.input import (
print_text,
)
-__all__ = ["get_color_mapping", "get_colored_text", "get_bolded_text", "print_text"]
+__all__ = ["get_bolded_text", "get_color_mapping", "get_colored_text", "print_text"]
diff --git a/libs/langchain/langchain/utils/iter.py b/libs/langchain/langchain/utils/iter.py
index a4059721241..a905911b1dc 100644
--- a/libs/langchain/langchain/utils/iter.py
+++ b/libs/langchain/langchain/utils/iter.py
@@ -1,3 +1,3 @@
from langchain_core.utils.iter import NoLock, Tee, batch_iterate, tee_peer
-__all__ = ["NoLock", "tee_peer", "Tee", "batch_iterate"]
+__all__ = ["NoLock", "Tee", "batch_iterate", "tee_peer"]
diff --git a/libs/langchain/langchain/utils/json_schema.py b/libs/langchain/langchain/utils/json_schema.py
index 0e61b7bee9e..08bcc8e5e8e 100644
--- a/libs/langchain/langchain/utils/json_schema.py
+++ b/libs/langchain/langchain/utils/json_schema.py
@@ -6,8 +6,8 @@ from langchain_core.utils.json_schema import (
)
__all__ = [
- "_retrieve_ref",
"_dereference_refs_helper",
"_infer_skip_keys",
+ "_retrieve_ref",
"dereference_refs",
]
diff --git a/libs/langchain/langchain/utils/strings.py b/libs/langchain/langchain/utils/strings.py
index f8e88564213..3c394c4694b 100644
--- a/libs/langchain/langchain/utils/strings.py
+++ b/libs/langchain/langchain/utils/strings.py
@@ -1,3 +1,3 @@
from langchain_core.utils.strings import comma_list, stringify_dict, stringify_value
-__all__ = ["stringify_value", "stringify_dict", "comma_list"]
+__all__ = ["comma_list", "stringify_dict", "stringify_value"]
diff --git a/libs/langchain/langchain/utils/utils.py b/libs/langchain/langchain/utils/utils.py
index 57629433164..9856fa02b0f 100644
--- a/libs/langchain/langchain/utils/utils.py
+++ b/libs/langchain/langchain/utils/utils.py
@@ -10,12 +10,12 @@ from langchain_core.utils.utils import (
)
__all__ = [
- "xor_args",
- "raise_for_status_with_text",
- "mock_now",
- "guard_import",
- "check_package_version",
- "get_pydantic_field_names",
"build_extra_kwargs",
+ "check_package_version",
"convert_to_secret_str",
+ "get_pydantic_field_names",
+ "guard_import",
+ "mock_now",
+ "raise_for_status_with_text",
+ "xor_args",
]
diff --git a/libs/langchain/langchain/vectorstores/__init__.py b/libs/langchain/langchain/vectorstores/__init__.py
index 603421aad0e..ec9164fc3c5 100644
--- a/libs/langchain/langchain/vectorstores/__init__.py
+++ b/libs/langchain/langchain/vectorstores/__init__.py
@@ -187,6 +187,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
+ "FAISS",
"AlibabaCloudOpenSearch",
"AlibabaCloudOpenSearchSettings",
"AnalyticDB",
@@ -211,13 +212,12 @@ __all__ = [
"DuckDB",
"EcloudESVectorStore",
"ElasticKnnSearch",
- "ElasticsearchStore",
"ElasticVectorSearch",
+ "ElasticsearchStore",
"Epsilla",
- "FAISS",
"Hologres",
- "LanceDB",
"LLMRails",
+ "LanceDB",
"Marqo",
"MatchingEngine",
"Meilisearch",
@@ -236,11 +236,11 @@ __all__ = [
"Qdrant",
"Redis",
"Rockset",
+ "SKLearnVectorStore",
+ "SQLiteVSS",
"ScaNN",
"SemaDB",
"SingleStoreDB",
- "SKLearnVectorStore",
- "SQLiteVSS",
"StarRocks",
"SupabaseVectorStore",
"Tair",
diff --git a/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py b/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py
index 77773507944..549e19b8dce 100644
--- a/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py
+++ b/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py
@@ -25,6 +25,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "AlibabaCloudOpenSearchSettings",
"AlibabaCloudOpenSearch",
+ "AlibabaCloudOpenSearchSettings",
]
diff --git a/libs/langchain/langchain/vectorstores/azure_cosmos_db.py b/libs/langchain/langchain/vectorstores/azure_cosmos_db.py
index 3b6a8df5740..41b757a0f46 100644
--- a/libs/langchain/langchain/vectorstores/azure_cosmos_db.py
+++ b/libs/langchain/langchain/vectorstores/azure_cosmos_db.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "CosmosDBSimilarityType",
"AzureCosmosDBVectorSearch",
+ "CosmosDBSimilarityType",
]
diff --git a/libs/langchain/langchain/vectorstores/clickhouse.py b/libs/langchain/langchain/vectorstores/clickhouse.py
index 09795a14a4d..86b54d68aef 100644
--- a/libs/langchain/langchain/vectorstores/clickhouse.py
+++ b/libs/langchain/langchain/vectorstores/clickhouse.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ClickhouseSettings",
"Clickhouse",
+ "ClickhouseSettings",
]
diff --git a/libs/langchain/langchain/vectorstores/elastic_vector_search.py b/libs/langchain/langchain/vectorstores/elastic_vector_search.py
index cb75713ba28..89f244134e1 100644
--- a/libs/langchain/langchain/vectorstores/elastic_vector_search.py
+++ b/libs/langchain/langchain/vectorstores/elastic_vector_search.py
@@ -22,6 +22,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "ElasticVectorSearch",
"ElasticKnnSearch",
+ "ElasticVectorSearch",
]
diff --git a/libs/langchain/langchain/vectorstores/elasticsearch.py b/libs/langchain/langchain/vectorstores/elasticsearch.py
index 616a8df3c59..95dea11f1d2 100644
--- a/libs/langchain/langchain/vectorstores/elasticsearch.py
+++ b/libs/langchain/langchain/vectorstores/elasticsearch.py
@@ -31,9 +31,9 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "BaseRetrievalStrategy",
"ApproxRetrievalStrategy",
+ "BaseRetrievalStrategy",
+ "ElasticsearchStore",
"ExactRetrievalStrategy",
"SparseRetrievalStrategy",
- "ElasticsearchStore",
]
diff --git a/libs/langchain/langchain/vectorstores/myscale.py b/libs/langchain/langchain/vectorstores/myscale.py
index 69271ef084e..ddbc536857a 100644
--- a/libs/langchain/langchain/vectorstores/myscale.py
+++ b/libs/langchain/langchain/vectorstores/myscale.py
@@ -24,7 +24,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "MyScaleSettings",
"MyScale",
+ "MyScaleSettings",
"MyScaleWithoutJSON",
]
diff --git a/libs/langchain/langchain/vectorstores/neo4j_vector.py b/libs/langchain/langchain/vectorstores/neo4j_vector.py
index 65f0f8f215f..1c6ea76ea94 100644
--- a/libs/langchain/langchain/vectorstores/neo4j_vector.py
+++ b/libs/langchain/langchain/vectorstores/neo4j_vector.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "SearchType",
"Neo4jVector",
+ "SearchType",
]
diff --git a/libs/langchain/langchain/vectorstores/pgembedding.py b/libs/langchain/langchain/vectorstores/pgembedding.py
index ff1ab86545e..77f10d010ba 100644
--- a/libs/langchain/langchain/vectorstores/pgembedding.py
+++ b/libs/langchain/langchain/vectorstores/pgembedding.py
@@ -31,6 +31,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
"CollectionStore",
"EmbeddingStore",
- "QueryResult",
"PGEmbedding",
+ "QueryResult",
]
diff --git a/libs/langchain/langchain/vectorstores/qdrant.py b/libs/langchain/langchain/vectorstores/qdrant.py
index 474424fd2a7..4d4ef811106 100644
--- a/libs/langchain/langchain/vectorstores/qdrant.py
+++ b/libs/langchain/langchain/vectorstores/qdrant.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "QdrantException",
"Qdrant",
+ "QdrantException",
]
diff --git a/libs/langchain/langchain/vectorstores/redis/__init__.py b/libs/langchain/langchain/vectorstores/redis/__init__.py
index 35484442b33..3294baf0910 100644
--- a/libs/langchain/langchain/vectorstores/redis/__init__.py
+++ b/libs/langchain/langchain/vectorstores/redis/__init__.py
@@ -35,8 +35,8 @@ def __getattr__(name: str) -> Any:
__all__ = [
"Redis",
"RedisFilter",
+ "RedisNum",
"RedisTag",
"RedisText",
- "RedisNum",
"RedisVectorStoreRetriever",
]
diff --git a/libs/langchain/langchain/vectorstores/redis/base.py b/libs/langchain/langchain/vectorstores/redis/base.py
index 3360858b80c..86fd2a38869 100644
--- a/libs/langchain/langchain/vectorstores/redis/base.py
+++ b/libs/langchain/langchain/vectorstores/redis/base.py
@@ -27,7 +27,7 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "check_index_exists",
"Redis",
"RedisVectorStoreRetriever",
+ "check_index_exists",
]
diff --git a/libs/langchain/langchain/vectorstores/redis/filters.py b/libs/langchain/langchain/vectorstores/redis/filters.py
index 628f32c7132..a72aaaac917 100644
--- a/libs/langchain/langchain/vectorstores/redis/filters.py
+++ b/libs/langchain/langchain/vectorstores/redis/filters.py
@@ -37,12 +37,12 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "RedisFilterOperator",
"RedisFilter",
- "RedisFilterField",
- "check_operator_misuse",
- "RedisTag",
- "RedisNum",
- "RedisText",
"RedisFilterExpression",
+ "RedisFilterField",
+ "RedisFilterOperator",
+ "RedisNum",
+ "RedisTag",
+ "RedisText",
+ "check_operator_misuse",
]
diff --git a/libs/langchain/langchain/vectorstores/redis/schema.py b/libs/langchain/langchain/vectorstores/redis/schema.py
index 7b796cab46e..24b19f6385a 100644
--- a/libs/langchain/langchain/vectorstores/redis/schema.py
+++ b/libs/langchain/langchain/vectorstores/redis/schema.py
@@ -41,14 +41,14 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "RedisDistanceMetric",
- "RedisField",
- "TextFieldSchema",
- "TagFieldSchema",
- "NumericFieldSchema",
- "RedisVectorField",
"FlatVectorField",
"HNSWVectorField",
+ "NumericFieldSchema",
+ "RedisDistanceMetric",
+ "RedisField",
"RedisModel",
+ "RedisVectorField",
+ "TagFieldSchema",
+ "TextFieldSchema",
"read_schema",
]
diff --git a/libs/langchain/langchain/vectorstores/sklearn.py b/libs/langchain/langchain/vectorstores/sklearn.py
index f3646985713..dca983b0ee4 100644
--- a/libs/langchain/langchain/vectorstores/sklearn.py
+++ b/libs/langchain/langchain/vectorstores/sklearn.py
@@ -34,9 +34,9 @@ def __getattr__(name: str) -> Any:
__all__ = [
"BaseSerializer",
- "JsonSerializer",
"BsonSerializer",
+ "JsonSerializer",
"ParquetSerializer",
- "SKLearnVectorStoreException",
"SKLearnVectorStore",
+ "SKLearnVectorStoreException",
]
diff --git a/libs/langchain/langchain/vectorstores/starrocks.py b/libs/langchain/langchain/vectorstores/starrocks.py
index bbc3523f7af..b6eb075a8b0 100644
--- a/libs/langchain/langchain/vectorstores/starrocks.py
+++ b/libs/langchain/langchain/vectorstores/starrocks.py
@@ -23,6 +23,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
- "StarRocksSettings",
"StarRocks",
+ "StarRocksSettings",
]
diff --git a/libs/langchain/langchain/vectorstores/utils.py b/libs/langchain/langchain/vectorstores/utils.py
index e657035a3e3..91248ade249 100644
--- a/libs/langchain/langchain/vectorstores/utils.py
+++ b/libs/langchain/langchain/vectorstores/utils.py
@@ -28,6 +28,6 @@ def __getattr__(name: str) -> Any:
__all__ = [
"DistanceStrategy",
- "maximal_marginal_relevance",
"filter_complex_metadata",
+ "maximal_marginal_relevance",
]
diff --git a/libs/langchain/pyproject.toml b/libs/langchain/pyproject.toml
index 91d4b1ddf99..9827a2b058c 100644
--- a/libs/langchain/pyproject.toml
+++ b/libs/langchain/pyproject.toml
@@ -143,7 +143,8 @@ ignore-regex = ".*(Stati Uniti|Tense=Pres).*"
ignore-words-list = "momento,collison,ned,foor,reworkd,parth,whats,aapply,mysogyny,unsecure,damon,crate,aadd,symbl,precesses,accademia,nin"
[tool.ruff.lint]
-select = ["A", "C4", "D", "E", "EM", "F", "FBT", "I", "PGH003", "PIE", "RET", "S", "SIM", "T201", "UP", "W"]
+select = ["A", "C4", "D", "E", "EM", "F", "FBT", "I", "PGH003", "PIE", "RET", "RUF", "S", "SIM", "T201", "UP", "W"]
+ignore = ["RUF012"]
pydocstyle.convention = "google"
pyupgrade.keep-runtime-typing = true
diff --git a/libs/langchain/tests/unit_tests/agents/output_parsers/test_openai_functions.py b/libs/langchain/tests/unit_tests/agents/output_parsers/test_openai_functions.py
index ae1ed248473..c251d2ea9c9 100644
--- a/libs/langchain/tests/unit_tests/agents/output_parsers/test_openai_functions.py
+++ b/libs/langchain/tests/unit_tests/agents/output_parsers/test_openai_functions.py
@@ -13,7 +13,7 @@ from langchain.agents.output_parsers.openai_functions import (
def test_not_an_ai() -> None:
parser = OpenAIFunctionsAgentOutputParser()
- err = f"Expected an AI message got {str(SystemMessage)}"
+ err = f"Expected an AI message got {SystemMessage!s}"
with pytest.raises(TypeError, match=err):
parser.invoke(SystemMessage(content="x"))
diff --git a/libs/langchain/tests/unit_tests/agents/test_agent.py b/libs/langchain/tests/unit_tests/agents/test_agent.py
index 53ada9bd702..3008d40a268 100644
--- a/libs/langchain/tests/unit_tests/agents/test_agent.py
+++ b/libs/langchain/tests/unit_tests/agents/test_agent.py
@@ -1196,7 +1196,7 @@ async def test_openai_agent_tools_agent() -> None:
action=OpenAIToolAgentAction(
tool="find_pet",
tool_input={"pet": "cat"},
- log="\nInvoking: `find_pet` with `{'pet': 'cat'}`\n\n\n", # noqa: E501
+ log="\nInvoking: `find_pet` with `{'pet': 'cat'}`\n\n\n",
message_log=[
_AnyIdAIMessageChunk(
content="",
diff --git a/libs/langchain/tests/unit_tests/agents/test_openai_functions_multi.py b/libs/langchain/tests/unit_tests/agents/test_openai_functions_multi.py
index 30bbd47a0f4..7d18fde1222 100644
--- a/libs/langchain/tests/unit_tests/agents/test_openai_functions_multi.py
+++ b/libs/langchain/tests/unit_tests/agents/test_openai_functions_multi.py
@@ -15,7 +15,7 @@ from langchain.agents.openai_functions_multi_agent.base import (
class TestParseAIMessage:
# Test: Pass Non-AIMessage.
def test_not_an_ai(self) -> None:
- err = f"Expected an AI message got {str(SystemMessage)}"
+ err = f"Expected an AI message got {SystemMessage!s}"
with pytest.raises(TypeError, match=err):
_parse_ai_message(SystemMessage(content="x"))
diff --git a/libs/langchain/tests/unit_tests/indexes/test_api.py b/libs/langchain/tests/unit_tests/indexes/test_api.py
index 0a60c2b5369..0bcbee4b564 100644
--- a/libs/langchain/tests/unit_tests/indexes/test_api.py
+++ b/libs/langchain/tests/unit_tests/indexes/test_api.py
@@ -11,4 +11,4 @@ def test_all() -> None:
"SQLRecordManager",
"VectorstoreIndexCreator",
]
- assert __all__ == sorted(expected, key=lambda x: x.lower())
+ assert sorted(__all__) == sorted(expected)
diff --git a/libs/langchain/tests/unit_tests/load/test_load.py b/libs/langchain/tests/unit_tests/load/test_load.py
index f36a2d24bac..d054115836a 100644
--- a/libs/langchain/tests/unit_tests/load/test_load.py
+++ b/libs/langchain/tests/unit_tests/load/test_load.py
@@ -10,7 +10,7 @@ from langchain.chains.llm import LLMChain
pytest.importorskip("langchain_openai", reason="langchain_openai not installed")
pytest.importorskip("langchain_community", reason="langchain_community not installed")
-from langchain_community.llms.openai import ( # noqa: E402 # ignore: community-import
+from langchain_community.llms.openai import ( # ignore: community-import
OpenAI as CommunityOpenAI,
)
diff --git a/libs/langchain/tests/unit_tests/output_parsers/test_fix.py b/libs/langchain/tests/unit_tests/output_parsers/test_fix.py
index ed266e495bb..287d5ecf79b 100644
--- a/libs/langchain/tests/unit_tests/output_parsers/test_fix.py
+++ b/libs/langchain/tests/unit_tests/output_parsers/test_fix.py
@@ -18,9 +18,7 @@ T = TypeVar("T")
class SuccessfulParseAfterRetries(BaseOutputParser[str]):
parse_count: int = 0 # Number of times parse has been called
- attemp_count_before_success: (
- int # Number of times to fail before succeeding # noqa
- )
+ attemp_count_before_success: int # Number of times to fail before succeeding
def parse(self, *args: Any, **kwargs: Any) -> str:
self.parse_count += 1
@@ -41,16 +39,14 @@ class SuccessfulParseAfterRetriesWithGetFormatInstructions(SuccessfulParseAfterR
SuccessfulParseAfterRetries(attemp_count_before_success=5),
SuccessfulParseAfterRetriesWithGetFormatInstructions(
attemp_count_before_success=5
- ), # noqa: E501
+ ),
],
)
def test_output_fixing_parser_parse(
base_parser: SuccessfulParseAfterRetries,
) -> None:
# preparation
- n: int = (
- base_parser.attemp_count_before_success
- ) # Success on the (n+1)-th attempt # noqa
+ n: int = base_parser.attemp_count_before_success # Success on the (n+1)-th attempt
base_parser = SuccessfulParseAfterRetries(attemp_count_before_success=n)
parser = OutputFixingParser[str](
parser=base_parser,
@@ -86,15 +82,13 @@ def test_output_fixing_parser_from_llm() -> None:
SuccessfulParseAfterRetries(attemp_count_before_success=5),
SuccessfulParseAfterRetriesWithGetFormatInstructions(
attemp_count_before_success=5
- ), # noqa: E501
+ ),
],
)
async def test_output_fixing_parser_aparse(
base_parser: SuccessfulParseAfterRetries,
) -> None:
- n: int = (
- base_parser.attemp_count_before_success
- ) # Success on the (n+1)-th attempt # noqa
+ n: int = base_parser.attemp_count_before_success # Success on the (n+1)-th attempt
base_parser = SuccessfulParseAfterRetries(attemp_count_before_success=n)
parser = OutputFixingParser[str](
parser=base_parser,
diff --git a/libs/langchain/tests/unit_tests/test_pytest_config.py b/libs/langchain/tests/unit_tests/test_pytest_config.py
index 5d553813e24..c2b0af645fb 100644
--- a/libs/langchain/tests/unit_tests/test_pytest_config.py
+++ b/libs/langchain/tests/unit_tests/test_pytest_config.py
@@ -6,5 +6,6 @@ import requests
def test_socket_disabled() -> None:
"""This test should fail."""
with pytest.raises(pytest_socket.SocketBlockedError):
- # noqa since we don't need a timeout here as the request should fail immediately
+ # Ignore S113 since we don't need a timeout here as the request
+ # should fail immediately
requests.get("https://www.example.com") # noqa: S113