langtrace-python-sdk 1.2.12__py3-none-any.whl → 1.2.16__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.
@@ -90,10 +90,8 @@ class LangTraceExporter(SpanExporter):
90
90
  data=json.dumps(data),
91
91
  headers={"Content-Type": "application/json", "x-api-key": self.api_key},
92
92
  )
93
- print(f"Traces sent To {LANGTRACE_REMOTE_URL}")
94
93
  return SpanExportResult.SUCCESS
95
94
  except Exception as e:
96
- print("Error sending data to remote URL", e)
97
95
  return SpanExportResult.FAILURE
98
96
 
99
97
  def shutdown(self) -> None:
@@ -11,6 +11,10 @@ from wrapt import wrap_function_wrapper
11
11
 
12
12
  from langtrace_python_sdk.instrumentation.anthropic.patch import messages_create
13
13
 
14
+ import logging
15
+
16
+ logging.basicConfig(level=logging.FATAL)
17
+
14
18
 
15
19
  class AnthropicInstrumentation(BaseInstrumentor):
16
20
  """
@@ -11,6 +11,9 @@ from wrapt import wrap_function_wrapper
11
11
 
12
12
  from langtrace_python_sdk.constants.instrumentation.chroma import APIS
13
13
  from langtrace_python_sdk.instrumentation.chroma.patch import collection_patch
14
+ import logging
15
+
16
+ logging.basicConfig(level=logging.FATAL)
14
17
 
15
18
 
16
19
  class ChromaInstrumentation(BaseInstrumentor):
@@ -12,6 +12,10 @@ from wrapt import wrap_function_wrapper
12
12
 
13
13
  from langtrace_python_sdk.instrumentation.langchain.patch import generic_patch
14
14
 
15
+ import logging
16
+
17
+ logging.basicConfig(level=logging.FATAL)
18
+
15
19
 
16
20
  def patch_module_classes(
17
21
  module_name, tracer, version, task, trace_output=True, trace_input=True
@@ -12,6 +12,10 @@ from wrapt import wrap_function_wrapper
12
12
 
13
13
  from langtrace_python_sdk.instrumentation.llamaindex.patch import generic_patch
14
14
 
15
+ import logging
16
+
17
+ logging.basicConfig(level=logging.FATAL)
18
+
15
19
 
16
20
  class LlamaindexInstrumentation(BaseInstrumentor):
17
21
  """
@@ -1,7 +1,6 @@
1
1
  import importlib.metadata
2
2
  from typing import Collection
3
3
 
4
- import openai
5
4
  from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
6
5
  from opentelemetry.trace import get_tracer
7
6
  from wrapt import wrap_function_wrapper
@@ -12,6 +11,10 @@ from langtrace_python_sdk.instrumentation.openai.patch import (
12
11
  images_generate,
13
12
  )
14
13
 
14
+ import logging
15
+
16
+ logging.basicConfig(level=logging.FATAL)
17
+
15
18
 
16
19
  class OpenAIInstrumentation(BaseInstrumentor):
17
20
 
@@ -25,17 +28,17 @@ class OpenAIInstrumentation(BaseInstrumentor):
25
28
  wrap_function_wrapper(
26
29
  "openai.resources.chat.completions",
27
30
  "Completions.create",
28
- chat_completions_create(openai.chat.completions.create, version, tracer),
31
+ chat_completions_create("openai.chat.completions.create", version, tracer),
29
32
  )
30
33
  wrap_function_wrapper(
31
34
  "openai.resources.images",
32
35
  "Images.generate",
33
- images_generate(openai.images.generate, version, tracer),
36
+ images_generate("openai.images.generate", version, tracer),
34
37
  )
35
38
  wrap_function_wrapper(
36
39
  "openai.resources.embeddings",
37
40
  "Embeddings.create",
38
- embeddings_create(openai.embeddings.create, version, tracer),
41
+ embeddings_create("openai.embeddings.create", version, tracer),
39
42
  )
40
43
 
41
44
  def _uninstrument(self, **kwargs):
@@ -52,7 +52,7 @@ def images_generate(original_method, version, tracer):
52
52
  span.set_attribute(field, value)
53
53
  try:
54
54
  # Attempt to call the original method
55
- result = original_method(*args, **kwargs)
55
+ result = wrapped(*args, **kwargs)
56
56
  if kwargs.get("stream") is False or kwargs.get("stream") is None:
57
57
  data = (
58
58
  result.data[0]
@@ -132,8 +132,8 @@ def chat_completions_create(original_method, version, tracer):
132
132
  span.set_attribute(field, value)
133
133
  try:
134
134
  # Attempt to call the original method
135
- result = original_method(*args, **kwargs)
136
- if kwargs.get("stream") is False:
135
+ result = wrapped(*args, **kwargs)
136
+ if kwargs.get("stream") is False or kwargs.get("stream") is None:
137
137
  span.set_attribute("llm.model", result.model)
138
138
  if hasattr(result, "choices") and result.choices is not None:
139
139
  responses = [
@@ -338,14 +338,12 @@ def embeddings_create(original_method, version, tracer):
338
338
  APIS["EMBEDDINGS_CREATE"]["METHOD"], kind=SpanKind.CLIENT
339
339
  ) as span:
340
340
 
341
- print("Inside embeddings_create", trace.get_current_span())
342
-
343
341
  for field, value in attributes.model_dump(by_alias=True).items():
344
342
  if value is not None:
345
343
  span.set_attribute(field, value)
346
344
  try:
347
345
  # Attempt to call the original method
348
- result = original_method(*args, **kwargs)
346
+ result = wrapped(*args, **kwargs)
349
347
  span.set_status(StatusCode.OK)
350
348
  return result
351
349
  except Exception as e:
@@ -14,6 +14,10 @@ from wrapt import wrap_function_wrapper
14
14
  from langtrace_python_sdk.constants.instrumentation.pinecone import APIS
15
15
  from langtrace_python_sdk.instrumentation.pinecone.patch import generic_patch
16
16
 
17
+ import logging
18
+
19
+ logging.basicConfig(level=logging.FATAL)
20
+
17
21
 
18
22
  class PineconeInstrumentation(BaseInstrumentor):
19
23
  """
@@ -1 +1 @@
1
- __version__ = "1.2.12"
1
+ __version__ = "1.2.16"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: langtrace-python-sdk
3
- Version: 1.2.12
3
+ Version: 1.2.16
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>
@@ -18,7 +18,7 @@ examples/pinecone_example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
18
18
  examples/pinecone_example/basic.py,sha256=hdV6-5Fmol9zeyFzDtdabD62vkqUJ4lCHG2YcVNpIpI,933
19
19
  langtrace_python_sdk/__init__.py,sha256=SlHg447-nQBbw8exRNJP_OyHUZ39Sldb7aaQ35hIRm8,262
20
20
  langtrace_python_sdk/langtrace.py,sha256=sWC7WqbOdOUB1sZ_hzLZVp0_Q8fBTRJRMUvOPyO6f20,3170
21
- langtrace_python_sdk/version.py,sha256=dbW85A2PinQCZabwD2DNDTfOE9315GDtQQKAsJP8IXk,23
21
+ langtrace_python_sdk/version.py,sha256=7RIJ-Nh9kHJf5O5NvahUeP8DNXq6oIzbYcIt_yKv0lQ,23
22
22
  langtrace_python_sdk/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=OfgvphRBPENwsAizqzka9lFu9aDw-A7ErYJ0atl3bpI,56
24
24
  langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -28,16 +28,16 @@ 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=7lIsChmQSOWqFxiegNbHEA_rOTpbkm-RBlBYvKIHxg4,4097
31
+ langtrace_python_sdk/extensions/langtrace_exporter.py,sha256=dEMSwkbqVMMToD6mH1m3x4i0Dk0g4I8-oNhOmoFZDBA,3980
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
- langtrace_python_sdk/instrumentation/anthropic/instrumentation.py,sha256=1shNkDE7Yb-JFVlEZHMcDbJ6zW8SkSFdxf_yFo9wTNA,1101
34
+ langtrace_python_sdk/instrumentation/anthropic/instrumentation.py,sha256=DTvz6fNMMxYc2z6oqOveBX6mIXHoOFeOoosyXB2HJ6Y,1159
35
35
  langtrace_python_sdk/instrumentation/anthropic/patch.py,sha256=_-dNjxJbJTgJfHfwC_zGoxAXupL86jfBLlZefLuCBKk,7115
36
36
  langtrace_python_sdk/instrumentation/chroma/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- langtrace_python_sdk/instrumentation/chroma/instrumentation.py,sha256=fSR1ZjoViwjbPYkUWJnRpFwWtwERyf4UqnMiDl8eGmY,1223
37
+ langtrace_python_sdk/instrumentation/chroma/instrumentation.py,sha256=9k8KueizRJuicJnuYmSvjLwdeCNszZ1KpwZPMsQ_7ig,1280
38
38
  langtrace_python_sdk/instrumentation/chroma/patch.py,sha256=IORHg5GMrzFiuzMWzAbrZzmxQTRu-zzksgh5RDPGoG8,2245
39
39
  langtrace_python_sdk/instrumentation/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- langtrace_python_sdk/instrumentation/langchain/instrumentation.py,sha256=im9RSJ3twIWVtzSE0sT-0VY82b_CxSzs-Tk7Z4nas3Q,2880
40
+ langtrace_python_sdk/instrumentation/langchain/instrumentation.py,sha256=UBUx31IErih1zDGkwez5ZFT2qGvCHxhdGHvJsEyhvEo,2938
41
41
  langtrace_python_sdk/instrumentation/langchain/patch.py,sha256=z_brH_5BSze1MWjWBycyOPMrJAAw65OUM5vcvvatoZM,3236
42
42
  langtrace_python_sdk/instrumentation/langchain_community/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py,sha256=CS6oAxnhQ98gjD5Xj7LrWDE9i-FVjWI3kOwZ4phspnU,4677
@@ -46,18 +46,18 @@ langtrace_python_sdk/instrumentation/langchain_core/__init__.py,sha256=47DEQpj8H
46
46
  langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py,sha256=1Y4q_F2nN79y-dap_if35vH9oowIuDi6mo0ELYIltNI,5417
47
47
  langtrace_python_sdk/instrumentation/langchain_core/patch.py,sha256=zr5nvqeOX6IlD1gDbRLRz7Frep40EvrOSz8BCy1XgJc,7843
48
48
  langtrace_python_sdk/instrumentation/llamaindex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
- langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py,sha256=udDxk87H731x0mRFNr0jdtstfnSwiirxVPo6Z4UWAtY,2430
49
+ langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py,sha256=wVSvxSJb1owoEBCSqPQRzsbdEkPAQzTqXKKSxGk0sSY,2488
50
50
  langtrace_python_sdk/instrumentation/llamaindex/patch.py,sha256=wTWmyTD09J44ULGoMVmgmq72VN1H0xmdrISTdzqo1Yw,1985
51
51
  langtrace_python_sdk/instrumentation/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
- langtrace_python_sdk/instrumentation/openai/instrumentation.py,sha256=6RmbONTwgr8_do92l3ll7-ia4maXMxQVCwPBRRa-3NA,1358
53
- langtrace_python_sdk/instrumentation/openai/patch.py,sha256=ffj5W-R1WtcLkahur2e6s5eYJIGCiV7PkNIA8ZXwP1c,14982
52
+ langtrace_python_sdk/instrumentation/openai/instrumentation.py,sha256=stlFopPggB8mgnn4QdVh41rmA8mlzH5x-C00XHfApCE,1408
53
+ langtrace_python_sdk/instrumentation/openai/patch.py,sha256=YBEv4OEXIvKQXmRxGmNsFEOqPtQU2mzZ7jNS3bdWk4A,14917
54
54
  langtrace_python_sdk/instrumentation/pinecone/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
- langtrace_python_sdk/instrumentation/pinecone/instrumentation.py,sha256=PBkCMiaDr-WXkGfHt9iXtYqyl7a-xIO52pRmUFuMURo,1726
55
+ langtrace_python_sdk/instrumentation/pinecone/instrumentation.py,sha256=o0EUd5jvHaDKOUTj4NjnL5UfDHDHxyXkWGlTW4oeRDk,1784
56
56
  langtrace_python_sdk/instrumentation/pinecone/patch.py,sha256=lvWL_xM7mxTQ1D-eY5Gh949c45BAKrN2N5IzKRkUhMY,2142
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.12.dist-info/METADATA,sha256=gD8Lo6pcTxuqf8X9Di30NSpe7AYvSKGiBmrs2c0otIo,7695
61
- langtrace_python_sdk-1.2.12.dist-info/WHEEL,sha256=uNdcs2TADwSd5pVaP0Z_kcjcvvTUklh2S7bxZMF8Uj0,87
62
- langtrace_python_sdk-1.2.12.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
63
- langtrace_python_sdk-1.2.12.dist-info/RECORD,,
60
+ langtrace_python_sdk-1.2.16.dist-info/METADATA,sha256=S-mgSIqMpKlKju44vtCpxjfESTY0ohot-O3kvh8QFgY,7695
61
+ langtrace_python_sdk-1.2.16.dist-info/WHEEL,sha256=uNdcs2TADwSd5pVaP0Z_kcjcvvTUklh2S7bxZMF8Uj0,87
62
+ langtrace_python_sdk-1.2.16.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
63
+ langtrace_python_sdk-1.2.16.dist-info/RECORD,,