Skip to content

Commit

Permalink
Add a new opcode for top level langchain runs
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-sentry committed Apr 15, 2024
1 parent 4ee01ec commit d787b6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ class OP:
MIDDLEWARE_STARLITE_SEND = "middleware.starlite.send"
OPENAI_CHAT_COMPLETIONS_CREATE = "ai.chat_completions.create.openai"
OPENAI_EMBEDDINGS_CREATE = "ai.embeddings.create.openai"
LANGCHAIN_PIPELINE = "ai.pipeline.langchain"
LANGCHAIN_RUN = "ai.run.langchain"
LANGCHAIN_TOOL = "ai.tool.langchain"
LANGCHAIN_AGENT = "ai.agent.langchain"
Expand Down
6 changes: 5 additions & 1 deletion sentry_sdk/integrations/langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ def on_chain_start(self, serialized, inputs, *, run_id, **kwargs):
span = self._create_span(
run_id,
kwargs.get("parent_run_id"),
op=OP.LANGCHAIN_RUN,
op=(
OP.LANGCHAIN_RUN
if kwargs.get("parent_run_id") is not None
else OP.LANGCHAIN_PIPELINE
),
description=kwargs.get("name") or "Chain execution",
)
metadata = kwargs.get("metadata")
Expand Down

0 comments on commit d787b6b

Please sign in to comment.