File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -232,11 +232,12 @@ def generate_response(
232232 try :
233233 # Execute function call
234234 if functions != []:
235- response = openai_client .chat .completions .create (
236- messages = messages ,
237- functions = functions ,
238- ** self .args .dict (),
239- )
235+ async with async_openai_client :
236+ response = openai_client .chat .completions .create (
237+ messages = messages ,
238+ functions = functions ,
239+ ** self .args .dict (),
240+ )
240241
241242 logger .log_prompt (
242243 [
@@ -275,10 +276,11 @@ def generate_response(
275276 )
276277
277278 else :
278- response = openai_client .chat .completions .create (
279- messages = messages ,
280- ** self .args .dict (),
281- )
279+ async with async_openai_client :
280+ response = openai_client .chat .completions .create (
281+ messages = messages ,
282+ ** self .args .dict (),
283+ )
282284 logger .log_prompt (
283285 [
284286 {
You can’t perform that action at this time.
0 commit comments