You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
927 B
28 lines
927 B
from openai import OpenAI
|
|
|
|
# 阿里云中用来调用 deepseek v3 的密钥
|
|
MODEL_API_KEY = "sk-01d13a39e09844038322108ecdbd1bbc"
|
|
MODEL_NAME = "deepseek-v3"
|
|
|
|
# 初始化 OpenAI 客户端
|
|
client = OpenAI(
|
|
api_key=MODEL_API_KEY,
|
|
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
)
|
|
user_input = """
|
|
请根据以下需求生成 GeoGebra 命令:
|
|
帮我设计一个给小学学生讲解勾股定理证明的脚本,不要输出注释。
|
|
请以 GeoGebra 脚本的形式返回命令,一行一行输出。
|
|
"""
|
|
|
|
# 调用阿里云 API 获取文本内容
|
|
completion = client.chat.completions.create(
|
|
model=MODEL_NAME,
|
|
messages=[
|
|
{"role": "system", "content": "You are a helpful assistant that generates GeoGebra commands."},
|
|
{"role": "user", "content": user_input}
|
|
],
|
|
timeout=6000)
|
|
text_content = completion.choices[0].message.content
|
|
print(text_content)
|