blaxel 0.2.0rc4__py3-none-any.whl → 0.2.0rc6__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.
@@ -8,9 +8,10 @@ from blaxel.telemetry.span import SpanManager
8
8
 
9
9
  logger = logging.getLogger(__name__)
10
10
 
11
+
11
12
  class BlaxelLanggraphInstrumentor(BaseInstrumentor):
12
13
  def instrumentation_dependencies(self):
13
- return ["blaxel_langgraph", "blaxel.core"]
14
+ return ["blaxel.langgraph", "blaxel.core"]
14
15
 
15
16
  def _instrument(self, **kwargs):
16
17
  tracer_provider = kwargs.get("tracer_provider")
@@ -22,21 +23,45 @@ class BlaxelLanggraphInstrumentor(BaseInstrumentor):
22
23
  import blaxel.langgraph.custom.gemini
23
24
 
24
25
  # Restore original methods
25
- if hasattr(blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_generate_content"):
26
- blaxel.langgraph.custom.gemini.GeminiRestClient.generate_content = blaxel.langgraph.custom.gemini.GeminiRestClient._blaxel_original_generate_content
27
- delattr(blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_generate_content")
26
+ if hasattr(
27
+ blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_generate_content"
28
+ ):
29
+ blaxel.langgraph.custom.gemini.GeminiRestClient.generate_content = (
30
+ blaxel.langgraph.custom.gemini.GeminiRestClient._blaxel_original_generate_content
31
+ )
32
+ delattr(
33
+ blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_generate_content"
34
+ )
28
35
 
29
- if hasattr(blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_generate_content_async"):
36
+ if hasattr(
37
+ blaxel.langgraph.custom.gemini.GeminiRestClient,
38
+ "_blaxel_original_generate_content_async",
39
+ ):
30
40
  blaxel.langgraph.custom.gemini.GeminiRestClient.generate_content_async = blaxel.langgraph.custom.gemini.GeminiRestClient._blaxel_original_generate_content_async
31
- delattr(blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_generate_content_async")
41
+ delattr(
42
+ blaxel.langgraph.custom.gemini.GeminiRestClient,
43
+ "_blaxel_original_generate_content_async",
44
+ )
32
45
 
33
- if hasattr(blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_stream_generate_content"):
46
+ if hasattr(
47
+ blaxel.langgraph.custom.gemini.GeminiRestClient,
48
+ "_blaxel_original_stream_generate_content",
49
+ ):
34
50
  blaxel.langgraph.custom.gemini.GeminiRestClient.stream_generate_content = blaxel.langgraph.custom.gemini.GeminiRestClient._blaxel_original_stream_generate_content
35
- delattr(blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_stream_generate_content")
51
+ delattr(
52
+ blaxel.langgraph.custom.gemini.GeminiRestClient,
53
+ "_blaxel_original_stream_generate_content",
54
+ )
36
55
 
37
- if hasattr(blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_stream_generate_content_async"):
56
+ if hasattr(
57
+ blaxel.langgraph.custom.gemini.GeminiRestClient,
58
+ "_blaxel_original_stream_generate_content_async",
59
+ ):
38
60
  blaxel.langgraph.custom.gemini.GeminiRestClient.stream_generate_content_async = blaxel.langgraph.custom.gemini.GeminiRestClient._blaxel_original_stream_generate_content_async
39
- delattr(blaxel.langgraph.custom.gemini.GeminiRestClient, "_blaxel_original_stream_generate_content_async")
61
+ delattr(
62
+ blaxel.langgraph.custom.gemini.GeminiRestClient,
63
+ "_blaxel_original_stream_generate_content_async",
64
+ )
40
65
 
41
66
  def _patch_tool(self, tracer: Tracer):
42
67
  def _traced_run(original, instance, args, kwargs):
@@ -69,6 +94,6 @@ class BlaxelLanggraphInstrumentor(BaseInstrumentor):
69
94
  span.set_attribute("tool.error", str(e))
70
95
  raise
71
96
 
72
- wrap_function_wrapper('langchain_core.tools', 'BaseTool.run', _traced_run)
73
- wrap_function_wrapper('langchain_core.tools', 'BaseTool.arun', _traced_arun)
74
- wrap_function_wrapper('langchain_core.tools', 'BaseTool.arun', _traced_arun)
97
+ wrap_function_wrapper("langchain_core.tools", "BaseTool.run", _traced_run)
98
+ wrap_function_wrapper("langchain_core.tools", "BaseTool.arun", _traced_arun)
99
+ wrap_function_wrapper("langchain_core.tools", "BaseTool.arun", _traced_arun)
@@ -24,13 +24,13 @@ logger = logging.getLogger(__name__)
24
24
 
25
25
  WRAPPED_METHODS = [
26
26
  {
27
- "package": "blaxel_langgraph.custom.gemini",
27
+ "package": "blaxel.langgraph.custom.gemini",
28
28
  "object": "GeminiRestClient",
29
29
  "method": "generate_content",
30
30
  "span_name": "gemini.generate_content",
31
31
  },
32
32
  {
33
- "package": "blaxel_langgraph.custom.gemini",
33
+ "package": "blaxel.langgraph.custom.gemini",
34
34
  "object": "GeminiRestClient",
35
35
  "method": "generate_content_async",
36
36
  "span_name": "gemini.generate_content_async",
@@ -112,20 +112,14 @@ def _set_input_attributes(span, args, kwargs, llm_model):
112
112
  )
113
113
 
114
114
  _set_span_attribute(span, SpanAttributes.LLM_REQUEST_MODEL, llm_model)
115
- _set_span_attribute(
116
- span, SpanAttributes.LLM_REQUEST_TEMPERATURE, kwargs.get("temperature")
117
- )
115
+ _set_span_attribute(span, SpanAttributes.LLM_REQUEST_TEMPERATURE, kwargs.get("temperature"))
118
116
  _set_span_attribute(
119
117
  span, SpanAttributes.LLM_REQUEST_MAX_TOKENS, kwargs.get("max_output_tokens")
120
118
  )
121
119
  _set_span_attribute(span, SpanAttributes.LLM_REQUEST_TOP_P, kwargs.get("top_p"))
122
120
  _set_span_attribute(span, SpanAttributes.LLM_TOP_K, kwargs.get("top_k"))
123
- _set_span_attribute(
124
- span, SpanAttributes.LLM_PRESENCE_PENALTY, kwargs.get("presence_penalty")
125
- )
126
- _set_span_attribute(
127
- span, SpanAttributes.LLM_FREQUENCY_PENALTY, kwargs.get("frequency_penalty")
128
- )
121
+ _set_span_attribute(span, SpanAttributes.LLM_PRESENCE_PENALTY, kwargs.get("presence_penalty"))
122
+ _set_span_attribute(span, SpanAttributes.LLM_FREQUENCY_PENALTY, kwargs.get("frequency_penalty"))
129
123
 
130
124
  return
131
125
 
@@ -157,12 +151,8 @@ def _set_response_attributes(span, response, llm_model):
157
151
  _set_span_attribute(span, f"{prefix}.content", item.text)
158
152
  _set_span_attribute(span, f"{prefix}.role", "assistant")
159
153
  elif isinstance(response.text, str):
160
- _set_span_attribute(
161
- span, f"{SpanAttributes.LLM_COMPLETIONS}.0.content", response.text
162
- )
163
- _set_span_attribute(
164
- span, f"{SpanAttributes.LLM_COMPLETIONS}.0.role", "assistant"
165
- )
154
+ _set_span_attribute(span, f"{SpanAttributes.LLM_COMPLETIONS}.0.content", response.text)
155
+ _set_span_attribute(span, f"{SpanAttributes.LLM_COMPLETIONS}.0.role", "assistant")
166
156
  else:
167
157
  if isinstance(response, list):
168
158
  for index, item in enumerate(response):
@@ -170,12 +160,8 @@ def _set_response_attributes(span, response, llm_model):
170
160
  _set_span_attribute(span, f"{prefix}.content", item)
171
161
  _set_span_attribute(span, f"{prefix}.role", "assistant")
172
162
  elif isinstance(response, str):
173
- _set_span_attribute(
174
- span, f"{SpanAttributes.LLM_COMPLETIONS}.0.content", response
175
- )
176
- _set_span_attribute(
177
- span, f"{SpanAttributes.LLM_COMPLETIONS}.0.role", "assistant"
178
- )
163
+ _set_span_attribute(span, f"{SpanAttributes.LLM_COMPLETIONS}.0.content", response)
164
+ _set_span_attribute(span, f"{SpanAttributes.LLM_COMPLETIONS}.0.role", "assistant")
179
165
 
180
166
  return
181
167
 
@@ -246,9 +232,9 @@ async def _awrap(tracer, to_wrap, wrapped, instance, args, kwargs):
246
232
  if hasattr(instance, "_model_id"):
247
233
  llm_model = instance._model_id.replace("models/", "")
248
234
  if hasattr(instance, "_model_name"):
249
- llm_model = instance._model_name.replace(
250
- "publishers/google/models/", ""
251
- ).replace("models/", "")
235
+ llm_model = instance._model_name.replace("publishers/google/models/", "").replace(
236
+ "models/", ""
237
+ )
252
238
  if hasattr(instance, "model") and hasattr(instance.model, "model_name"):
253
239
  llm_model = instance.model.model_name.replace("models/", "")
254
240
 
@@ -290,9 +276,9 @@ def _wrap(tracer, to_wrap, wrapped, instance, args, kwargs):
290
276
  if hasattr(instance, "_model_id"):
291
277
  llm_model = instance._model_id.replace("models/", "")
292
278
  if hasattr(instance, "_model_name"):
293
- llm_model = instance._model_name.replace(
294
- "publishers/google/models/", ""
295
- ).replace("models/", "")
279
+ llm_model = instance._model_name.replace("publishers/google/models/", "").replace(
280
+ "models/", ""
281
+ )
296
282
  if hasattr(instance, "model") and hasattr(instance.model, "model_name"):
297
283
  llm_model = instance.model.model_name.replace("models/", "")
298
284
 
@@ -330,7 +316,7 @@ class BlaxelLanggraphGeminiInstrumentor(BaseInstrumentor):
330
316
  Config.exception_logger = exception_logger
331
317
 
332
318
  def instrumentation_dependencies(self) -> Collection[str]:
333
- return ["blaxel_langgraph"]
319
+ return ["blaxel.langgraph"]
334
320
 
335
321
  def _instrument(self, **kwargs):
336
322
  tracer_provider = kwargs.get("tracer_provider")
@@ -30,7 +30,7 @@ TO_INSTRUMENT = [
30
30
 
31
31
  class BlaxelLlamaIndexInstrumentor(BaseInstrumentor):
32
32
  def instrumentation_dependencies(self):
33
- return ["blaxel_llamaindex", "blaxel.core"]
33
+ return ["blaxel.llamaindex", "blaxel.core"]
34
34
 
35
35
  def _instrument(self, **kwargs):
36
36
  tracer_provider = kwargs.get("tracer_provider")
@@ -49,12 +49,8 @@ class BlaxelLlamaIndexInstrumentor(BaseInstrumentor):
49
49
  pass
50
50
 
51
51
  def _instrument_module(self, module_name, class_name, tracer):
52
- wrap_function_wrapper(
53
- module_name, f"{class_name}.call", query_wrapper(tracer)
54
- )
55
- wrap_function_wrapper(
56
- module_name, f"{class_name}.acall", aquery_wrapper(tracer)
57
- )
52
+ wrap_function_wrapper(module_name, f"{class_name}.call", query_wrapper(tracer))
53
+ wrap_function_wrapper(module_name, f"{class_name}.acall", aquery_wrapper(tracer))
58
54
 
59
55
 
60
56
  @_with_tracer_wrapper
@@ -9,53 +9,54 @@ class InstrumentationMapping(BaseModel):
9
9
  required_packages: List[str]
10
10
  ignore_if_packages: List[str]
11
11
 
12
+
12
13
  MAPPINGS: Dict[str, InstrumentationMapping] = {
13
14
  "anthropic": InstrumentationMapping(
14
15
  module_path="opentelemetry.instrumentation.anthropic",
15
16
  class_name="AnthropicInstrumentor",
16
17
  required_packages=["anthropic"],
17
- ignore_if_packages=[]
18
+ ignore_if_packages=[],
18
19
  ),
19
20
  "cohere": InstrumentationMapping(
20
21
  module_path="opentelemetry.instrumentation.cohere",
21
22
  class_name="CohereInstrumentor",
22
23
  required_packages=["cohere"],
23
- ignore_if_packages=[]
24
+ ignore_if_packages=[],
24
25
  ),
25
26
  "openai": InstrumentationMapping(
26
27
  module_path="opentelemetry.instrumentation.openai",
27
28
  class_name="OpenAIInstrumentor",
28
29
  required_packages=["openai"],
29
- ignore_if_packages=[]
30
+ ignore_if_packages=[],
30
31
  ),
31
32
  "gemini": InstrumentationMapping(
32
33
  module_path="opentelemetry.instrumentation.google_generativeai",
33
34
  class_name="GoogleGenerativeAIInstrumentor",
34
35
  required_packages=["google-generativeai"],
35
- ignore_if_packages=[]
36
+ ignore_if_packages=[],
36
37
  ),
37
38
  "blaxel.core": InstrumentationMapping(
38
- module_path="blaxel_telemetry.instrumentation.blaxel.core",
39
+ module_path="blaxel.telemetry.instrumentation.blaxel_core",
39
40
  class_name="BlaxelCoreInstrumentor",
40
41
  required_packages=["blaxel.core"],
41
- ignore_if_packages=[]
42
+ ignore_if_packages=[],
42
43
  ),
43
- "blaxel_langgraph": InstrumentationMapping(
44
- module_path="blaxel_telemetry.instrumentation.blaxel_langgraph",
44
+ "blaxel.langgraph": InstrumentationMapping(
45
+ module_path="blaxel.telemetry.instrumentation.blaxel_langgraph",
45
46
  class_name="BlaxelLanggraphInstrumentor",
46
- required_packages=["blaxel_langgraph"],
47
- ignore_if_packages=[]
47
+ required_packages=["blaxel.langgraph"],
48
+ ignore_if_packages=[],
48
49
  ),
49
- "blaxel_langgraph_gemini": InstrumentationMapping(
50
- module_path="blaxel_telemetry.instrumentation.blaxel_langgraph_gemini",
50
+ "blaxel.langgraph_gemini": InstrumentationMapping(
51
+ module_path="blaxel.telemetry.instrumentation.blaxel_langgraph_gemini",
51
52
  class_name="BlaxelLanggraphGeminiInstrumentor",
52
- required_packages=["blaxel_langgraph"],
53
- ignore_if_packages=[]
53
+ required_packages=["blaxel.langgraph"],
54
+ ignore_if_packages=[],
54
55
  ),
55
- "blaxel_llamaindex": InstrumentationMapping(
56
- module_path="blaxel_telemetry.instrumentation.blaxel_llamaindex",
56
+ "blaxel.llamaindex": InstrumentationMapping(
57
+ module_path="blaxel.telemetry.instrumentation.blaxel_llamaindex",
57
58
  class_name="BlaxelLlamaIndexInstrumentor",
58
59
  required_packages=["blaxel_llamaindex"],
59
- ignore_if_packages=[]
60
+ ignore_if_packages=[],
60
61
  ),
61
62
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blaxel
3
- Version: 0.2.0rc4
3
+ Version: 0.2.0rc6
4
4
  Summary: Blaxel - AI development platform SDK
5
5
  Project-URL: Homepage, https://blaxel.ai
6
6
  Project-URL: Documentation, https://docs.blaxel.ai
@@ -21,7 +21,7 @@ Requires-Dist: tomli>=2.2.1
21
21
  Requires-Dist: websockets<16.0.0
22
22
  Provides-Extra: all
23
23
  Requires-Dist: crewai>=0.120.1; extra == 'all'
24
- Requires-Dist: google-adk>=1.1.1; extra == 'all'
24
+ Requires-Dist: google-adk>=1.4.0; extra == 'all'
25
25
  Requires-Dist: langchain-anthropic>=0.3.10; extra == 'all'
26
26
  Requires-Dist: langchain-cerebras>=0.5.0; extra == 'all'
27
27
  Requires-Dist: langchain-cohere>=0.4.3; extra == 'all'
@@ -66,7 +66,7 @@ Requires-Dist: pytest; extra == 'dev'
66
66
  Requires-Dist: ruff; extra == 'dev'
67
67
  Requires-Dist: uv; extra == 'dev'
68
68
  Provides-Extra: googleadk
69
- Requires-Dist: google-adk>=1.1.1; extra == 'googleadk'
69
+ Requires-Dist: google-adk>=1.4.0; extra == 'googleadk'
70
70
  Requires-Dist: litellm>=1.63.11; extra == 'googleadk'
71
71
  Provides-Extra: langgraph
72
72
  Requires-Dist: langchain-anthropic>=0.3.10; extra == 'langgraph'
@@ -395,14 +395,14 @@ blaxel/telemetry/manager.py,sha256=3yYBxxqQKl1rCKrn0GVz9jR5jouC1nsElbAaH8tTtgA,9
395
395
  blaxel/telemetry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
396
396
  blaxel/telemetry/span.py,sha256=b8lpWe5nqek4w9YrBLJCIYz4Z3n9Z_49H_AkqpAGOiM,3660
397
397
  blaxel/telemetry/instrumentation/blaxel_core.py,sha256=gY2QoAr2UgnMabLyoxR1X79SVUaFM_hQJIzDdy80SuY,4892
398
- blaxel/telemetry/instrumentation/blaxel_langgraph.py,sha256=lqRvqEMv2ymUZzjDyAS6qgLiwL3ilUk43F6mpfPliIo,3926
399
- blaxel/telemetry/instrumentation/blaxel_langgraph_gemini.py,sha256=k1cUwS0TSgAeIAnw7OMZgbsJGT3WR-hyNMpDeebImkA,12122
400
- blaxel/telemetry/instrumentation/blaxel_llamaindex.py,sha256=PLnPcfywRq4LEgg8PrC8jlX9ZVEJD4ntYoV1u_26k_g,3166
401
- blaxel/telemetry/instrumentation/map.py,sha256=EVCw6ug1hemE-9kh77Vxs9cqr_p9TPzFwm-fuMTY-Og,2198
398
+ blaxel/telemetry/instrumentation/blaxel_langgraph.py,sha256=5C6mM0aKa8rbaAmhe7Z3HWHhZ-A_BZ0iio9Hn-GvIVM,4257
399
+ blaxel/telemetry/instrumentation/blaxel_langgraph_gemini.py,sha256=2_5vcaNU7fS7ZisSLadNpFfiuy4zeRUDONJXhlQ9L1M,11960
400
+ blaxel/telemetry/instrumentation/blaxel_llamaindex.py,sha256=EvgFhLUv5QViz7rAMJs5w_Oks-5NOe1v7A3B9b0NxeM,3122
401
+ blaxel/telemetry/instrumentation/map.py,sha256=D7htA88-H8r7jHutBWnr_KEL8OZqLvvnRbU9jWiAA8g,2207
402
402
  blaxel/telemetry/instrumentation/utils.py,sha256=KInMYZH-mu9_wvetmf0EmgrfN3Sw8IWk2Y95v2u90_U,1901
403
403
  blaxel/telemetry/log/log.py,sha256=RvQByRjZMoP_dRaAZu8oK6DTegsHs-xV4W-UIqis6CA,2461
404
404
  blaxel/telemetry/log/logger.py,sha256=NPAS3g82ryROjvc_DEZaTIfrcehoLEZoP-JkLxADxc0,4113
405
- blaxel-0.2.0rc4.dist-info/METADATA,sha256=hiJxnxbAbdimLOYp6zQdrKBYLxCLFIBnSmHZZCX7VDw,9878
406
- blaxel-0.2.0rc4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
407
- blaxel-0.2.0rc4.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
408
- blaxel-0.2.0rc4.dist-info/RECORD,,
405
+ blaxel-0.2.0rc6.dist-info/METADATA,sha256=aI1uHOODyBfwDgJAbMDwmZlI__mZnGgzX9u-tY1PO8g,9878
406
+ blaxel-0.2.0rc6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
407
+ blaxel-0.2.0rc6.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
408
+ blaxel-0.2.0rc6.dist-info/RECORD,,