Skip to content

Commit

Permalink
Deactivate LangSmith
Browse files Browse the repository at this point in the history
  • Loading branch information
cbornet committed Jul 23, 2024
1 parent 146f987 commit 242981c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions libs/e2e-tests/e2e_tests/test_utils/tracing.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
import logging
import os
import time
from typing import Callable

from langsmith import Client

LANGSMITH_CLIENT = Client()
if (
os.getenv("LANGSMITH_API_KEY", "").strip()
or os.getenv("LANGCHAIN_API_KEY", "").strip()
):
LANGSMITH_CLIENT = Client()
else:
LANGSMITH_CLIENT = None


def record_langsmith_sharelink(
run_id: str, record_property: Callable, tries: int = 6
) -> None:
try:
sharelink = LANGSMITH_CLIENT.share_run(run_id)
sharelink = (
LANGSMITH_CLIENT.share_run(run_id) if LANGSMITH_CLIENT else "deactivated"
)
record_property("langsmith_url", sharelink)
logging.info("recorded langsmith link: %s", sharelink)
except Exception:
Expand Down

0 comments on commit 242981c

Please sign in to comment.