Spaces:
Sleeping
Sleeping
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) |