GigaChat
此笔记本展示了如何将 LangChain 与GigaChat 嵌入一起使用。要使用它,您需要安装 gigachat
python 包。
%pip install --upgrade --quiet gigachat
要获取 GigaChat 凭据,您需要创建帐户并访问 API
示例
import os
from getpass import getpass
os.environ["GIGACHAT_CREDENTIALS"] = getpass()
from langchain_community.embeddings import GigaChatEmbeddings
embeddings = GigaChatEmbeddings(verify_ssl_certs=False, scope="GIGACHAT_API_PERS")
API 参考:GigaChatEmbeddings
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]