Skip to content

Commit

Permalink
Auto Print URL (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Mar 3, 2024
1 parent e491536 commit 6e917c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/langsmith/run_helpers.py
Expand Up @@ -145,6 +145,11 @@ def _container_end(
outputs_ = outputs if isinstance(outputs, dict) else {"output": outputs}
run_tree.end(outputs=outputs_, error=error)
run_tree.patch()
if error:
try:
logger.info(f"See trace: {run_tree.get_url()}")
except Exception:
pass


def _collect_extra(extra_outer: dict, langsmith_extra: LangSmithExtra) -> dict:
Expand Down
4 changes: 4 additions & 0 deletions python/langsmith/run_trees.py
Expand Up @@ -241,3 +241,7 @@ def patch(self) -> None:
def wait(self) -> None:
"""Wait for all _futures to complete."""
pass

def get_url(self) -> str:
"""Return the URL of the run."""
return self.client.get_run_url(run=self)

0 comments on commit 6e917c4

Please sign in to comment.