AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(agent/core): Format parse errors for log statement in `OpenAIProvider.create_chat_completion`
Reinier van der Leer8f0d5c73b3f0
diff --git a/autogpts/autogpt/autogpt/core/resource/model_providers/openai.py b/autogpts/autogpt/autogpt/core/resource/model_providers/openai.pyindex 8a3546a36e..0e50f1fa36 100644--- a/autogpts/autogpt/autogpt/core/resource/model_providers/openai.py+++ b/autogpts/autogpt/autogpt/core/resource/model_providers/openai.py@@ -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}"),})