LangChain logo

Sarvam + LangChain

Agent Framework

Official LangChain integration for Sarvam AI. Use ChatSarvam as a drop-in BaseChatModel for chains, agents, tool calling, and structured output, exactly like ChatOpenAI or ChatAnthropic.

Sarvam APIs Supported
sarvam-105b

LLM

Multilingual large language model with native proficiency across Indian languages for text generation and reasoning.

How it works
1.

Install langchain-sarvam

pip install langchain-sarvam python-dotenv

2.

Add your API key

Set SARVAM_API_KEY in a .env file with a key from dashboard.sarvam.ai

3.

Create a ChatSarvam instance

Use ChatSarvam in chains, agents, or tool-calling loops like any other BaseChatModel

Quick start
Install
Bash
pip install langchain-sarvam python-dotenv
Code
Python
from langchain_sarvam import ChatSarvam

llm = ChatSarvam(model="sarvam-105b")

response = llm.invoke("Translate this to malayalam: 'Keep cooking, guys'")
print(response.content)  # പാചകം തുടരൂ, സുഹൃത്തുക്കളേ
Use cases

Multilingual

Multilingual Chat Agents

Build LangChain agents that reason and respond natively in Indian languages.

Tool-Calling

Tool-Calling Pipelines

Wire Sarvam models into bind_tools() workflows alongside retrievers and other LangChain components.

Structured

Structured Output Chains

Use with_structured_output() to extract typed, schema-constrained data from Indic-language text.

Resources & details
Type Official Integration
Language Python
Maintained by Sarvam AI
Install pip install langchain-sarvam

Ready to build? Start building with LangChain in minutes.