@@ -27,6 +27,8 @@ def __new__(cls, value):
2727
2828
2929class LangTraceFile (io .BytesIO ):
30+ _host : str = os .environ .get ("LANGTRACE_API_HOST" , None ) or LANGTRACE_REMOTE_URL
31+
3032 def __init__ (self , fs : "LangTraceFileSystem" , path : str , mode : OpenMode ):
3133 super ().__init__ ()
3234 self .fs = fs
@@ -65,7 +67,7 @@ def upload_to_server(self, file_data: bytes) -> None:
6567 else :
6668 print (Fore .GREEN + "Sending results to Langtrace" + Fore .RESET )
6769 response = requests .post (
68- url = f"{ LANGTRACE_REMOTE_URL } /api/run" ,
70+ url = f"{ self . _host } /api/run" ,
6971 data = json .dumps (data ),
7072 headers = {
7173 "Content-Type" : "application/json" ,
@@ -80,6 +82,7 @@ def upload_to_server(self, file_data: bytes) -> None:
8082
8183
8284class LangTraceFileSystem (AbstractFileSystem ):
85+ _host : str = os .environ .get ("LANGTRACE_API_HOST" , None ) or LANGTRACE_REMOTE_URL
8386 protocol = "langtracefs"
8487 sep = "/"
8588
@@ -112,7 +115,7 @@ def fetch_file_from_api(self, dataset_id: str) -> bytes:
112115 + Fore .RESET
113116 )
114117 response = requests .get (
115- url = f"{ LANGTRACE_REMOTE_URL } /api/dataset/download?id={ dataset_id } " ,
118+ url = f"{ self . _host } /api/dataset/download?id={ dataset_id } " ,
116119 headers = {
117120 "Content-Type" : "application/json" ,
118121 "x-api-key" : os .environ .get ("LANGTRACE_API_KEY" ),
0 commit comments