The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
anthropic: docstrings (#23145)
Leonid Ganeline3dfd05541152
diff --git a/libs/partners/anthropic/langchain_anthropic/chat_models.py b/libs/partners/anthropic/langchain_anthropic/chat_models.pyindex 6b3250e847..d0b279f170 100644--- a/libs/partners/anthropic/langchain_anthropic/chat_models.py+++ b/libs/partners/anthropic/langchain_anthropic/chat_models.py@@ -231,7 +231,7 @@ def _format_messages(messages: List[BaseMessage]) -> Tuple[Optional[str], List[Dclass ChatAnthropic(BaseChatModel):- """Anthropic chat model integration.+ """Anthropic chat models.See https://docs.anthropic.com/en/docs/models-overview for a list of the latest models.@@ -1008,6 +1008,8 @@ class ChatAnthropic(BaseChatModel):class AnthropicTool(TypedDict):+ """Anthropic tool definition."""+name: strdescription: strinput_schema: Dict[str, Any]@@ -1016,6 +1018,7 @@ class AnthropicTool(TypedDict):def convert_to_anthropic_tool(tool: Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool],) -> AnthropicTool:+ """Convert a tool-like object to an Anthropic tool definition."""# already in Anthropic tool formatif isinstance(tool, dict) and all(k in tool for k in ("name", "description", "input_schema")diff --git a/libs/partners/anthropic/langchain_anthropic/experimental.py b/libs/partners/anthropic/langchain_anthropic/experimental.pyindex 8b5c43acae..529ee2a745 100644--- a/libs/partners/anthropic/langchain_anthropic/experimental.py+++ b/libs/partners/anthropic/langchain_anthropic/experimental.py@@ -55,6 +55,7 @@ def _get_type(parameter: Dict[str, Any]) -> str:def get_system_message(tools: List[Dict]) -> str:+ """Generate a system message that describes the available tools."""tools_data: List[Dict] = [{"tool_name": tool["name"],diff --git a/libs/partners/anthropic/langchain_anthropic/llms.py b/libs/partners/anthropic/langchain_anthropic/llms.pyindex 9aed83df69..47ac9f4eb5 100644--- a/libs/partners/anthropic/langchain_anthropic/llms.py+++ b/libs/partners/anthropic/langchain_anthropic/llms.py@@ -362,4 +362,6 @@ class AnthropicLLM(LLM, _AnthropicCommon):@deprecated(since="0.1.0", removal="0.3.0", alternative="AnthropicLLM")class Anthropic(AnthropicLLM):+ """Anthropic large language model."""+passdiff --git a/libs/partners/anthropic/langchain_anthropic/output_parsers.py b/libs/partners/anthropic/langchain_anthropic/output_parsers.pyindex 84840591f3..fa8d3bd419 100644--- a/libs/partners/anthropic/langchain_anthropic/output_parsers.py+++ b/libs/partners/anthropic/langchain_anthropic/output_parsers.py@@ -7,9 +7,14 @@ from langchain_core.pydantic_v1 import BaseModelclass ToolsOutputParser(BaseGenerationOutputParser):+ """Output parser for tool calls."""+first_tool_only: bool = False+ """Whether to return only the first tool call."""args_only: bool = False+ """Whether to return only the arguments of the tool calls."""pydantic_schemas: Optional[List[Type[BaseModel]]] = None+ """Pydantic schemas to parse tool calls into."""class Config:extra = "forbid"@@ -59,6 +64,7 @@ class ToolsOutputParser(BaseGenerationOutputParser):def extract_tool_calls(content: List[dict]) -> List[ToolCall]:+ """Extract tool calls from a list of content blocks."""tool_calls = []for block in content:if block["type"] != "tool_use":