Skip to content

Commit

Permalink
Fix error str (#23)
Browse files Browse the repository at this point in the history
* Update langchain_callback.py

* Update langchain_callback.py
  • Loading branch information
ykriger-newrelic authored Sep 10, 2023
1 parent 4de0227 commit 4c95c99
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/nr_openai_observability/langchain_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def on_chain_error(
self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any
) -> Any:
"""Run when chain errors."""
tags = {error: str(error)}
tags = {"error": str(error)}
span = self.spans_stack.pop()
assert span["attributes"]["name"] == "LlmChain"
self.finish_and_record_span(span, tags)
Expand Down Expand Up @@ -173,9 +173,7 @@ def on_tool_error(
self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any
) -> Any:
"""Run when tool errors."""
tags = {
"error": error,
}
tags = {"error": str(error)}
span = self.spans_stack.pop()
assert span["attributes"]["name"] == "LlmTool"
tool_name = kwargs.get("name")
Expand Down

0 comments on commit 4c95c99

Please sign in to comment.