Spaces:
Sleeping
Sleeping
File size: 604 Bytes
228bb8f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from openai import OpenAI
import os
base_url = "https://internlm-chat.intern-ai.org.cn/puyu/api/v1/"
# api_key = "sk-请填写准确的 token!"
api_key = os.getenv("API_KEY")
model="internlm2.5-latest"
# base_url = "https://api.siliconflow.cn/v1"
# api_key = "sk-请填写准确的 token!"
# model="internlm/internlm2_5-7b-chat"
client = OpenAI(
api_key=api_key ,
base_url=base_url,
)
chat_rsp = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": "Qwen2Attention是什么?"}],
)
for choice in chat_rsp.choices:
print(choice.message.content) |