|
from openai import OpenAI |
|
from pathlib import Path |
|
|
|
client = OpenAI( |
|
api_key='sk-h2mR3KYVzNPS3XR2LXlbZANLDtPAokf0Hb8OLsbnHkyKNjh2', |
|
base_url = 'https://api.moonshot.cn/v1', |
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file_object = client.files.create(file=Path("./image/3.png"), purpose="file-extract") |
|
|
|
file_content = client.files.content(file_id=file_object.id).text |
|
|
|
messages=[ |
|
{ |
|
"role": "system", |
|
"content": "你将收到一张聊天截图,该聊天截图反映了产品A使用过程中存在的一些问题。首先概述聊天内容,然后详细介绍产品中存在的问题,以方便后续工单的创建", |
|
}, |
|
{ |
|
"role": "system", |
|
"content": file_content, |
|
}, |
|
{"role": "user", |
|
"content": "整理这些文件的核心内容,给出其中产品问题的详细描述"}, |
|
] |
|
|
|
completion = client.chat.completions.create( |
|
model="moonshot-v1-32k", |
|
messages=messages, |
|
temperature=0.3, |
|
) |
|
|
|
print(completion.choices[0].message) |