Provider-neutral tool-call normalization for LLM adapters.
ai._tool_calls
| Name | Type | Default | Description |
|---|---|---|---|
type
|
|
— | |
qualified_name
|
|
— | |
element_type
|
|
— | |
description
|
|
— | |
source_file
|
|
— | |
line_number
|
|
— | |
is_autodoc
|
|
— | |
autodoc_element
|
|
— | |
_autodoc_template
|
|
— | |
_autodoc_url_path
|
|
— | |
_autodoc_page_type
|
|
— | |
title
|
|
— | |
doc_content_hash
|
|
— |
Symbols on this page
class
ChatCompletion
function
tools_from_registry
function
tools_to_openai
function
tools_to_anthropic
function
parse_openai_completion
function
parse_anthropic_completion
function
tool_result_message_openai
function
tool_result_message_anthropic
function
format_tool_result
Normalized completion from a provider message response.
ChatCompletion
class
Normalized completion from a provider message response.
tools_from_registry
function
def tools_from_registry(registry: ToolRegistry | None) -> list[McpToolInfo]
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
registry
|
ToolRegistry | None
|
— |
tools_to_openai
function
def tools_to_openai(tools: Sequence[McpToolInfo]) -> list[dict[str, Any]]
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
tools
|
Sequence[McpToolInfo]
|
— |
tools_to_anthropic
function
def tools_to_anthropic(tools: Sequence[McpToolInfo]) -> list[dict[str, Any]]
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
tools
|
Sequence[McpToolInfo]
|
— |
parse_openai_completion
function
def parse_openai_completion(data: dict[str, Any]) -> ChatCompletion
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
data
|
dict[str, Any]
|
— |
parse_anthropic_completion
function
def parse_anthropic_completion(data: dict[str, Any]) -> ChatCompletion
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
data
|
dict[str, Any]
|
— |
tool_result_message_openai
function
def tool_result_message_openai(call_id: str, content: str) -> dict[str, Any]
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
call_id
|
str
|
— | |
content
|
str
|
— |
tool_result_message_anthropic
function
def tool_result_message_anthropic(call_id: str, content: str) -> dict[str, Any]
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
call_id
|
str
|
— | |
content
|
str
|
— |
format_tool_result
function
def format_tool_result(result: Any) -> str
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
result
|
Any
|
— |
View source · /home/runner/work/chirp/chirp/site/../src/chirp/ai/_tool_calls.py:1