langchain-siliconflow
This package contains the LangChain integration with SiliconFlow
Installationโ
pip install -U langchain-siliconflow
And you should configure credentials by setting the following environment variables:
export SILICONFLOW_API_KEY="your-api-key"
You can set the following environment variable to use the .cn
endpoint:
export SILICONFLOW_BASE_URL="http://api.siliconflow.cn/v1"
Chat Modelsโ
ChatSiliconFlow
class exposes chat models from SiliconFlow.
from langchain_siliconflow import ChatSiliconFlow
llm = ChatSiliconFlow()
llm.invoke("Sing a ballad of LangChain.")
Embeddingsโ
SiliconFlowEmbeddings
class exposes embeddings from SiliconFlow.
from langchain_siliconflow import SiliconFlowEmbeddings
embeddings = SiliconFlowEmbeddings()
embeddings.embed_query("What is the meaning of life?")