File tree 1 file changed +11
-9
lines changed
1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -232,11 +232,12 @@ def generate_response(
232
232
try :
233
233
# Execute function call
234
234
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
+ )
240
241
241
242
logger .log_prompt (
242
243
[
@@ -275,10 +276,11 @@ def generate_response(
275
276
)
276
277
277
278
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
+ )
282
284
logger .log_prompt (
283
285
[
284
286
{
You can’t perform that action at this time.
0 commit comments