Skip to content

Commit

Permalink
chore: better logging (#262)
Browse files Browse the repository at this point in the history
* rebrand to docwrangler

* refactor: rebranding to docwrangler

* refactor: rebranding to docwrangler

* refactor: edit vercel.json

* fix: map optimizer should work

* docs: update playground docs

* chore: more thorough logging
  • Loading branch information
shreyashankar authored Jan 3, 2025
1 parent f38fbb8 commit 242ae05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docetl/operations/utils/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def _parse_llm_response_helper(
for tool_call in tool_calls:
if response.choices[0].finish_reason == "content_filter":
raise InvalidOutputError(
"Content filter triggered in LLM response",
"Content filter triggered by LLM provider.",
"",
schema,
response.choices,
Expand Down
10 changes: 8 additions & 2 deletions docetl/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ def execute_step(
else:
input_data, cost = operation_instance.execute(input_data)
total_cost += cost
step_content += f"[green]✓[/green] Operation [cyan]{operation_name}[/cyan] completed (Cost: [green]${cost:.2f}[/green])\n"
step_content += f"[green]✓[/green] Operation [cyan]{operation_name}[/cyan] (Cost: [green]${cost:.2f}[/green])\n"
self.console.print(f"[green]✓[/green] Operation [cyan]{operation_name}[/cyan] completed (Cost: [green]${cost:.2f}[/green])")

# Checkpoint after each operation
if self.intermediate_dir:
Expand Down Expand Up @@ -442,7 +443,12 @@ def _load_from_checkpoint_if_exists(
self.datasets[f"{step_name}_{operation_name}"] = Dataset(
self, "file", checkpoint_path, "local"
)
return self.datasets[f"{step_name}_{operation_name}"].load()

self.console.print(
f"[green]✓[/green] [italic]Loaded checkpoint for operation '{operation_name}' in step '{step_name}' from {checkpoint_path}[/italic]"
)

return self.datasets[f"{step_name}_{operation_name}"].load()
return None

def clear_intermediate(self) -> None:
Expand Down

0 comments on commit 242ae05

Please sign in to comment.