fix(agent/llm): Include bad response in parse-fix prompt in OpenAIProvider.create_chat_completion

Apparently I forgot to also append the response that caused the parse error before throwing it back to the LLM and letting it fix its mistake(s).
This commit is contained in:
Reinier van der Leer
2024-02-14 11:17:34 +01:00
parent 88bbdfc7fc
commit 22aba6dd8a

View File

@@ -466,6 +466,7 @@ class OpenAIProvider(
extras={"assistant_msg": assistant_msg, "i_attempt": attempts},
)
if attempts < self._configuration.fix_failed_parse_tries:
model_prompt.append(assistant_msg)
model_prompt.append(
ChatMessage.system(f"ERROR PARSING YOUR RESPONSE:\n\n{e}")
)