mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 11:33:14 +00:00
fix: update LangSmith trace URL format to use peek query params (#1213)
This commit is contained in:
parent
e9b94ac8ba
commit
92a6c256f4
1 changed files with 5 additions and 5 deletions
|
|
@ -8,8 +8,8 @@ import os
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _compose_langsmith_url_base() -> str:
|
||||
"""Build the LangSmith URL base from environment variables."""
|
||||
def _compose_langsmith_project_url() -> str:
|
||||
"""Build the LangSmith project URL base from environment variables."""
|
||||
host_url = os.environ.get("LANGSMITH_URL_PROD", "https://smith.langchain.com")
|
||||
tenant_id = os.environ.get("LANGSMITH_TENANT_ID_PROD")
|
||||
project_id = os.environ.get("LANGSMITH_TRACING_PROJECT_ID_PROD")
|
||||
|
|
@ -17,14 +17,14 @@ def _compose_langsmith_url_base() -> str:
|
|||
raise ValueError(
|
||||
"LANGSMITH_TENANT_ID_PROD and LANGSMITH_TRACING_PROJECT_ID_PROD must be set"
|
||||
)
|
||||
return f"{host_url}/o/{tenant_id}/projects/p/{project_id}/r"
|
||||
return f"{host_url}/o/{tenant_id}/projects/p/{project_id}"
|
||||
|
||||
|
||||
def get_langsmith_trace_url(run_id: str) -> str | None:
|
||||
"""Build the LangSmith trace URL for a given run ID."""
|
||||
try:
|
||||
url_base = _compose_langsmith_url_base()
|
||||
return f"{url_base}/{run_id}?poll=true"
|
||||
base = _compose_langsmith_project_url()
|
||||
return f"{base}?peek={run_id}&peeked_trace={run_id}"
|
||||
except Exception: # noqa: BLE001
|
||||
logger.warning("Failed to build LangSmith trace URL for run %s", run_id, exc_info=True)
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue