mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 15:17:59 -05:00
fix(agent/core): Format parse errors for log statement in OpenAIProvider.create_chat_completion
This commit is contained in:
@@ -465,8 +465,11 @@ class OpenAIProvider(
|
||||
self._logger.debug(
|
||||
f"Parsing failed on response: '''{_assistant_msg}'''"
|
||||
)
|
||||
parse_errors_fmt = "\n\n".join(
|
||||
f"{e.__class__.__name__}: {e}" for e in parse_errors
|
||||
)
|
||||
self._logger.warning(
|
||||
f"Parsing attempt #{attempts} failed: {parse_errors}"
|
||||
f"Parsing attempt #{attempts} failed: {parse_errors_fmt}"
|
||||
)
|
||||
for e in parse_errors:
|
||||
sentry_sdk.capture_exception(
|
||||
@@ -480,10 +483,7 @@ class OpenAIProvider(
|
||||
{
|
||||
"role": "system",
|
||||
"content": (
|
||||
"ERROR PARSING YOUR RESPONSE:\n\n"
|
||||
+ "\n\n".join(
|
||||
f"{e.__class__.__name__}: {e}" for e in parse_errors
|
||||
)
|
||||
f"ERROR PARSING YOUR RESPONSE:\n\n{parse_errors_fmt}"
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user