@@ -40,6 +40,12 @@ def query_city_weather(self, city):
40
40
st .markdown (
41
41
f"**{ cast ['date' ]} ** :`dayweather`:{ cast ['dayweather' ]} ,`nightweather`:{ cast ['nightweather' ]} , `daytemp`: { cast ['daytemp' ]} , `nighttemp`:{ cast ['nighttemp' ]} " )
42
42
43
+ @staticmethod
44
+ def send_email (to_email , title , body ):
45
+ st .markdown (f"Recipient:{ to_email } " )
46
+ st .markdown (f"Email Title:{ title } " )
47
+ st .markdown (f"Email Body:{ body } " )
48
+
43
49
44
50
def call_gpt (user_input ):
45
51
"""
@@ -53,25 +59,48 @@ def call_gpt(user_input):
53
59
"""
54
60
messages = [{"role" : "user" , "content" : user_input }]
55
61
56
- function = {
57
- "name" : "query_city_weather" ,
58
- "description" : "query weather temperature" ,
59
- "parameters" : {
60
- "type" : "object" ,
61
- "properties" : {
62
- "city" : {
63
- "type" : "string" ,
64
- "description" : "The city" ,
62
+ function = [
63
+ {
64
+ "name" : "query_city_weather" ,
65
+ "description" : "query weather temperature" ,
66
+ "parameters" : {
67
+ "type" : "object" ,
68
+ "properties" : {
69
+ "city" : {
70
+ "type" : "string" ,
71
+ "description" : "The city" ,
72
+ },
65
73
},
74
+ "required" : ["city" ],
66
75
},
67
- "required" : ["city" ],
68
76
},
69
- }
77
+ {
78
+ "name" : "send_email" ,
79
+ "description" : "Send email information" ,
80
+ "parameters" : {
81
+ "type" : "object" ,
82
+ "properties" : {
83
+ "to_email" : {
84
+ "type" : "string" ,
85
+ "description" : "Recipient's email address"
86
+ },
87
+ "title" : {
88
+ "type" : "string" ,
89
+ "description" : "The title of the email"
90
+ },
91
+ "body" : {
92
+ "type" : "string" ,
93
+ "description" : "The Body of the email"
94
+ }
95
+ }
96
+ }
97
+ }
98
+ ]
70
99
71
100
completion = openai .ChatCompletion .create (
72
101
model = "gpt-3.5-turbo-0613" ,
73
102
messages = messages ,
74
- functions = [ function ] ,
103
+ functions = function ,
75
104
function_call = "auto" ,
76
105
)
77
106
return completion .choices [0 ].message
@@ -99,4 +128,4 @@ def call_gpt(user_input):
99
128
method_args_dict = json .loads (method_args )
100
129
101
130
method = getattr (skills_list_obj , method_name )
102
- method (method_args_dict [ 'city' ] )
131
+ method (** method_args_dict )
0 commit comments