Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7bcc3f4

Browse files
committed
feat(use-example): add notes
1 parent 8127509 commit 7bcc3f4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

‎main.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def send_email(to_email, title, body):
5050

5151
def call_gpt(user_input):
5252
"""
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.
5454
5555
Args:
5656
user_input (str): The user's prompt or input text.
@@ -62,9 +62,9 @@ def call_gpt(user_input):
6262

6363
function = [
6464
{
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
6868
"type": "object",
6969
"properties": {
7070
"city": {
@@ -93,15 +93,17 @@ def call_gpt(user_input):
9393
"type": "string",
9494
"description": "The Body of the email"
9595
}
96-
}
96+
},
97+
"required": ["to_email", "title", "body"],
9798
}
9899
}
99100
]
100101

101102
completion = openai.ChatCompletion.create(
102-
model="gpt-3.5-turbo-0613",
103+
model="gpt-3.5-turbo-0613",# gpt-4-0613
103104
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.
105107
function_call="auto",
106108
)
107109

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /