From 8137550589bbfed20e874b0c50fec5665dbde492 Mon Sep 17 00:00:00 2001 From: Shreya Shankar Date: Sat, 12 Oct 2024 12:31:57 -0700 Subject: [PATCH] fix: append to gleaning chat history --- docetl/operations/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docetl/operations/utils.py b/docetl/operations/utils.py index 2aceaf5e..f7313690 100644 --- a/docetl/operations/utils.py +++ b/docetl/operations/utils.py @@ -548,6 +548,13 @@ def _cached_call_llm( response = self._call_llm_with_cache( model, op_type, messages, output_schema, tools, scratchpad ) + parsed_output = self.parse_llm_response( + response, output_schema, tools + )[0] + validator_messages[-1] = [ + {"role": "assistant", "content": json.dumps(parsed_output)}, + ] + total_cost += completion_cost(response) validated = True