Skill

Integrate GigaChat Function Calling

Guides function calling with the official GigaChat SDK - custom function schemas, built-in functions like text2image, and the tool-result loop.

Works with gigachat

91
Spark score
out of 100
Updated last month
Version 1.0.0

Add to Favorites

Why it matters

Enable GigaChat to interact with custom functions and external tools. This allows for more complex and automated interactions by chaining function calls and handling responses.

Outcomes

What it gets done

01

Define and register custom functions for GigaChat.

02

Orchestrate sequences of function calls.

03

Process and manage responses from function executions.

04

Extend GigaChat's capabilities beyond text generation.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/gigachat-sdk-functions | bash

Overview

GigaChat Function Calling

Covers function calling with the official gigachat Python SDK - designing a functions schema, choosing function_call modes, handling finish_reason == function_call, running built-in functions like text2image, and sending results back to the model. Use it when building an agent or tool-use flow directly on the gigachat SDK, where the model needs to call functions. Use langchain-gigachat for LangChain tool wrappers, and gpt2giga for OpenAI-compatible tool mapping.

What it does

GigaChat SDK Functions covers function calling directly on the official gigachat Python SDK: designing a functions schema with explicit, flat fields, choosing a function_call mode, detecting when the model wants to call a tool (finish_reason == "function_call"), executing that tool in your own code, and sending the result back to the model with role function so it can produce a final answer. It also covers GigaChat's built-in functions, such as text2image, alongside custom user-defined ones.

When to use - and when NOT to

Use it whenever an agent or tool-use flow is being built directly on top of the gigachat SDK - i.e. the model needs to decide to call a function and get its result back before answering. It deliberately does not cover two adjacent integration layers: LangChain-style tool wrappers, which belong to langchain-gigachat, and OpenAI-compatible tool-call mapping, which belongs to gpt2giga. If schema validation fails or a function call looks wrong, the skill's guidance is to check the schema itself before assuming the model is misbehaving.

Inputs and outputs

The workflow starts from an ordinary Chat(messages=[...]) payload with a functions=[...] array added, using flat, explicit schema fields rather than complex nested constructs by default. function_call="auto" is the default mode unless the task specifically needs to force a particular function. When the model responds with finish_reason == "function_call", the calling code executes the corresponding tool, then appends both the assistant's function-call message and a new function-result message before calling the model again - the full two-step loop, not just the first call, is the pattern the skill insists on documenting. For built-in functions like text2image, the skill calls out explicitly when the response is a file reference rather than inline bytes, since that changes how the result must be handled downstream. Deeper patterns for both custom and built-in functions live in references/function-calling.md.

Integrations

This skill is scoped to raw SDK usage and sits alongside langchain-gigachat (for LangChain-based tool wrappers) and gpt2giga (for OpenAI-compatible tool-call mapping through a proxy) - each handling function/tool calling in its own layer so this one can stay focused on the SDK-level mechanics of functions, function_call, and result round-tripping.

Who it's for

Developers building agents or tool-using applications directly on the gigachat SDK who need the complete request-execute-respond loop for function calling done correctly, including the easy-to-miss step of sending the function's result back to the model.

Source README

GigaChat SDK Functions

Use this skill when the model must call tools.

What this skill covers

  • functions schema design
  • function_call modes
  • handling finish_reason == "function_call"
  • sending function results back with role function
  • built-in functions such as text2image
  • function schema validation

Workflow

  1. Start with a normal Chat(messages=[...]) payload.
  2. Add functions=[...] with flat explicit schema fields.
  3. Use function_call="auto" unless you need strict forcing.
  4. If the model returns a function call, execute the tool in your code.
  5. Append assistant function-call output and the function result message, then call the model again.
  6. Validate broken schemas before blaming the model.
  7. Prefer the smallest complete two-step tool loop that satisfies the task.

Read these references as needed

  • For custom and built-in function patterns: references/function-calling.md

Default output

  • include the full two-step tool loop, not only the first model call
  • avoid complex schema constructs as the default
  • state explicitly when a built-in returns file references rather than inline bytes

Boundaries

  • Do not cover LangChain tool wrappers here; use langchain-gigachat.
  • Do not cover OpenAI-compatible tool mapping here; use gpt2giga.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.