Integrate GigaChat with LangChain
Guides using GigaChat through LangChain abstractions - chat models, embeddings, tool binding, and RAG - instead of the raw gigachat SDK.
Why it matters
Leverage GigaChat's capabilities within your applications by integrating it with the LangChain framework. This asset enables advanced chat, embedding, and message handling functionalities.
Outcomes
What it gets done
Utilize GigaChat as a chat model within LangChain.
Implement GigaChat embeddings for semantic search and retrieval.
Manage conversational message history effectively.
Build RAG (Retrieval Augmented Generation) applications using GigaChat.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/langchain-gigachat | bash Overview
LangChain GigaChat
Covers using GigaChat through LangChain primitives - chat models, GigaChatEmbeddings, message conversion, streaming, tool binding, and RAG workflows - for building LangChain chains and agents on GigaChat rather than calling the raw SDK. Use it when a task is built with LangChain abstractions on top of GigaChat, not the raw gigachat SDK. Handle credentials/TLS setup via gigachat-setup first, use gigachat-sdk-* skills if LangChain isn't actually needed, and use gpt2giga for OpenAI-compatible base URLs.
What it does
LangChain GigaChat is a focused reference for using GigaChat inside LangChain, rather than calling the raw gigachat SDK directly: initializing and using the langchain-gigachat package, working with the chat model through LangChain message objects and runnables, generating embeddings via GigaChatEmbeddings, binding tools and getting structured outputs where the wrapper supports them, and wiring GigaChat into RAG pipelines using LangChain vector stores.
When to use - and when NOT to
Use it specifically when the task is built with LangChain abstractions - chains, agents, or retrieval pipelines - on top of GigaChat. If the task doesn't actually need LangChain, the skill's own workflow says to prefer the gigachat-sdk-* skills instead of forcing a LangChain wrapper into the picture. It also stays out of two adjacent concerns by design: initial credential/TLS setup, which belongs to gigachat-setup and should be confirmed working first, and OpenAI-compatible base-URL routing, which belongs to gpt2giga.
Inputs and outputs
GigaChat and GigaChatEmbeddings are initialized with the same authentication inputs as the raw SDK, but from there the recommended pattern is to work exclusively with LangChain message objects and runnables rather than raw GigaChat payloads, unless the task is specifically debugging the conversion layer between the two. For retrieval-augmented generation, the pattern is to pair GigaChatEmbeddings with a LangChain vector store and keep the retrieval logic itself inside LangChain rather than hand-rolling it. One practical gotcha called out explicitly: since both LangChain and the underlying SDK can implement retries, a naive combination can double-retry a failing request, so retry behavior needs to be checked rather than assumed. Two reference files carry further detail: references/chat-models.md for chat model and message/tool behavior, and references/embeddings-rag.md for embeddings and RAG patterns.
Integrations
This skill sits alongside a small family of GigaChat-focused skills sharing the same source repository - gigachat-setup, the gigachat-sdk-* skills for direct SDK usage, and gpt2giga for OpenAI-compatible proxying - each scoped narrowly so the LangChain-specific guidance here doesn't have to re-explain setup or low-level SDK mechanics. Its default posture is to keep users inside LangChain abstractions unless there's an actual wrapper-boundary bug, calling out any place where langchain-gigachat's behavior doesn't have full parity with generic LangChain behavior rather than assuming it does.
Who it's for
Developers building LangChain-based chains, agents, or RAG pipelines who want GigaChat to be a drop-in chat/embeddings backend, and need to know where the LangChain wrapper's behavior around GigaChat specifically diverges from vanilla LangChain usage.
Source README
LangChain GigaChat
Use this skill when the user is building with LangChain abstractions, not raw gigachat.
What this skill covers
langchain-gigachatinstallation and initialization- chat model usage through LangChain messages and runnables
- embeddings through
GigaChatEmbeddings - tool binding and structured outputs where supported
- RAG setup using LangChain vector stores
- practical wrapper behavior around the underlying SDK
Workflow
- If credentials and TLS are not configured, use
gigachat-setup. - If the task does not need LangChain primitives, prefer
gigachat-sdk-*skills. - Initialize
GigaChatorGigaChatEmbeddingswith the same auth inputs as the SDK. - Work with LangChain message objects, not raw GigaChat payloads, unless debugging conversion.
- For RAG, pair
GigaChatEmbeddingswith a vector store and keep retrieval logic in LangChain. - Avoid double retries when LangChain and the SDK both retry.
- Prefer the simplest verified LangChain pattern before adding wrapper-specific complexity.
Read these references as needed
- For chat models and message/tool behavior:
references/chat-models.md - For embeddings and RAG patterns:
references/embeddings-rag.md
Default output
- keep the user inside LangChain abstractions unless there is a wrapper boundary bug
- do not mix raw SDK code into normal LangChain starter examples
- call out wrapper caveats instead of assuming full parity with generic LangChain behavior
Boundaries
- Do not explain OpenAI-compatible base URLs here; use
gpt2giga.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.