anthropic: docstrings (#23145)

Added missed docstrings. Format docstrings to the consistent format
(used in the API Reference)
This commit is contained in:
Leonid Ganeline
2024-06-18 19:26:45 -07:00
committed by GitHub
parent 90559fde70
commit 3dfd055411
4 changed files with 13 additions and 1 deletions

View File

@@ -7,9 +7,14 @@ from langchain_core.pydantic_v1 import BaseModel
class 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":