Skip to content

Commit bc90d45

Browse files
committed
Update functions.py
1 parent 50365ee commit bc90d45

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

async_openai/types/functions.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@ def parse_response(
505505
result = schema.model_validate(response.function_results[0].arguments, from_attributes = True)
506506
result._set_values_from_response(response, name = self.name if include_name else None)
507507
return result
508+
except IndexError as e:
509+
self.autologger.error(f"[{self.name} - {response.model} - {response.usage}] No function results found: {e}\n{response.text}")
510+
return None
508511
except Exception as e:
509512
self.autologger.error(f"[{self.name} - {response.model} - {response.usage}] Failed to parse object: {e}\n{response.text}\n{response.function_results[0].arguments}")
510513
try:
@@ -688,6 +691,7 @@ def run_function_loop(
688691
chat = chat,
689692
messages = messages,
690693
model = model,
694+
cachable = False,
691695
**kwargs,
692696
)
693697
result = self.parse_response(response, include_name = True)
@@ -698,7 +702,8 @@ def run_function_loop(
698702
name = self.name,
699703
func_name = self.name,
700704
model = model,
701-
attempts = self.max_attempts,
705+
attempts = attempts,
706+
max_attempts = self.max_attempts,
702707
)
703708
return None
704709

@@ -732,6 +737,7 @@ async def arun_function_loop(
732737
chat = chat,
733738
messages = messages,
734739
model = model,
740+
cachable = False,
735741
**kwargs,
736742
)
737743
result = self.parse_response(response, include_name = True)
@@ -742,7 +748,8 @@ async def arun_function_loop(
742748
name = self.name,
743749
func_name = self.name,
744750
model = model,
745-
attempts = self.max_attempts,
751+
attempts = attempts,
752+
max_attempts = self.max_attempts,
746753
)
747754
return None
748755

0 commit comments

Comments
 (0)