Skip to main content

Sarvam LLM plugin guide

How to use the Sarvam LLM plugin for LiveKit Agents.

Available in
Python

Overview

This plugin allows you to use Sarvam as an LLM provider for your voice agents. Sarvam offers OpenAI-compatible chat completions tuned for Indian languages, with support for tool calling.

Installation

Install the plugin:

uv add "livekit-agents[sarvam]~=1.5"

Authentication

The Sarvam plugin requires a Sarvam API key.

Set SARVAM_API_KEY in your .env file.

Usage

Use Sarvam within an AgentSession or as a standalone LLM service. For example, you can use this LLM in the Voice AI quickstart.

from livekit.plugins import sarvam
session = AgentSession(
llm=sarvam.LLM(
model="sarvam-30b",
),
# ... tts, stt, vad, turn_handling, etc.
)

Parameters

This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.

modelstr | SarvamLLMModelsDefault: sarvam-30b

Model to use. Valid values are:

  • sarvam-30b
  • sarvam-30b-16k
  • sarvam-105b
  • sarvam-105b-32k

To learn more, see the Sarvam documentation.

temperaturefloat

Sampling temperature that controls the randomness of the model's output. Higher values make the output more random, while lower values make it more focused and deterministic. Range of valid values can vary by model.

tool_choiceToolChoice | Literal['auto', 'required', 'none']Default: auto

Controls how the model uses tools. String options are as follows:

  • 'auto': Let the model decide.
  • 'required': Force tool usage.
  • 'none': Disable tool usage.
wiki_groundingbool

Enables Retrieval-Augmented Generation (RAG). When set to true, the model retrieves relevant chunks from Wikipedia based on the user's question and uses them to ground its answer, improving factual accuracy for queries like educational, definitional, historical, and scientific questions. To learn more, see the Sarvam documentation.

Additional resources

The following resources provide more information about using Sarvam with LiveKit Agents.