ChatYI
This will help you getting started with Yi chat models. For detailed documentation of all ChatYi features and configurations head to the API reference.
01.AI, founded by Dr. Kai-Fu Lee, is a global company at the forefront of AI 2.0. They offer cutting-edge large language models, including the Yi series, which range from 6B to hundreds of billions of parameters. 01.AI also provides multimodal models, an open API platform, and open-source options like Yi-34B/9B/6B and Yi-VL.
Overviewโ
Integration detailsโ
Class | Package | Local | Serializable | JS support | Package downloads | Package latest |
---|---|---|---|---|---|---|
ChatYi | langchain_community | โ | โ | โ |
Model featuresโ
Tool calling | Structured output | JSON mode | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
---|---|---|---|---|---|---|---|---|---|
โ | โ | โ | โ | โ | โ | โ | โ | โ | โ |
Setupโ
To access ChatYi models you'll need to create a/an 01.AI account, get an API key, and install the langchain_community
integration package.
Credentialsโ
Head to 01.AI to sign up to 01.AI and generate an API key. Once you've done this set the YI_API_KEY
environment variable:
import getpass
import os
if "YI_API_KEY" not in os.environ:
os.environ["YI_API_KEY"] = getpass.getpass("Enter your Yi API key: ")
If you want to get automated tracing of your model calls you can also set your LangSmith API key by uncommenting below:
# os.environ["LANGSMITH_API_KEY"] = getpass.getpass("Enter your LangSmith API key: ")
# os.environ["LANGSMITH_TRACING"] = "true"
Installationโ
The LangChain ModuleName integration lives in the langchain_community
package:
%pip install -qU langchain_community
Instantiationโ
Now we can instantiate our model object and generate chat completions:
- TODO: Update model instantiation with relevant params.
from langchain_community.chat_models.yi import ChatYi
llm = ChatYi(
model="yi-large",
temperature=0,
timeout=60,
yi_api_base="https://api.01.ai/v1/chat/completions",
# other params...
)