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