Skip to content

Commit adaabbf

Browse files
committed
.
1 parent dd166a8 commit adaabbf

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

sentry_sdk/integrations/langchain.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ def on_llm_start(
257257
):
258258
# type: (SentryLangchainCallback, Dict[str, Any], List[str], UUID, Optional[List[str]], Optional[UUID], Optional[Dict[str, Any]], Any) -> Any
259259
"""Run when LLM starts running."""
260-
# import ipdb; ipdb.set_trace()
261260
with capture_internal_exceptions():
262261
if not run_id:
263262
return
@@ -287,7 +286,6 @@ def on_llm_start(
287286
def on_chat_model_start(self, serialized, messages, *, run_id, **kwargs):
288287
# type: (SentryLangchainCallback, Dict[str, Any], List[List[BaseMessage]], UUID, Any) -> Any
289288
"""Run when Chat Model starts running."""
290-
# import ipdb; ipdb.set_trace()
291289
with capture_internal_exceptions():
292290
if not run_id:
293291
return
@@ -329,7 +327,6 @@ def on_chat_model_start(self, serialized, messages, *, run_id, **kwargs):
329327
def on_chat_model_end(self, response, *, run_id, **kwargs):
330328
# type: (SentryLangchainCallback, LLMResult, UUID, Any) -> Any
331329
"""Run when Chat Model ends running."""
332-
# import ipdb; ipdb.set_trace()
333330
with capture_internal_exceptions():
334331
if not run_id:
335332
return
@@ -398,7 +395,6 @@ def on_llm_new_token(self, token, *, run_id, **kwargs):
398395
def on_llm_end(self, response, *, run_id, **kwargs):
399396
# type: (SentryLangchainCallback, LLMResult, UUID, Any) -> Any
400397
"""Run when LLM ends running."""
401-
# import ipdb; ipdb.set_trace()
402398
with capture_internal_exceptions():
403399
if not run_id:
404400
return
@@ -454,27 +450,23 @@ def on_llm_end(self, response, *, run_id, **kwargs):
454450
def on_llm_error(self, error, *, run_id, **kwargs):
455451
# type: (SentryLangchainCallback, Union[Exception, KeyboardInterrupt], UUID, Any) -> Any
456452
"""Run when LLM errors."""
457-
# import ipdb; ipdb.set_trace()
458453
with capture_internal_exceptions():
459454
self._handle_error(run_id, error)
460455

461456
def on_chat_model_error(self, error, *, run_id, **kwargs):
462457
# type: (SentryLangchainCallback, Union[Exception, KeyboardInterrupt], UUID, Any) -> Any
463458
"""Run when Chat Model errors."""
464-
# import ipdb; ipdb.set_trace()
465459
with capture_internal_exceptions():
466460
self._handle_error(run_id, error)
467461

468462
def on_chain_start(self, serialized, inputs, *, run_id, **kwargs):
469463
# type: (SentryLangchainCallback, Dict[str, Any], Dict[str, Any], UUID, Any) -> Any
470464
"""Run when chain starts running."""
471-
# import ipdb; ipdb.set_trace()
472465
pass
473466

474467
def on_chain_end(self, outputs, *, run_id, **kwargs):
475468
# type: (SentryLangchainCallback, Dict[str, Any], UUID, Any) -> Any
476469
"""Run when chain ends running."""
477-
# import ipdb; ipdb.set_trace()
478470
with capture_internal_exceptions():
479471
if not run_id or run_id not in self.span_map:
480472
return
@@ -487,12 +479,10 @@ def on_chain_end(self, outputs, *, run_id, **kwargs):
487479
def on_chain_error(self, error, *, run_id, **kwargs):
488480
# type: (SentryLangchainCallback, Union[Exception, KeyboardInterrupt], UUID, Any) -> Any
489481
"""Run when chain errors."""
490-
# import ipdb; ipdb.set_trace()
491482
self._handle_error(run_id, error)
492483

493484
def on_agent_action(self, action, *, run_id, **kwargs):
494485
# type: (SentryLangchainCallback, AgentAction, UUID, Any) -> Any
495-
# import ipdb; ipdb.set_trace()
496486
with capture_internal_exceptions():
497487
if not run_id:
498488
return
@@ -512,7 +502,6 @@ def on_agent_action(self, action, *, run_id, **kwargs):
512502

513503
def on_agent_finish(self, finish, *, run_id, **kwargs):
514504
# type: (SentryLangchainCallback, AgentFinish, UUID, Any) -> Any
515-
# import ipdb; ipdb.set_trace()
516505
with capture_internal_exceptions():
517506
if not run_id:
518507
return
@@ -577,12 +566,12 @@ def on_tool_end(self, output, *, run_id, **kwargs):
577566
def on_tool_error(self, error, *args, run_id, **kwargs):
578567
# type: (SentryLangchainCallback, Union[Exception, KeyboardInterrupt], UUID, Any) -> Any
579568
"""Run when tool errors."""
580-
# import ipdb; ipdb.set_trace()
581-
# TODO(shellmayr): how to correctly set the status when the toolfails
569+
# TODO(shellmayr): how to correctly set the status when the tool fails?
582570
if run_id and run_id in self.span_map:
583571
span_data = self.span_map[run_id]
584572
if span_data:
585573
span_data.span.set_status("unknown")
574+
586575
self._handle_error(run_id, error)
587576

588577

0 commit comments

Comments
 (0)