File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
libs/e2e-tests/e2e_tests/test_utils Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
1
import logging
2
+ import os
2
3
import time
3
4
from typing import Callable
4
5
5
6
from langsmith import Client
6
7
7
- LANGSMITH_CLIENT = Client ()
8
+ if (
9
+ os .getenv ("LANGSMITH_API_KEY" , "" ).strip ()
10
+ or os .getenv ("LANGCHAIN_API_KEY" , "" ).strip ()
11
+ ):
12
+ LANGSMITH_CLIENT = Client ()
13
+ else :
14
+ LANGSMITH_CLIENT = None
8
15
9
16
10
17
def record_langsmith_sharelink (
11
18
run_id : str , record_property : Callable , tries : int = 6
12
19
) -> None :
13
20
try :
14
- sharelink = LANGSMITH_CLIENT .share_run (run_id )
21
+ sharelink = (
22
+ LANGSMITH_CLIENT .share_run (run_id ) if LANGSMITH_CLIENT else "deactivated"
23
+ )
15
24
record_property ("langsmith_url" , sharelink )
16
25
logging .info ("recorded langsmith link: %s" , sharelink )
17
26
except Exception :
You can’t perform that action at this time.
0 commit comments