Skip to content

Commit 5992327

Browse files
authored
Merge pull request #209 from Scale3-Labs/development
Release Langtrace Filesystem Access through self hosting
2 parents 31ff531 + aa60509 commit 5992327

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/langtrace_python_sdk/extensions/langtrace_filesystem.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def __new__(cls, value):
2727

2828

2929
class 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

8284
class 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"),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.1.19"
1+
__version__ = "2.1.20"

0 commit comments

Comments
 (0)