Skip to content

Commit

Permalink
Fix 'completion' referenced before assignment (#800)
Browse files Browse the repository at this point in the history
- Fixes `UnboundLocalError("local variable 'completion' referenced before assignment")` error in LangchainTracer.on_llm_end callback
  • Loading branch information
fgiuba authored Mar 21, 2024
1 parent b514fc1 commit bfec62b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions backend/chainlit/langchain/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ def _on_run_update(self, run: Run) -> None:

current_step.language = "json"
current_step.output = json.dumps(message_completion)
completion = message_completion.get("content", "")
else:
completion_start = self.completion_generations[str(run.id)]
completion = generation.get("text", "")
Expand Down

0 comments on commit bfec62b

Please sign in to comment.