Skip to main content

Built-in tools

This document records the mapping of provider built-in tools to the tools of GigaChat Chat Completions v2. The source of truth for GigaChat here is the installed gigachat SDK, not the website or external documentation.

Source of truth​

In pyproject.toml the package requires gigachat>=0.2.4a1,<0.3.0. For this range, the canonical list of built-in tools comes from the SDK models:

  • gigachat.models.chat_completions.ChatTool;
  • the SDK shorthand normalizer _normalize_tool;
  • the local helper object gpt2giga.common.tools.GIGACHAT_BUILTIN_TOOL_TYPES.

The SDK accepts exactly these built-in tool fields:

GigaChat toolSDK fieldConfiguration shape
Web searchweb_searchChatWebSearchTool: type, indexes, flags plus SDK-compatible extra fields
URL content extractionurl_content_extractiondict[str, Any]
Code interpretercode_interpreterdict[str, Any]
Image generationimage_generatedict[str, Any]
3D model generationmodel_3d_generatedict[str, Any]

functions in ChatTool is a wrapper for user function tools. It is not a GigaChat built-in tool: it is mapped separately from OpenAI/Anthropic/Gemini function declarations.

Where tools are executed​

Built-in tools are sent upstream only through the GigaChat Chat Completions v2 contract. On public routes this means:

  • /v2/... always uses the v2 backend contract;
  • root routes use v2 only with GPT2GIGA_GIGACHAT_API_MODE=v2;
  • /v1/... uses the legacy GigaChat chat contract, where built-in tools are not passed as executable tools.

If the same built-in tool is passed several times in one request through different aliases, the first canonical field reaches the GigaChat payload. A forced tool_choice for supported built-in tools turns into a GigaChat ChatToolConfig(mode="tool", tool_name="<canonical tool>").

OpenAI mapping​

OpenAI Chat Completions and Responses tools are normalized by type.

OpenAI tool typeGigaChat toolNotes
web_searchweb_searchDirect canonical mapping
web_search_*web_searchCovers dated OpenAI types, for example web_search_2025_08_26
web_search_previewweb_searchPreview alias
web_search_preview_*web_searchDated preview aliases
code_interpretercode_interpreterDirect canonical mapping
image_generationimage_generateAlias for OpenAI Responses image generation
image_generateimage_generateCanonical GigaChat passthrough without renaming
url_content_extractionurl_content_extractionCanonical GigaChat passthrough without renaming
model_3d_generatemodel_3d_generateNative GigaChat passthrough without renaming
functionfunctions wrapperA user function, not a built-in tool
namespacefunctions wrapperResponses namespace tools are flattened into GigaChat function names

When a Responses client advertises the Codex ImageGen tool as a flat imagegen / image_gen__imagegen function or as image_gen.imagegen inside a namespace, a provider-side image_generate hand-off is returned as a function call to that exact client tool. Requests that advertise the native image_generation built-in keep the normal image_generation_call response.

The configuration is read from the canonical field, the alias field, and non-structured top-level keys. For example:

{
"type": "web_search_preview",
"indexes": ["web"],
"flags": ["trusted"]
}

turns into:

{"web_search": {"indexes": ["web"], "flags": ["trusted"]}}

Anthropic mapping​

Anthropic Messages tools use versioned provider tool names. The proxy strips provider/version suffixes where the meaning maps cleanly to a GigaChat SDK built-in tool.

Anthropic tool typeGigaChat toolNotes
web_searchweb_searchDirect provider alias
web_search_*web_searchCovers dated SDK names, for example web_search_20250305
web_fetchurl_content_extractionURL fetch maps to URL content extraction
web_fetch_*url_content_extractionCovers dated SDK names, for example web_fetch_20250910
code_executioncode_interpreterCode execution maps to the interpreter
code_execution_*code_interpreterCovers dated SDK names, for example code_execution_20250825
Custom tools with input_schemafunctions wrapperA user function, not a built-in tool

Gemini mapping​

Gemini tools entries do not contain a type field. The adapter maps known tool-object keys to GigaChat built-in tools, and keeps unsupported keys in raw_extensions["unsupportedTools"] for diagnostics.

Gemini tool keyGigaChat toolNotes
googleSearch / google_searchweb_searchGoogle search maps to web search
googleSearchRetrieval / google_search_retrievalweb_searchThe legacy/retrieval search form is best-effort mapped to web search
urlContext / url_contexturl_content_extractionURL context maps to URL content extraction
codeExecution / code_executioncode_interpreterCode execution maps to the interpreter
functionDeclarations / function_declarationsfunctions wrapperUser functions, not built-in tools

For Gemini requests, only the configuration object from a supported Gemini tool key is passed into the canonical GigaChat field:

{"googleSearch": {"indexes": ["web"]}}

turns into:

{"type": "web_search", "web_search": {"indexes": ["web"]}}

toolConfig.functionCallingConfig applies only to Gemini function declarations. It does not force, filter, or remove provider built-in tools.

Not mapped​

Provider built-in tools remain unsupported if the GigaChat SDK does not provide a semantically equivalent ChatTool field.

ProviderExamples without a mappingBehavior
OpenAIfile_search, computer, computer_use_preview, mcp, tool_search, shell, local_shell, apply_patch, freeform customIgnored or kept only in compatibility diagnostics depending on the route
Anthropictool_search*, memory*, bash*, text_editor*, advisor, MCP tools, computer-use toolsAccepted where allowed by the compatibility policy, but not sent to GigaChat as executable built-in tools
GeminifileSearch, googleMaps, computerUse, mcpServers, enterpriseWebSearch, parallelAiSearch, Vertex/RAG/retrieval toolsKept in the unsupportedTools diagnostics and not applied by GigaChat

This approach is intentionally conservative: similar names are not enough for a mapping. A mapping appears only when the GigaChat SDK has an executable field with the same operational meaning.

Update checklist​

When a provider SDK adds or renames built-in tools:

  1. Check the installed provider SDKs and the GigaChat SDK models.
  2. Update gpt2giga.common.tools.normalize_gigachat_builtin_tool_type.
  3. For Gemini object-key tools, update gpt2giga.protocols.gemini.adapter.
  4. Add request-builder and adapter tests.
  5. Update this document, as well as api-compatibility.md and client-parameter-compatibility.md, if the public behavior changes.