Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Print URL #483

Merged
merged 5 commits into from Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)