Eric Botti
commited on
Commit
·
5c924a1
1
Parent(s):
63c7598
Except JSON Decoder Errors
Browse files- src/agent_interfaces.py +2 -1
src/agent_interfaces.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from typing import Type, NewType
|
2 |
import json
|
3 |
|
@@ -63,7 +64,7 @@ class BaseAgentInterface:
|
|
63 |
else:
|
64 |
output = output_format.model_validate_json(formatted_response.content)
|
65 |
|
66 |
-
except ValidationError as e:
|
67 |
if retries > max_retries:
|
68 |
raise e
|
69 |
retry_message = Message(type="retry", content=f"Error formatting response: {e} \n\n Please try again.")
|
|
|
1 |
+
from json import JSONDecodeError
|
2 |
from typing import Type, NewType
|
3 |
import json
|
4 |
|
|
|
64 |
else:
|
65 |
output = output_format.model_validate_json(formatted_response.content)
|
66 |
|
67 |
+
except ValidationError or JSONDecodeError as e:
|
68 |
if retries > max_retries:
|
69 |
raise e
|
70 |
retry_message = Message(type="retry", content=f"Error formatting response: {e} \n\n Please try again.")
|