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).
pull/6844/head
Reinier van der Leer 2024-02-14 11:17:34 +01:00
parent 88bbdfc7fc
commit 22aba6dd8a
No known key found for this signature in database
GPG Key ID: CDC1180FDAE06193
1 changed files with 1 additions and 0 deletions

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}")
)