@@ -50,7 +50,7 @@ def send_email(to_email, title, body):
50
50
51
51
def call_gpt (user_input ):
52
52
"""
53
- Make a ChatCompletion API call to OpenAI GPT-3.5-turbo model.
53
+ Make a ChatCompletion API call to OpenAI GPT-3.5-turbo-0613 model.
54
54
55
55
Args:
56
56
user_input (str): The user's prompt or input text.
@@ -62,9 +62,9 @@ def call_gpt(user_input):
62
62
63
63
function = [
64
64
{
65
- "name" : "query_city_weather" ,
66
- "description" : "query weather temperature" ,
67
- "parameters" : {
65
+ "name" : "query_city_weather" ,# Function Name
66
+ "description" : "query weather temperature" ,# Meta information of function
67
+ "parameters" : {# parameters
68
68
"type" : "object" ,
69
69
"properties" : {
70
70
"city" : {
@@ -93,15 +93,17 @@ def call_gpt(user_input):
93
93
"type" : "string" ,
94
94
"description" : "The Body of the email"
95
95
}
96
- }
96
+ },
97
+ "required" : ["to_email" , "title" , "body" ],
97
98
}
98
99
}
99
100
]
100
101
101
102
completion = openai .ChatCompletion .create (
102
- model = "gpt-3.5-turbo-0613" ,
103
+ model = "gpt-3.5-turbo-0613" ,# gpt-4-0613
103
104
messages = messages ,
104
- functions = function ,
105
+ functions = function , # Receive a list of functions
106
+ # Indicates whether the OpenAI model should use the functions in the function list, set to auto, which means that the AI model should guess by itself.
105
107
function_call = "auto" ,
106
108
)
107
109
0 commit comments