Skip to content

Commit 94fd28f

Browse files
committed
cleanup
1 parent 9b09474 commit 94fd28f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

sentry_sdk/integrations/langchain.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ def on_llm_start(
256256
all_params.update(serialized.get("kwargs", {}))
257257

258258
watched_span = self._create_span(
259-
run_id,
260-
kwargs.get("parent_run_id"),
259+
run_id=run_id,
260+
parent_id=kwargs.get("parent_run_id"),
261261
op=OP.GEN_AI_PIPELINE,
262262
name=kwargs.get("name") or "Langchain LLM call",
263263
origin=LangchainIntegration.origin,
@@ -292,8 +292,8 @@ def on_chat_model_start(self, serialized, messages, *, run_id, **kwargs):
292292
)
293293

294294
watched_span = self._create_span(
295-
run_id,
296-
kwargs.get("parent_run_id"),
295+
run_id=run_id,
296+
parent_id=kwargs.get("parent_run_id"),
297297
op=OP.GEN_AI_CHAT,
298298
name=f"chat {model}".strip(),
299299
origin=LangchainIntegration.origin,
@@ -324,7 +324,6 @@ def on_chat_model_end(self, response, *, run_id, **kwargs):
324324
with capture_internal_exceptions():
325325
if not run_id:
326326
return
327-
328327
token_usage = None
329328

330329
# Try multiple paths to extract token usage, prioritizing streaming-aware approaches
@@ -479,8 +478,8 @@ def on_agent_action(self, action, *, run_id, **kwargs):
479478
if not run_id:
480479
return
481480
watched_span = self._create_span(
482-
run_id,
483-
kwargs.get("parent_run_id"),
481+
run_id=run_id,
482+
parent_id=kwargs.get("parent_run_id"),
484483
op=OP.GEN_AI_INVOKE_AGENT,
485484
name=action.tool or "AI tool usage",
486485
origin=LangchainIntegration.origin,
@@ -519,8 +518,8 @@ def on_tool_start(self, serialized, input_str, *, run_id, **kwargs):
519518
tool_name = serialized.get("name") or kwargs.get("name") or ""
520519

521520
watched_span = self._create_span(
522-
run_id,
523-
kwargs.get("parent_run_id"),
521+
run_id=run_id,
522+
parent_id=kwargs.get("parent_run_id"),
524523
op=OP.GEN_AI_EXECUTE_TOOL,
525524
name=f"execute_tool {tool_name}".strip(),
526525
origin=LangchainIntegration.origin,

0 commit comments

Comments
 (0)