langtrace-python-sdk 1.2.21__py3-none-any.whl → 1.2.23__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- LANGTRACE_REMOTE_URL = "https://langtrace.ai/api/trace"
1
+ LANGTRACE_REMOTE_URL = "https://langtrace.ai"
@@ -2,13 +2,12 @@ import json
2
2
  import os
3
3
  import typing
4
4
 
5
- from langtrace_python_sdk.constants.exporter.langtrace_exporter import (
6
- LANGTRACE_REMOTE_URL,
7
- )
8
5
  import requests
9
6
  from opentelemetry.sdk.trace.export import ReadableSpan, SpanExporter, SpanExportResult
10
7
  from opentelemetry.trace.span import format_trace_id
11
8
 
9
+ from langtrace_python_sdk.constants.exporter.langtrace_exporter import LANGTRACE_REMOTE_URL
10
+
12
11
 
13
12
  class LangTraceExporter(SpanExporter):
14
13
  """
@@ -49,9 +48,10 @@ class LangTraceExporter(SpanExporter):
49
48
  api_key: str
50
49
  write_to_remote_url: bool
51
50
 
52
- def __init__(self, api_key: str = None, write_to_remote_url: bool = False) -> None:
53
- self.api_key = api_key if api_key else os.environ.get("LANGTRACE_API_KEY")
51
+ def __init__(self, api_key: str = None, write_to_remote_url: bool = False, api_host: typing.Optional[str] = None) -> None:
52
+ self.api_key = api_key or os.environ.get("LANGTRACE_API_KEY")
54
53
  self.write_to_remote_url = write_to_remote_url
54
+ self.api_host: str = api_host or LANGTRACE_REMOTE_URL
55
55
 
56
56
  if self.write_to_remote_url and not self.api_key:
57
57
  raise ValueError("No API key provided")
@@ -66,7 +66,6 @@ class LangTraceExporter(SpanExporter):
66
66
  Returns:
67
67
  The result of the export SUCCESS or FAILURE
68
68
  """
69
-
70
69
  data = [
71
70
  {
72
71
  "traceId": format_trace_id(span.get_span_context().trace_id),
@@ -86,7 +85,7 @@ class LangTraceExporter(SpanExporter):
86
85
  # Send data to remote URL
87
86
  try:
88
87
  requests.post(
89
- url=LANGTRACE_REMOTE_URL,
88
+ url=f"{self.api_host}/api/trace",
90
89
  data=json.dumps(data),
91
90
  headers={"Content-Type": "application/json", "x-api-key": self.api_key},
92
91
  )
@@ -1,4 +1,4 @@
1
-
1
+ from typing import Optional
2
2
  from opentelemetry import trace
3
3
  from opentelemetry.sdk.trace import TracerProvider
4
4
  from opentelemetry.sdk.trace.export import (
@@ -40,12 +40,12 @@ def init(
40
40
  write_to_langtrace_cloud: bool = True,
41
41
  debug_log_to_console: bool = False,
42
42
  custom_remote_exporter=None,
43
+ api_host: Optional[str] = None,
43
44
  ):
44
-
45
45
  provider = TracerProvider()
46
46
 
47
47
  remote_write_exporter = (
48
- LangTraceExporter(api_key, write_to_langtrace_cloud)
48
+ LangTraceExporter(api_key, write_to_langtrace_cloud, api_host=api_host)
49
49
  if custom_remote_exporter is None
50
50
  else custom_remote_exporter
51
51
  )
@@ -1 +1 @@
1
- __version__ = "1.2.21"
1
+ __version__ = "1.2.23"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: langtrace-python-sdk
3
- Version: 1.2.21
3
+ Version: 1.2.23
4
4
  Summary: Python SDK for LangTrace
5
5
  Project-URL: Homepage, https://github.com/Scale3-Labs/langtrace-python-sdk
6
6
  Author-email: Scale3 Labs <engineering@scale3labs.com>
@@ -17,10 +17,10 @@ examples/openai/images_generate.py,sha256=ZioxTuHKE_yYlhpESqXKVzdkiwdegkmLVB7N8T
17
17
  examples/pinecone_example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  examples/pinecone_example/basic.py,sha256=hdV6-5Fmol9zeyFzDtdabD62vkqUJ4lCHG2YcVNpIpI,933
19
19
  langtrace_python_sdk/__init__.py,sha256=SlHg447-nQBbw8exRNJP_OyHUZ39Sldb7aaQ35hIRm8,262
20
- langtrace_python_sdk/langtrace.py,sha256=sWC7WqbOdOUB1sZ_hzLZVp0_Q8fBTRJRMUvOPyO6f20,3170
21
- langtrace_python_sdk/version.py,sha256=3uF8dV6igE_qWszFViblw_rtJOgCwoi-rVuWcQrSR0A,23
20
+ langtrace_python_sdk/langtrace.py,sha256=0gT4eCn8-hSSfI-B5zxUmd7weHvuCsnS4B7N4EmFzHs,3251
21
+ langtrace_python_sdk/version.py,sha256=y_Ev8AcJxzZe4ZJWlW3Wsver97OJUqU1nFSDqHzKBDw,23
22
22
  langtrace_python_sdk/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=OfgvphRBPENwsAizqzka9lFu9aDw-A7ErYJ0atl3bpI,56
23
+ langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=5MNjnAOg-4am78J3gVMH6FSwq5N8TOj72ugkhsw4vi0,46
24
24
  langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  langtrace_python_sdk/constants/instrumentation/anthropic.py,sha256=YX3llt3zwDY6XrYk3CB8WEVqgrzRXEw_ffyk56JoF3k,126
26
26
  langtrace_python_sdk/constants/instrumentation/chroma.py,sha256=hiPGYdHS0Yj4Kh3eaYBbuCAl_swqIygu80yFqkOgdak,955
@@ -28,7 +28,7 @@ langtrace_python_sdk/constants/instrumentation/common.py,sha256=KzNCWEl_44pkZ5Dc
28
28
  langtrace_python_sdk/constants/instrumentation/openai.py,sha256=9VF6ic9Ed3bpSvdp6iNmrpx2Ppo6DPav3hoUcqSQSv0,1048
29
29
  langtrace_python_sdk/constants/instrumentation/pinecone.py,sha256=Xaqqw-xBO0JJLGk75hiCUQGztNm0HiVaLQvjtYK7VJM,472
30
30
  langtrace_python_sdk/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- langtrace_python_sdk/extensions/langtrace_exporter.py,sha256=dEMSwkbqVMMToD6mH1m3x4i0Dk0g4I8-oNhOmoFZDBA,3980
31
+ langtrace_python_sdk/extensions/langtrace_exporter.py,sha256=K-grSUEBkSGfo_LwyyZDr_iz3oDy1mHnx34FfD-qFSQ,4067
32
32
  langtrace_python_sdk/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  langtrace_python_sdk/instrumentation/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  langtrace_python_sdk/instrumentation/anthropic/instrumentation.py,sha256=DTvz6fNMMxYc2z6oqOveBX6mIXHoOFeOoosyXB2HJ6Y,1159
@@ -57,7 +57,7 @@ langtrace_python_sdk/instrumentation/pinecone/patch.py,sha256=5lF7hQmg2-U2EWtOC0
57
57
  langtrace_python_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  langtrace_python_sdk/utils/llm.py,sha256=4z2e-md_ELXCEuOIRVWracR6qH2pmsOxCqpkuF9_3Nw,1589
59
59
  langtrace_python_sdk/utils/with_root_span.py,sha256=N7ONrcF0myZbHBy5gpQffDbX-Kf63Crsz9szG0i3m08,1889
60
- langtrace_python_sdk-1.2.21.dist-info/METADATA,sha256=9yDWY-fJ-Sgnc6-M4apfEza7U9X-j0TWn6OQhfWmOZA,7695
61
- langtrace_python_sdk-1.2.21.dist-info/WHEEL,sha256=as-1oFTWSeWBgyzh0O_qF439xqBe6AbBgt4MfYe5zwY,87
62
- langtrace_python_sdk-1.2.21.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
63
- langtrace_python_sdk-1.2.21.dist-info/RECORD,,
60
+ langtrace_python_sdk-1.2.23.dist-info/METADATA,sha256=FrUpX6lKaLyKtHV7C-nIZWELcnozVZYvtyFh-Uh6jeQ,7695
61
+ langtrace_python_sdk-1.2.23.dist-info/WHEEL,sha256=as-1oFTWSeWBgyzh0O_qF439xqBe6AbBgt4MfYe5zwY,87
62
+ langtrace_python_sdk-1.2.23.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
63
+ langtrace_python_sdk-1.2.23.dist-info/RECORD,,