langtrace-python-sdk 2.3.8__py3-none-any.whl → 2.3.10__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.
@@ -51,7 +51,6 @@ def patch_memory(operation_name, version, tracer: Tracer):
51
51
  )
52
52
  if result:
53
53
  span.set_status(Status(StatusCode.OK))
54
- span.end()
55
54
  return result
56
55
 
57
56
  except Exception as err:
@@ -102,7 +101,6 @@ def patch_crew(operation_name, version, tracer: Tracer):
102
101
  span.set_attribute(
103
102
  f"crewai.crew.{attr}", str(getattr(result, attr))
104
103
  )
105
- span.end()
106
104
  return result
107
105
 
108
106
  except Exception as err:
@@ -139,21 +137,27 @@ class CrewAISpanAttributes:
139
137
  for key, value in self.crew.items():
140
138
  key = f"crewai.crew.{key}"
141
139
  if value is not None:
142
- set_span_attribute(self.span, key, value)
140
+ set_span_attribute(
141
+ self.span, key, str(value) if isinstance(value, list) else value
142
+ )
143
143
 
144
144
  elif instance_name == "Agent":
145
145
  agent = self.set_agent_attributes()
146
146
  for key, value in agent.items():
147
147
  key = f"crewai.agent.{key}"
148
148
  if value is not None:
149
- set_span_attribute(self.span, key, value)
149
+ set_span_attribute(
150
+ self.span, key, str(value) if isinstance(value, list) else value
151
+ )
150
152
 
151
153
  elif instance_name == "Task":
152
154
  task = self.set_task_attributes()
153
155
  for key, value in task.items():
154
156
  key = f"crewai.task.{key}"
155
157
  if value is not None:
156
- set_span_attribute(self.span, key, value)
158
+ set_span_attribute(
159
+ self.span, key, str(value) if isinstance(value, list) else value
160
+ )
157
161
 
158
162
  def set_crew_attributes(self):
159
163
  for key, value in self.instance.__dict__.items():
@@ -31,7 +31,7 @@ def patch_bootstrapfewshot_optimizer(operation_name, version, tracer):
31
31
  span_attributes["dspy.optimizer"] = instance.__class__.__name__
32
32
  if len(args) > 0:
33
33
  span_attributes["dspy.optimizer.module"] = args[0].__class__.__name__
34
- if args[0].prog:
34
+ if hasattr(args[0], "prog") and args[0].prog:
35
35
  prog = {
36
36
  "name": args[0].prog.__class__.__name__,
37
37
  "signature": (
@@ -17,7 +17,7 @@ limitations under the License.
17
17
  import os
18
18
  import sys
19
19
  from typing import Optional
20
-
20
+ import importlib.util
21
21
  from colorama import Fore
22
22
  from opentelemetry import trace
23
23
  from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
@@ -120,25 +120,25 @@ def init(
120
120
  all_instrumentations = {
121
121
  "openai": OpenAIInstrumentation(),
122
122
  "groq": GroqInstrumentation(),
123
- "pinecone": PineconeInstrumentation(),
124
- "llamaindex": LlamaindexInstrumentation(),
125
- "chroma": ChromaInstrumentation(),
123
+ "pinecone-client": PineconeInstrumentation(),
124
+ "llama-index": LlamaindexInstrumentation(),
125
+ "chromadb": ChromaInstrumentation(),
126
126
  "embedchain": EmbedchainInstrumentation(),
127
- "qdrant": QdrantInstrumentation(),
127
+ "qdrant-client": QdrantInstrumentation(),
128
128
  "langchain": LangchainInstrumentation(),
129
- "langchain_core": LangchainCoreInstrumentation(),
130
- "langchain_community": LangchainCommunityInstrumentation(),
129
+ "langchain-core": LangchainCoreInstrumentation(),
130
+ "langchain-community": LangchainCommunityInstrumentation(),
131
131
  "langgraph": LanggraphInstrumentation(),
132
132
  "anthropic": AnthropicInstrumentation(),
133
133
  "cohere": CohereInstrumentation(),
134
- "weaviate": WeaviateInstrumentation(),
134
+ "weaviate-client": WeaviateInstrumentation(),
135
135
  "sqlalchemy": SQLAlchemyInstrumentor(),
136
136
  "ollama": OllamaInstrumentor(),
137
- "dspy": DspyInstrumentation(),
137
+ "dspy-ai": DspyInstrumentation(),
138
138
  "crewai": CrewAIInstrumentation(),
139
- "vertexai": VertexAIInstrumentation(),
140
- "gemini": GeminiInstrumentation(),
141
- "mistral": MistralInstrumentation(),
139
+ "google-cloud-aiplatform": VertexAIInstrumentation(),
140
+ "google-generativeai": GeminiInstrumentation(),
141
+ "mistralai": MistralInstrumentation(),
142
142
  }
143
143
 
144
144
  init_instrumentations(disable_instrumentations, all_instrumentations)
@@ -171,8 +171,9 @@ def init_instrumentations(
171
171
  ):
172
172
  if disable_instrumentations is None:
173
173
  for idx, (name, v) in enumerate(all_instrumentations.items()):
174
+ if is_package_installed(name):
175
+ v.instrument()
174
176
 
175
- v.instrument()
176
177
  else:
177
178
 
178
179
  validate_instrumentations(disable_instrumentations)
@@ -229,3 +230,7 @@ def validate_instrumentations(disable_instrumentations):
229
230
  raise ValueError(
230
231
  "Cannot specify both only and all_except in disable_instrumentations"
231
232
  )
233
+
234
+
235
+ def is_package_installed(package_name):
236
+ return importlib.util.find_spec(package_name) is not None
@@ -1 +1 @@
1
- __version__ = "2.3.8"
1
+ __version__ = "2.3.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: langtrace-python-sdk
3
- Version: 2.3.8
3
+ Version: 2.3.10
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>
@@ -88,8 +88,8 @@ examples/vertexai_example/main.py,sha256=gndId5X5ksD-ycxnAWMdEqIDbLc3kz5Vt8vm4YP
88
88
  examples/weaviate_example/__init__.py,sha256=8JMDBsRSEV10HfTd-YC7xb4txBjD3la56snk-Bbg2Kw,618
89
89
  examples/weaviate_example/query_text.py,sha256=wPHQTc_58kPoKTZMygVjTj-2ZcdrIuaausJfMxNQnQc,127162
90
90
  langtrace_python_sdk/__init__.py,sha256=VZM6i71NR7pBQK6XvJWRelknuTYUhqwqE7PlicKa5Wg,1166
91
- langtrace_python_sdk/langtrace.py,sha256=rjIEwPd-Iq0mcSCh_3CEK-38kyJwazdR1CfDa_U4mfQ,8468
92
- langtrace_python_sdk/version.py,sha256=o9VOJSt96CdfTqQjfCid0JeeND10d3k_60KkoQHhpas,22
91
+ langtrace_python_sdk/langtrace.py,sha256=cwqjmqaKQBmP3VY0yTyfaNh6ykeWHu1qQvxcKvs0yKo,8697
92
+ langtrace_python_sdk/version.py,sha256=d7cuwqxkJuICmemJ_2rkIxE0f8PFypzWeUNmJ-fIm0I,23
93
93
  langtrace_python_sdk/constants/__init__.py,sha256=P8QvYwt5czUNDZsKS64vxm9Dc41ptGbuF1TFtAF6nv4,44
94
94
  langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=5MNjnAOg-4am78J3gVMH6FSwq5N8TOj72ugkhsw4vi0,46
95
95
  langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -123,10 +123,10 @@ langtrace_python_sdk/instrumentation/cohere/instrumentation.py,sha256=YQFHZIBd7S
123
123
  langtrace_python_sdk/instrumentation/cohere/patch.py,sha256=L-Lmh1apO7XiyJnByZk8F-icjrKqAwVo0JZUQS3uNNQ,20873
124
124
  langtrace_python_sdk/instrumentation/crewai/__init__.py,sha256=_UBKfvQv7l0g2_wnmA5F6CdSAFH0atNOVPd49zsN3aM,88
125
125
  langtrace_python_sdk/instrumentation/crewai/instrumentation.py,sha256=5Umzq8zjEnMEtjZZiMB4DQOPkxZ-1vts7RKC6JWpn24,2969
126
- langtrace_python_sdk/instrumentation/crewai/patch.py,sha256=CHTYkioOMifIzK5o7BMJLgh0D_cnbHQN3fbUqaLGBpI,8896
126
+ langtrace_python_sdk/instrumentation/crewai/patch.py,sha256=C2OKKPC-pzfzZWxPc74kHdYsKTX9yRhOgVY47WY9KN8,9109
127
127
  langtrace_python_sdk/instrumentation/dspy/__init__.py,sha256=tM1srfi_QgyCzrde4izojMrRq2Wm7Dj5QUvVQXIJzkk,84
128
128
  langtrace_python_sdk/instrumentation/dspy/instrumentation.py,sha256=o8URiDvCbZ8LL0I-4xKHkn_Ms2sETBRpn-gOliv3xzQ,2929
129
- langtrace_python_sdk/instrumentation/dspy/patch.py,sha256=E2P3MJBQ71or4M6BsvZOwYFtJK1UdTsYkdxVj9fSWPs,9869
129
+ langtrace_python_sdk/instrumentation/dspy/patch.py,sha256=eddxKIzJSUzZOcqg5LIwv9P0t66RXjB2NesDYGoJs8c,9898
130
130
  langtrace_python_sdk/instrumentation/embedchain/__init__.py,sha256=5L6n8-brMnRWZ0CMmHEuN1mrhIxrYLNtxRy0Ujc-hOY,103
131
131
  langtrace_python_sdk/instrumentation/embedchain/instrumentation.py,sha256=dShwm0duy25IvL7g9I_v-2oYuyh2fadeiJqXtXBay-8,1987
132
132
  langtrace_python_sdk/instrumentation/embedchain/patch.py,sha256=ovvBrtqUDwGSmSgK_S3pOOrDa4gkPSFG-HvmsxqmJE8,3627
@@ -225,8 +225,8 @@ tests/pinecone/cassettes/test_query.yaml,sha256=b5v9G3ssUy00oG63PlFUR3JErF2Js-5A
225
225
  tests/pinecone/cassettes/test_upsert.yaml,sha256=neWmQ1v3d03V8WoLl8FoFeeCYImb8pxlJBWnFd_lITU,38607
226
226
  tests/qdrant/conftest.py,sha256=9n0uHxxIjWk9fbYc4bx-uP8lSAgLBVx-cV9UjnsyCHM,381
227
227
  tests/qdrant/test_qdrant.py,sha256=pzjAjVY2kmsmGfrI2Gs2xrolfuaNHz7l1fqGQCjp5_o,3353
228
- langtrace_python_sdk-2.3.8.dist-info/METADATA,sha256=3WZWxVzEuOhYpL85H1FqrPv17y2Ru3929JFkKeCZECs,15011
229
- langtrace_python_sdk-2.3.8.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
230
- langtrace_python_sdk-2.3.8.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
231
- langtrace_python_sdk-2.3.8.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
232
- langtrace_python_sdk-2.3.8.dist-info/RECORD,,
228
+ langtrace_python_sdk-2.3.10.dist-info/METADATA,sha256=KA8joYIy5gc3BrFFTvfYm5RMWcWJvZjpwRDAKFBYVDo,15012
229
+ langtrace_python_sdk-2.3.10.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
230
+ langtrace_python_sdk-2.3.10.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
231
+ langtrace_python_sdk-2.3.10.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
232
+ langtrace_python_sdk-2.3.10.dist-info/RECORD,,