案例:使用 gemma

from openai import OpenAI

client = OpenAI(
    api_key = "自己的API key",
    base_url = "https://api.agicto.cn/v1"
)

chat_completion = client.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": "讲个笑话",
        }
    ],
    model="google/gemma-7b-it", # 此处更换其它模型,请参考模型列表 eg: google/gemma-7b-it
)

print(chat_completion.choices[0].message.content)

Was this page helpful?