|
|
@ -1,9 +1,10 @@
|
|
|
|
# 安装 OpenAI SDK:
|
|
|
|
# 安装 OpenAI SDK:
|
|
|
|
# pip install openai
|
|
|
|
# pip install openai
|
|
|
|
from openai import OpenAI
|
|
|
|
from openai import OpenAI
|
|
|
|
from Config.Config import *
|
|
|
|
from Config import Config
|
|
|
|
|
|
|
|
|
|
|
|
# 创建 API 客户端
|
|
|
|
# 创建 API 客户端
|
|
|
|
client = OpenAI(api_key=DEEPSEEK_API_KEY, base_url="https://api.deepseek.com")
|
|
|
|
client = OpenAI(api_key=Config.DEEPSEEK_API_KEY, base_url=Config.DEEPSEEK_URL)
|
|
|
|
|
|
|
|
|
|
|
|
# 调用 deepseek-chat 模型
|
|
|
|
# 调用 deepseek-chat 模型
|
|
|
|
response = client.chat.completions.create(
|
|
|
|
response = client.chat.completions.create(
|
|
|
@ -16,4 +17,4 @@ response = client.chat.completions.create(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# 输出响应内容
|
|
|
|
# 输出响应内容
|
|
|
|
print(response.choices[0].message.content)
|
|
|
|
print(response.choices[0].message.content)
|
|
|
|