opentelemetry-instrumentation-llamaindex 0.24.0__py3-none-any.whl → 0.25.1__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.

Potentially problematic release.


This version of opentelemetry-instrumentation-llamaindex might be problematic. Click here for more details.

@@ -4,6 +4,8 @@ from wrapt import wrap_function_wrapper
4
4
 
5
5
  from opentelemetry.instrumentation.llamaindex.utils import (
6
6
  _with_tracer_wrapper,
7
+ process_request,
8
+ process_response,
7
9
  start_as_current_span_async,
8
10
  )
9
11
  from opentelemetry.semconv.ai import SpanAttributes, TraceloopSpanKindValues
@@ -54,7 +56,10 @@ def query_wrapper(tracer, wrapped, instance, args, kwargs):
54
56
  TraceloopSpanKindValues.AGENT.value,
55
57
  )
56
58
 
57
- return wrapped(*args, **kwargs)
59
+ process_request(span, args, kwargs)
60
+ res = wrapped(*args, **kwargs)
61
+ process_response(span, res)
62
+ return res
58
63
 
59
64
 
60
65
  @_with_tracer_wrapper
@@ -67,4 +72,7 @@ async def aquery_wrapper(tracer, wrapped, instance, args, kwargs):
67
72
  TraceloopSpanKindValues.AGENT.value,
68
73
  )
69
74
 
70
- return await wrapped(*args, **kwargs)
75
+ process_request(span, args, kwargs)
76
+ res = await wrapped(*args, **kwargs)
77
+ process_response(span, res)
78
+ return res
@@ -4,6 +4,8 @@ from wrapt import wrap_function_wrapper
4
4
 
5
5
  from opentelemetry.instrumentation.llamaindex.utils import (
6
6
  _with_tracer_wrapper,
7
+ process_request,
8
+ process_response,
7
9
  start_as_current_span_async,
8
10
  )
9
11
  from opentelemetry.semconv.ai import SpanAttributes, TraceloopSpanKindValues
@@ -47,7 +49,10 @@ def retrieve_wrapper(tracer, wrapped, instance, args, kwargs):
47
49
  TraceloopSpanKindValues.TASK.value,
48
50
  )
49
51
 
50
- return wrapped(*args, **kwargs)
52
+ process_request(span, args, kwargs)
53
+ res = wrapped(*args, **kwargs)
54
+ process_response(span, res)
55
+ return res
51
56
 
52
57
 
53
58
  @_with_tracer_wrapper
@@ -60,4 +65,7 @@ async def aretrieve_wrapper(tracer, wrapped, instance, args, kwargs):
60
65
  TraceloopSpanKindValues.TASK.value,
61
66
  )
62
67
 
63
- return await wrapped(*args, **kwargs)
68
+ process_request(span, args, kwargs)
69
+ res = await wrapped(*args, **kwargs)
70
+ process_response(span, res)
71
+ return res
@@ -4,6 +4,8 @@ from wrapt import wrap_function_wrapper
4
4
 
5
5
  from opentelemetry.instrumentation.llamaindex.utils import (
6
6
  _with_tracer_wrapper,
7
+ process_request,
8
+ process_response,
7
9
  start_as_current_span_async,
8
10
  )
9
11
  from opentelemetry.semconv.ai import SpanAttributes, TraceloopSpanKindValues
@@ -46,7 +48,10 @@ def synthesize_wrapper(tracer, wrapped, instance, args, kwargs):
46
48
  TraceloopSpanKindValues.TASK.value,
47
49
  )
48
50
 
49
- return wrapped(*args, **kwargs)
51
+ process_request(span, args, kwargs)
52
+ res = wrapped(*args, **kwargs)
53
+ process_response(span, res)
54
+ return res
50
55
 
51
56
 
52
57
  @_with_tracer_wrapper
@@ -59,4 +64,7 @@ async def asynthesize_wrapper(tracer, wrapped, instance, args, kwargs):
59
64
  TraceloopSpanKindValues.TASK.value,
60
65
  )
61
66
 
62
- return await wrapped(*args, **kwargs)
67
+ process_request(span, args, kwargs)
68
+ res = await wrapped(*args, **kwargs)
69
+ process_response(span, res)
70
+ return res
@@ -4,6 +4,8 @@ from wrapt import wrap_function_wrapper
4
4
 
5
5
  from opentelemetry.instrumentation.llamaindex.utils import (
6
6
  _with_tracer_wrapper,
7
+ process_request,
8
+ process_response,
7
9
  start_as_current_span_async,
8
10
  )
9
11
  from opentelemetry.semconv.ai import SpanAttributes, TraceloopSpanKindValues
@@ -56,7 +58,10 @@ def query_wrapper(tracer, wrapped, instance, args, kwargs):
56
58
  TraceloopSpanKindValues.TOOL.value,
57
59
  )
58
60
 
59
- return wrapped(*args, **kwargs)
61
+ process_request(span, args, kwargs)
62
+ res = wrapped(*args, **kwargs)
63
+ process_response(span, res)
64
+ return res
60
65
 
61
66
 
62
67
  @_with_tracer_wrapper
@@ -69,4 +74,7 @@ async def aquery_wrapper(tracer, wrapped, instance, args, kwargs):
69
74
  TraceloopSpanKindValues.TOOL.value,
70
75
  )
71
76
 
72
- return await wrapped(*args, **kwargs)
77
+ process_request(span, args, kwargs)
78
+ res = await wrapped(*args, **kwargs)
79
+ process_response(span, res)
80
+ return res
@@ -5,6 +5,8 @@ from opentelemetry.context import attach, set_value
5
5
 
6
6
  from opentelemetry.instrumentation.llamaindex.utils import (
7
7
  _with_tracer_wrapper,
8
+ process_request,
9
+ process_response,
8
10
  start_as_current_span_async,
9
11
  )
10
12
  from opentelemetry.semconv.ai import SpanAttributes, TraceloopSpanKindValues
@@ -52,7 +54,10 @@ def run_wrapper(tracer, wrapped, instance, args, kwargs):
52
54
  TraceloopSpanKindValues.WORKFLOW.value,
53
55
  )
54
56
 
55
- return wrapped(*args, **kwargs)
57
+ process_request(span, args, kwargs)
58
+ res = wrapped(*args, **kwargs)
59
+ process_response(span, res)
60
+ return res
56
61
 
57
62
 
58
63
  @_with_tracer_wrapper
@@ -67,4 +72,7 @@ async def arun_wrapper(tracer, wrapped, instance, args, kwargs):
67
72
  TraceloopSpanKindValues.WORKFLOW.value,
68
73
  )
69
74
 
70
- return await wrapped(*args, **kwargs)
75
+ process_request(span, args, kwargs)
76
+ res = await wrapped(*args, **kwargs)
77
+ process_response(span, res)
78
+ return res
@@ -5,6 +5,8 @@ from opentelemetry.context import attach, set_value
5
5
 
6
6
  from opentelemetry.instrumentation.llamaindex.utils import (
7
7
  _with_tracer_wrapper,
8
+ process_request,
9
+ process_response,
8
10
  start_as_current_span_async,
9
11
  )
10
12
  from opentelemetry.semconv.ai import SpanAttributes, TraceloopSpanKindValues
@@ -53,7 +55,10 @@ def query_wrapper(tracer, wrapped, instance, args, kwargs):
53
55
  TraceloopSpanKindValues.WORKFLOW.value,
54
56
  )
55
57
 
56
- return wrapped(*args, **kwargs)
58
+ process_request(span, args, kwargs)
59
+ res = wrapped(*args, **kwargs)
60
+ process_response(span, res)
61
+ return res
57
62
 
58
63
 
59
64
  @_with_tracer_wrapper
@@ -68,4 +73,7 @@ async def aquery_wrapper(tracer, wrapped, instance, args, kwargs):
68
73
  TraceloopSpanKindValues.WORKFLOW.value,
69
74
  )
70
75
 
71
- return await wrapped(*args, **kwargs)
76
+ process_request(span, args, kwargs)
77
+ res = await wrapped(*args, **kwargs)
78
+ process_response(span, res)
79
+ return res
@@ -1,3 +1,5 @@
1
+ import dataclasses
2
+ import json
1
3
  import os
2
4
  import logging
3
5
  import traceback
@@ -5,6 +7,7 @@ from contextlib import asynccontextmanager
5
7
 
6
8
  from opentelemetry import context as context_api
7
9
  from opentelemetry.instrumentation.llamaindex.config import Config
10
+ from opentelemetry.semconv.ai import SpanAttributes
8
11
 
9
12
 
10
13
  def _with_tracer_wrapper(func):
@@ -52,3 +55,32 @@ def dont_throw(func):
52
55
  Config.exception_logger(e)
53
56
 
54
57
  return wrapper
58
+
59
+
60
+ class JSONEncoder(json.JSONEncoder):
61
+ def default(self, o):
62
+ if dataclasses.is_dataclass(o):
63
+ return dataclasses.asdict(o)
64
+ elif hasattr(o, "json"):
65
+ return o.json()
66
+ elif hasattr(o, "to_json"):
67
+ return o.to_json()
68
+ return super().default(o)
69
+
70
+
71
+ @dont_throw
72
+ def process_request(span, args, kwargs):
73
+ if should_send_prompts():
74
+ span.set_attribute(
75
+ SpanAttributes.TRACELOOP_ENTITY_INPUT,
76
+ json.dumps({"args": args, "kwargs": kwargs}, cls=JSONEncoder),
77
+ )
78
+
79
+
80
+ @dont_throw
81
+ def process_response(span, res):
82
+ if should_send_prompts():
83
+ span.set_attribute(
84
+ SpanAttributes.TRACELOOP_ENTITY_OUTPUT,
85
+ json.dumps(res, cls=JSONEncoder),
86
+ )
@@ -1 +1 @@
1
- __version__ = "0.24.0"
1
+ __version__ = "0.25.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opentelemetry-instrumentation-llamaindex
3
- Version: 0.24.0
3
+ Version: 0.25.1
4
4
  Summary: OpenTelemetry LlamaIndex instrumentation
5
5
  Home-page: https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-llamaindex
6
6
  License: Apache-2.0
@@ -18,7 +18,7 @@ Requires-Dist: inflection (>=0.5.1,<0.6.0)
18
18
  Requires-Dist: opentelemetry-api (>=1.25.0,<2.0.0)
19
19
  Requires-Dist: opentelemetry-instrumentation (>=0.46b0,<0.47)
20
20
  Requires-Dist: opentelemetry-semantic-conventions (>=0.46b0,<0.47)
21
- Requires-Dist: opentelemetry-semantic-conventions-ai (==0.3.3)
21
+ Requires-Dist: opentelemetry-semantic-conventions-ai (==0.3.4)
22
22
  Project-URL: Repository, https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-llamaindex
23
23
  Description-Content-Type: text/markdown
24
24
 
@@ -1,16 +1,16 @@
1
1
  opentelemetry/instrumentation/llamaindex/__init__.py,sha256=xVgDrVrDSVLC93OAk9hIvzBybBoKCtquGSV2-2Y_P5E,2318
2
- opentelemetry/instrumentation/llamaindex/base_agent_instrumentor.py,sha256=5orAAgeGzNh5uIQzMZML8WMHSAJpFo0C5EINoif4pTc,2246
2
+ opentelemetry/instrumentation/llamaindex/base_agent_instrumentor.py,sha256=rJPlI4w-2LgKlKEEwPiU4Zvr7uot-BOzFYhH5mkU-mE,2485
3
3
  opentelemetry/instrumentation/llamaindex/base_embedding_instrumentor.py,sha256=xbw3gD4OT_CObMOIV3vvLTV1V4obr3PgoiON5u2zd64,2055
4
- opentelemetry/instrumentation/llamaindex/base_retriever_instrumentor.py,sha256=ipQozp1_4RE2pLPpWFuDgDOtv_GKPh5PocZRO3_LZWA,1955
5
- opentelemetry/instrumentation/llamaindex/base_synthesizer_instrumentor.py,sha256=NCgwwZthjq4fdZj-U0m14qZY-2BoEow4H7t5tVr4EAs,1974
6
- opentelemetry/instrumentation/llamaindex/base_tool_instrumentor.py,sha256=6a5NMPOI9B_oDy7zlAkA6-u5Kqt1fXcbnxx7Xw-E2M4,2359
4
+ opentelemetry/instrumentation/llamaindex/base_retriever_instrumentor.py,sha256=FBm4lvzbwBU0S9RpjP-yqTgnfLCGau8YDcCt2KtNE0g,2194
5
+ opentelemetry/instrumentation/llamaindex/base_synthesizer_instrumentor.py,sha256=voT7sIlKN_ftdKS2wmKY4pej6YWjQEDzhbfa61LRtxs,2213
6
+ opentelemetry/instrumentation/llamaindex/base_tool_instrumentor.py,sha256=Krvy1h8W-Cs7gPBh6Dg6HfRuY_HbhXxs6KuvsvC4q0w,2598
7
7
  opentelemetry/instrumentation/llamaindex/config.py,sha256=CtypZov_ytI9nSrfN9lWnjcufbAR9sfkXRA0OstDEUw,42
8
8
  opentelemetry/instrumentation/llamaindex/custom_llm_instrumentor.py,sha256=9b9I3WDE0icnYtDpkiFChpl7fwadQnUCryHc3pPi6nM,5936
9
- opentelemetry/instrumentation/llamaindex/query_pipeline_instrumentor.py,sha256=Z84cNWnjjMlVRDUE2Jyb0LIYUVqMvf_7YsQ9vQjXrmw,2097
10
- opentelemetry/instrumentation/llamaindex/retriever_query_engine_instrumentor.py,sha256=mlpyxZ51nYDqdo_O8BSdzBdbmNpD9ejokbIYaejGFPs,2228
11
- opentelemetry/instrumentation/llamaindex/utils.py,sha256=39q5U64UkSoiMVTTzSFMX4xdFyzZFUhiXM5I_OH6kIU,1496
12
- opentelemetry/instrumentation/llamaindex/version.py,sha256=DxtMZD542lg_xb6icrE2d5JOY8oUi-v34i2Ar63ddvs,23
13
- opentelemetry_instrumentation_llamaindex-0.24.0.dist-info/METADATA,sha256=yepK5Vr6EhpGUZAfR4_YZUBEWbkptwxQw6eRkjr-Gow,2285
14
- opentelemetry_instrumentation_llamaindex-0.24.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
15
- opentelemetry_instrumentation_llamaindex-0.24.0.dist-info/entry_points.txt,sha256=gtV40W4oFCp6VNvgowTKa0zQjfIrvfdlYflgGdSsA5A,106
16
- opentelemetry_instrumentation_llamaindex-0.24.0.dist-info/RECORD,,
9
+ opentelemetry/instrumentation/llamaindex/query_pipeline_instrumentor.py,sha256=6cbZSOqyn1uRC7TMuIYxfmgTvQhuFu_1IeY_ClX_Fcg,2336
10
+ opentelemetry/instrumentation/llamaindex/retriever_query_engine_instrumentor.py,sha256=ZSD0PwcZeh50uUJ_b_C4qFRsc0yjNFDDlsEOUbEIQpc,2467
11
+ opentelemetry/instrumentation/llamaindex/utils.py,sha256=u5F80iSqg4sZst6KYwcxvJeC73nr2IN3hFACKf-mtBc,2349
12
+ opentelemetry/instrumentation/llamaindex/version.py,sha256=ACu2Z3Q3TFgYpAno_eu9ssJ1QULjNXvjGvyqDSHrQ_o,23
13
+ opentelemetry_instrumentation_llamaindex-0.25.1.dist-info/METADATA,sha256=sKRSOSya6mC5-KLYFHzdczJnzJF5WVWNI-G7LZhHE-M,2285
14
+ opentelemetry_instrumentation_llamaindex-0.25.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
15
+ opentelemetry_instrumentation_llamaindex-0.25.1.dist-info/entry_points.txt,sha256=gtV40W4oFCp6VNvgowTKa0zQjfIrvfdlYflgGdSsA5A,106
16
+ opentelemetry_instrumentation_llamaindex-0.25.1.dist-info/RECORD,,