Skip to content
This repository was archived by the owner on May 30, 2026. It is now read-only.

feat(provider): add GigaChat via the gigachat library - #62

Open
Rai220 wants to merge 1 commit into
joi-lab:ouroborosfrom
Rai220:gigachat_support
Open

feat(provider): add GigaChat via the gigachat library#62
Rai220 wants to merge 1 commit into
joi-lab:ouroborosfrom
Rai220:gigachat_support

Conversation

@Rai220

@Rai220 Rai220 commented May 29, 2026

Copy link
Copy Markdown

Summary

Adds GigaChat as a first-class LLM provider (model prefix gigachat::), routed through the official gigachat library rather than the OpenAI SDK — GigaChat is not OpenAI-compatible (OAuth, function role instead of tool, a single function_call instead of a tool_calls array).

Default model: gigachat::GigaChat-3-Ultra. Everything is env/Settings-configurable.

What's included

  • ouroboros/llm.pygigachat:: routing + a dedicated _chat_gigachat path (mirrors the existing _chat_anthropic) with native function-calling:
    • OpenAI tools → GigaChat functions; function_call: "auto"/"none"; native function_call response parsed back into OpenAI tool_calls.
    • Handles two GigaChat-specific quirks discovered during live testing: function results must be valid JSON (plain text is wrapped as {"result": ...}), and the system message must be first (later system-reminders are demoted to user).
  • AuthGIGACHAT_CREDENTIALS (authorization key, OAuth) or GIGACHAT_USER/GIGACHAT_PASSWORD (basic auth). GIGACHAT_SCOPE / GIGACHAT_BASE_URL / GIGACHAT_VERIFY_SSL_CERTS / GIGACHAT_PROFANITY_CHECK are all configurable.
  • Provider wiringconfig.py, pricing.py, safety.py, server_runtime.py, model_catalog_api.py (lists models via the library's native async client), agent_task_pipeline.py, launcher_bootstrap.py, contracts/plugin_api.py, server.py (secret redaction + restart keys), provider_models.py.
  • Settings UI — GigaChat card (settings_ui.js/settings.js) + provider icon.
  • Dependencygigachat>=0.2.1 (lazy-imported).
  • Tests — new tests/test_gigachat_conversion.py (converters: tool↔function, tool_calls↔function_call, JSON-result wrapping, system-demotion, response normalization) + provider-wiring updates across 8 test files.
  • Docs — README, ARCHITECTURE (env table + routing), DEVELOPMENT, CHECKLISTS, CREATING_SKILLS.

Verification

  • Unit + provider-routing tests pass; no regressions vs the pre-existing baseline.
  • Verified live against a real GigaChat endpoint: direct chat, a tool-calling round-trip (get_weather), and a full agent task (read a file via tool → summarize) all succeed on GigaChat-3-Ultra. The model catalog lists real gigachat:: models.

Notes / known limitations

  • GigaChat supports one function_call per turn; parallel OpenAI tool_calls are collapsed to the first.
  • Cost is estimated from token counts (no live cost API).
  • Not wired (no OpenAI-tools equivalent): few_shot_examples, return_parameters, function_ranker, forced-specific-function, functions_state_id threading.

🤖 Generated with Claude Code

@Rai220
Rai220 changed the base branch from main to ouroboros May 30, 2026 07:23
Add GigaChat as a first-class LLM provider (model prefix `gigachat::`),
routed through the official `gigachat` library instead of the OpenAI SDK
(GigaChat is not OpenAI-compatible: OAuth, `function` role, single
`function_call`).

- llm.py: gigachat routing + dedicated _chat_gigachat path with converters
  (OpenAI tools<->GigaChat functions, tool_calls<->function_call). Handles
  two GigaChat quirks: function results must be valid JSON (plain text is
  wrapped as {"result": ...}) and the system message must be first (later
  system-reminders are demoted to user).
- Auth via GIGACHAT_CREDENTIALS (OAuth key) or GIGACHAT_USER/GIGACHAT_PASSWORD
  (basic auth); GIGACHAT_SCOPE/BASE_URL/VERIFY_SSL_CERTS/PROFANITY_CHECK are
  all env-configurable. Default model gigachat::GigaChat-3-Ultra.
- Wired into config, pricing, safety, server_runtime, model_catalog_api,
  agent_task_pipeline, launcher_bootstrap, plugin_api, server.py.
- Settings UI card (settings_ui.js/settings.js) + provider icon.
- gigachat>=0.2.1 dependency; tests (conversion unit tests + provider wiring)
  and docs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Rai220
Rai220 force-pushed the gigachat_support branch from efa1fe8 to e9d49a9 Compare May 30, 2026 08:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant