Skip to main content
Open In ColabOpen on GitHub

GigaChat

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

%pip install --upgrade --quiet  langchain-gigachat

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

Example

import os
from getpass import getpass

if "GIGACHAT_CREDENTIALS" not in os.environ:
os.environ["GIGACHAT_CREDENTIALS"] = getpass()
from langchain_gigachat import GigaChatEmbeddings

embeddings = GigaChatEmbeddings(verify_ssl_certs=False, scope="GIGACHAT_API_PERS")
query_result = embeddings.embed_query("The quick brown fox jumps over the lazy dog")
query_result[:5]
[0.8398333191871643,
-0.14180311560630798,
-0.6161925792694092,
-0.17103666067123413,
1.2884578704833984]

Was this page helpful?