深色模式
SDK 调用
支持所有语言OpenAi 官方SDK调用,不支持知识库搜索,以Python为例
- 安装sdk
plain
pip install openai
- 调用示例
python
from openai import OpenAI
API_BASE = "https://ai-maas.wair.ac.cn/maas/v1"
API_KEY = "$API_KEY"
client = OpenAI(
api_key=API_KEY,
base_url=API_BASE
)
completion = client.chat.completions.create(
model="taichu_llm",
messages=[{"role": "user", "content": "你好"}],
stream=True
)
for chunk in completion:
print(chunk)