Skip to content

Commit

Permalink
fix: change gleaning prompt to validation_prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyashankar committed Oct 13, 2024
1 parent 652efad commit 7635afa
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 5 additions & 6 deletions docetl/operations/utils.py
Original file line number Diff line number Diff line change
@@ -486,9 +486,7 @@ def _cached_call_llm(
}
]
+ messages
+ [
{"role": "assistant", "content": json.dumps(parsed_output)},
]
+ [{"role": "assistant", "content": json.dumps(parsed_output)}]
)

for rnd in range(num_gleaning_rounds):
@@ -553,9 +551,10 @@ def _cached_call_llm(
parsed_output = self.parse_llm_response(
response, output_schema, tools
)[0]
validator_messages[-1] = [
{"role": "assistant", "content": json.dumps(parsed_output)},
]
validator_messages[-1] = {
"role": "assistant",
"content": json.dumps(parsed_output),
}

total_cost += completion_cost(response)

3 changes: 2 additions & 1 deletion tests/basic/test_basic_map.py
Original file line number Diff line number Diff line change
@@ -191,9 +191,10 @@ def test_map_operation_with_gleaning(simple_map_config, map_sample_data, api_wra
map_config_with_gleaning = {
**simple_map_config,
"gleaning": {
"num_rounds": 1,
"num_rounds": 2,
"validation_prompt": "Review the sentiment analysis. Is it accurate? If not, suggest improvements.",
},
"bypass_cache": True,
}

operation = MapOperation(api_wrapper, map_config_with_gleaning, "gpt-4o-mini", 4)

0 comments on commit 7635afa

Please sign in to comment.