Skip to main content

GigaChat

This notebook shows how to use LangChain with GigaChat. To use you need to install gigachat python package.

# !pip install gigachat

To get GigaChat credentials you need to create account and get access to API ## Example

import os
from getpass import getpass

os.environ["GIGACHAT_CREDENTIALS"] = getpass()
from langchain.llms import GigaChat

llm = GigaChat(verify_ssl_certs=False)
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate

template = "What is capital of {country}?"

prompt = PromptTemplate(template=template, input_variables=["country"])

llm_chain = LLMChain(prompt=prompt, llm=llm)

generated = llm_chain.run(country="Russia")
print(generated)
The capital of Russia is Moscow.