赞
踩
需求:从订单表中查询各种信息,比如某个用户的订单数量、某个商品的销量、某个用户的消费总额等等。
def get_sql_completion(messages, model="gpt-3.5-turbo"):
response = openai.ChatCompletion.create(
model=model,
messages=messages,
temperature=0, # 模型输出的随机性,0 表示随机性最小
function_call="auto",
functions=[{ # 摘自 OpenAI 官方示例 https://github.com/openai/openai-cookbook/blob/main/examples/How_to_call_functions_with_chat_models.ipynb
"name": "ask_database",
"description": "Use this function to answer user questions about business. Output should be a fully formed SQL query.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type&
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。