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.
|
|
|
|
# coding=utf-8
|
|
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
import json
|
|
|
|
|
|
|
|
|
|
import urllib3
|
|
|
|
|
|
|
|
|
|
from Config import *
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
# 禁止警告
|
|
|
|
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
|
|
|
|
|
|
|
|
# Send request.
|
|
|
|
|
headers = {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
'Authorization': 'Bearer ' + HW_API_KEY # 把yourApiKey替换成真实的API Key
|
|
|
|
|
}
|
|
|
|
|
# 系统提示词
|
|
|
|
|
system_prompt = '''回答以下内容:
|
|
|
|
|
1. 这道题目有哪些知识点,哪些能力点
|
|
|
|
|
2. 生成Neo4j 5.26.2的插入语句'''
|
|
|
|
|
|
|
|
|
|
shiti_content = '''
|
|
|
|
|
下面是一道小学三年级的数学题目,巧求周长:
|
|
|
|
|
把7个完全相同的小长方形拼成如图的样子,已知每个小长方形的长是10厘米,则拼成的大长方形的周长是多少厘米?
|
|
|
|
|
'''
|
|
|
|
|
data = {
|
|
|
|
|
"model": HW_MODEL_NAME,
|
|
|
|
|
"max_tokens": 10000,
|
|
|
|
|
"messages": [
|
|
|
|
|
{"role": "system", "content": system_prompt},
|
|
|
|
|
{"role": "user", "content": shiti_content}
|
|
|
|
|
],
|
|
|
|
|
"stream": False,
|
|
|
|
|
"temperature": 1.0
|
|
|
|
|
}
|
|
|
|
|
resp = requests.post(HW_API_URL, headers=headers, data=json.dumps(data), verify=False)
|
|
|
|
|
|
|
|
|
|
# Print result.
|
|
|
|
|
print(resp.status_code)
|
|
|
|
|
print(resp.text)
|