openlit 1.34.30__py3-none-any.whl → 1.34.31__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.
Files changed (168) hide show
  1. openlit/__helpers.py +235 -86
  2. openlit/__init__.py +16 -13
  3. openlit/_instrumentors.py +2 -1
  4. openlit/evals/all.py +50 -21
  5. openlit/evals/bias_detection.py +47 -20
  6. openlit/evals/hallucination.py +53 -22
  7. openlit/evals/toxicity.py +50 -21
  8. openlit/evals/utils.py +54 -30
  9. openlit/guard/all.py +61 -19
  10. openlit/guard/prompt_injection.py +34 -14
  11. openlit/guard/restrict_topic.py +46 -15
  12. openlit/guard/sensitive_topic.py +34 -14
  13. openlit/guard/utils.py +58 -22
  14. openlit/instrumentation/ag2/__init__.py +24 -8
  15. openlit/instrumentation/ag2/ag2.py +34 -13
  16. openlit/instrumentation/ag2/async_ag2.py +34 -13
  17. openlit/instrumentation/ag2/utils.py +133 -30
  18. openlit/instrumentation/ai21/__init__.py +43 -14
  19. openlit/instrumentation/ai21/ai21.py +47 -21
  20. openlit/instrumentation/ai21/async_ai21.py +47 -21
  21. openlit/instrumentation/ai21/utils.py +299 -78
  22. openlit/instrumentation/anthropic/__init__.py +21 -4
  23. openlit/instrumentation/anthropic/anthropic.py +28 -17
  24. openlit/instrumentation/anthropic/async_anthropic.py +28 -17
  25. openlit/instrumentation/anthropic/utils.py +145 -35
  26. openlit/instrumentation/assemblyai/__init__.py +11 -2
  27. openlit/instrumentation/assemblyai/assemblyai.py +15 -4
  28. openlit/instrumentation/assemblyai/utils.py +120 -25
  29. openlit/instrumentation/astra/__init__.py +43 -10
  30. openlit/instrumentation/astra/astra.py +28 -5
  31. openlit/instrumentation/astra/async_astra.py +28 -5
  32. openlit/instrumentation/astra/utils.py +151 -55
  33. openlit/instrumentation/azure_ai_inference/__init__.py +43 -10
  34. openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +53 -21
  35. openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +53 -21
  36. openlit/instrumentation/azure_ai_inference/utils.py +307 -83
  37. openlit/instrumentation/bedrock/__init__.py +21 -4
  38. openlit/instrumentation/bedrock/bedrock.py +63 -25
  39. openlit/instrumentation/bedrock/utils.py +139 -30
  40. openlit/instrumentation/chroma/__init__.py +89 -16
  41. openlit/instrumentation/chroma/chroma.py +28 -6
  42. openlit/instrumentation/chroma/utils.py +167 -51
  43. openlit/instrumentation/cohere/__init__.py +63 -18
  44. openlit/instrumentation/cohere/async_cohere.py +63 -24
  45. openlit/instrumentation/cohere/cohere.py +63 -24
  46. openlit/instrumentation/cohere/utils.py +286 -73
  47. openlit/instrumentation/controlflow/__init__.py +35 -9
  48. openlit/instrumentation/controlflow/controlflow.py +66 -33
  49. openlit/instrumentation/crawl4ai/__init__.py +25 -10
  50. openlit/instrumentation/crawl4ai/async_crawl4ai.py +78 -31
  51. openlit/instrumentation/crawl4ai/crawl4ai.py +78 -31
  52. openlit/instrumentation/crewai/__init__.py +40 -15
  53. openlit/instrumentation/crewai/async_crewai.py +32 -7
  54. openlit/instrumentation/crewai/crewai.py +32 -7
  55. openlit/instrumentation/crewai/utils.py +159 -56
  56. openlit/instrumentation/dynamiq/__init__.py +46 -12
  57. openlit/instrumentation/dynamiq/dynamiq.py +74 -33
  58. openlit/instrumentation/elevenlabs/__init__.py +23 -4
  59. openlit/instrumentation/elevenlabs/async_elevenlabs.py +16 -4
  60. openlit/instrumentation/elevenlabs/elevenlabs.py +16 -4
  61. openlit/instrumentation/elevenlabs/utils.py +128 -25
  62. openlit/instrumentation/embedchain/__init__.py +11 -2
  63. openlit/instrumentation/embedchain/embedchain.py +68 -35
  64. openlit/instrumentation/firecrawl/__init__.py +24 -7
  65. openlit/instrumentation/firecrawl/firecrawl.py +46 -20
  66. openlit/instrumentation/google_ai_studio/__init__.py +45 -10
  67. openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +67 -44
  68. openlit/instrumentation/google_ai_studio/google_ai_studio.py +67 -44
  69. openlit/instrumentation/google_ai_studio/utils.py +180 -67
  70. openlit/instrumentation/gpt4all/__init__.py +22 -7
  71. openlit/instrumentation/gpt4all/gpt4all.py +67 -29
  72. openlit/instrumentation/gpt4all/utils.py +285 -61
  73. openlit/instrumentation/gpu/__init__.py +128 -47
  74. openlit/instrumentation/groq/__init__.py +21 -4
  75. openlit/instrumentation/groq/async_groq.py +33 -21
  76. openlit/instrumentation/groq/groq.py +33 -21
  77. openlit/instrumentation/groq/utils.py +192 -55
  78. openlit/instrumentation/haystack/__init__.py +70 -24
  79. openlit/instrumentation/haystack/async_haystack.py +28 -6
  80. openlit/instrumentation/haystack/haystack.py +28 -6
  81. openlit/instrumentation/haystack/utils.py +196 -74
  82. openlit/instrumentation/julep/__init__.py +69 -19
  83. openlit/instrumentation/julep/async_julep.py +53 -27
  84. openlit/instrumentation/julep/julep.py +53 -28
  85. openlit/instrumentation/langchain/__init__.py +74 -63
  86. openlit/instrumentation/langchain/callback_handler.py +1100 -0
  87. openlit/instrumentation/langchain_community/__init__.py +13 -2
  88. openlit/instrumentation/langchain_community/async_langchain_community.py +23 -5
  89. openlit/instrumentation/langchain_community/langchain_community.py +23 -5
  90. openlit/instrumentation/langchain_community/utils.py +35 -9
  91. openlit/instrumentation/letta/__init__.py +68 -15
  92. openlit/instrumentation/letta/letta.py +99 -54
  93. openlit/instrumentation/litellm/__init__.py +43 -14
  94. openlit/instrumentation/litellm/async_litellm.py +51 -26
  95. openlit/instrumentation/litellm/litellm.py +51 -26
  96. openlit/instrumentation/litellm/utils.py +304 -102
  97. openlit/instrumentation/llamaindex/__init__.py +267 -90
  98. openlit/instrumentation/llamaindex/async_llamaindex.py +28 -6
  99. openlit/instrumentation/llamaindex/llamaindex.py +28 -6
  100. openlit/instrumentation/llamaindex/utils.py +204 -91
  101. openlit/instrumentation/mem0/__init__.py +11 -2
  102. openlit/instrumentation/mem0/mem0.py +50 -29
  103. openlit/instrumentation/milvus/__init__.py +10 -2
  104. openlit/instrumentation/milvus/milvus.py +31 -6
  105. openlit/instrumentation/milvus/utils.py +166 -67
  106. openlit/instrumentation/mistral/__init__.py +63 -18
  107. openlit/instrumentation/mistral/async_mistral.py +63 -24
  108. openlit/instrumentation/mistral/mistral.py +63 -24
  109. openlit/instrumentation/mistral/utils.py +277 -69
  110. openlit/instrumentation/multion/__init__.py +69 -19
  111. openlit/instrumentation/multion/async_multion.py +57 -26
  112. openlit/instrumentation/multion/multion.py +57 -26
  113. openlit/instrumentation/ollama/__init__.py +39 -18
  114. openlit/instrumentation/ollama/async_ollama.py +57 -26
  115. openlit/instrumentation/ollama/ollama.py +57 -26
  116. openlit/instrumentation/ollama/utils.py +226 -50
  117. openlit/instrumentation/openai/__init__.py +156 -32
  118. openlit/instrumentation/openai/async_openai.py +147 -67
  119. openlit/instrumentation/openai/openai.py +150 -67
  120. openlit/instrumentation/openai/utils.py +657 -185
  121. openlit/instrumentation/openai_agents/__init__.py +5 -1
  122. openlit/instrumentation/openai_agents/processor.py +110 -90
  123. openlit/instrumentation/phidata/__init__.py +13 -5
  124. openlit/instrumentation/phidata/phidata.py +67 -32
  125. openlit/instrumentation/pinecone/__init__.py +48 -9
  126. openlit/instrumentation/pinecone/async_pinecone.py +27 -5
  127. openlit/instrumentation/pinecone/pinecone.py +27 -5
  128. openlit/instrumentation/pinecone/utils.py +153 -47
  129. openlit/instrumentation/premai/__init__.py +22 -7
  130. openlit/instrumentation/premai/premai.py +51 -26
  131. openlit/instrumentation/premai/utils.py +246 -59
  132. openlit/instrumentation/pydantic_ai/__init__.py +49 -22
  133. openlit/instrumentation/pydantic_ai/pydantic_ai.py +69 -16
  134. openlit/instrumentation/pydantic_ai/utils.py +89 -24
  135. openlit/instrumentation/qdrant/__init__.py +19 -4
  136. openlit/instrumentation/qdrant/async_qdrant.py +33 -7
  137. openlit/instrumentation/qdrant/qdrant.py +33 -7
  138. openlit/instrumentation/qdrant/utils.py +228 -93
  139. openlit/instrumentation/reka/__init__.py +23 -10
  140. openlit/instrumentation/reka/async_reka.py +17 -11
  141. openlit/instrumentation/reka/reka.py +17 -11
  142. openlit/instrumentation/reka/utils.py +138 -36
  143. openlit/instrumentation/together/__init__.py +44 -12
  144. openlit/instrumentation/together/async_together.py +50 -27
  145. openlit/instrumentation/together/together.py +50 -27
  146. openlit/instrumentation/together/utils.py +301 -71
  147. openlit/instrumentation/transformers/__init__.py +2 -1
  148. openlit/instrumentation/transformers/transformers.py +13 -3
  149. openlit/instrumentation/transformers/utils.py +139 -36
  150. openlit/instrumentation/vertexai/__init__.py +81 -16
  151. openlit/instrumentation/vertexai/async_vertexai.py +33 -15
  152. openlit/instrumentation/vertexai/utils.py +123 -27
  153. openlit/instrumentation/vertexai/vertexai.py +33 -15
  154. openlit/instrumentation/vllm/__init__.py +12 -5
  155. openlit/instrumentation/vllm/utils.py +121 -31
  156. openlit/instrumentation/vllm/vllm.py +16 -10
  157. openlit/otel/events.py +35 -10
  158. openlit/otel/metrics.py +32 -24
  159. openlit/otel/tracing.py +24 -9
  160. openlit/semcov/__init__.py +72 -6
  161. {openlit-1.34.30.dist-info → openlit-1.34.31.dist-info}/METADATA +2 -1
  162. openlit-1.34.31.dist-info/RECORD +166 -0
  163. openlit/instrumentation/langchain/async_langchain.py +0 -102
  164. openlit/instrumentation/langchain/langchain.py +0 -102
  165. openlit/instrumentation/langchain/utils.py +0 -252
  166. openlit-1.34.30.dist-info/RECORD +0 -168
  167. {openlit-1.34.30.dist-info → openlit-1.34.31.dist-info}/LICENSE +0 -0
  168. {openlit-1.34.30.dist-info → openlit-1.34.31.dist-info}/WHEEL +0 -0
@@ -8,12 +8,11 @@ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
8
8
  from wrapt import wrap_function_wrapper
9
9
 
10
10
  from openlit.instrumentation.llamaindex.llamaindex import general_wrap
11
- from openlit.instrumentation.llamaindex.async_llamaindex import (
12
- async_general_wrap
13
- )
11
+ from openlit.instrumentation.llamaindex.async_llamaindex import async_general_wrap
14
12
 
15
13
  _instruments = ("llama-index >= 0.10.0",)
16
14
 
15
+
17
16
  class LlamaIndexInstrumentor(BaseInstrumentor):
18
17
  """Framework guide compliant instrumentor with optimized performance"""
19
18
 
@@ -34,119 +33,279 @@ class LlamaIndexInstrumentor(BaseInstrumentor):
34
33
  # === WORKFLOW OPERATIONS (Always enabled) - 17 operations ===
35
34
  workflow_operations = [
36
35
  # Document Loading & Processing Pipeline
37
- ("llama_index.core.readers", "SimpleDirectoryReader.load_data",
38
- "document_load"),
39
- ("llama_index.core.readers.base", "BaseReader.load_data",
40
- "document_load"),
41
- ("llama_index.core.document_transformer",
42
- "DocumentTransformer.transform", "document_transform"),
43
- ("llama_index.core.node_parser",
44
- "SentenceSplitter.get_nodes_from_documents", "document_split"),
36
+ (
37
+ "llama_index.core.readers",
38
+ "SimpleDirectoryReader.load_data",
39
+ "document_load",
40
+ ),
41
+ ("llama_index.core.readers.base", "BaseReader.load_data", "document_load"),
42
+ (
43
+ "llama_index.core.document_transformer",
44
+ "DocumentTransformer.transform",
45
+ "document_transform",
46
+ ),
47
+ (
48
+ "llama_index.core.node_parser",
49
+ "SentenceSplitter.get_nodes_from_documents",
50
+ "document_split",
51
+ ),
45
52
  # Index Construction & Management
46
- ("llama_index.core.indices.vector_store.base",
47
- "VectorStoreIndex.from_documents", "index_construct"),
48
- ("llama_index.core.indices.vector_store.base",
49
- "VectorStoreIndex.from_vector_store", "index_construct"),
50
- ("llama_index.core.indices.list.base", "ListIndex.from_documents",
51
- "index_construct"),
52
- ("llama_index.core.indices.tree.base", "TreeIndex.from_documents",
53
- "index_construct"),
53
+ (
54
+ "llama_index.core.indices.vector_store.base",
55
+ "VectorStoreIndex.from_documents",
56
+ "index_construct",
57
+ ),
58
+ (
59
+ "llama_index.core.indices.vector_store.base",
60
+ "VectorStoreIndex.from_vector_store",
61
+ "index_construct",
62
+ ),
63
+ (
64
+ "llama_index.core.indices.list.base",
65
+ "ListIndex.from_documents",
66
+ "index_construct",
67
+ ),
68
+ (
69
+ "llama_index.core.indices.tree.base",
70
+ "TreeIndex.from_documents",
71
+ "index_construct",
72
+ ),
54
73
  # Query Engine Operations
55
- ("llama_index.core.indices.base", "BaseIndex.as_query_engine",
56
- "query_engine_create"),
57
- ("llama_index.core.query_engine.retriever_query_engine",
58
- "RetrieverQueryEngine.query", "query_engine_query"),
59
- ("llama_index.core.query_engine.transform_query_engine",
60
- "TransformQueryEngine.query", "query_engine_query"),
74
+ (
75
+ "llama_index.core.indices.base",
76
+ "BaseIndex.as_query_engine",
77
+ "query_engine_create",
78
+ ),
79
+ (
80
+ "llama_index.core.query_engine.retriever_query_engine",
81
+ "RetrieverQueryEngine.query",
82
+ "query_engine_query",
83
+ ),
84
+ (
85
+ "llama_index.core.query_engine.transform_query_engine",
86
+ "TransformQueryEngine.query",
87
+ "query_engine_query",
88
+ ),
61
89
  # Retrieval Operations
62
- ("llama_index.core.indices.base", "BaseIndex.as_retriever",
63
- "retriever_create"),
64
- ("llama_index.core.indices.vector_store.retrievers.retriever",
65
- "VectorIndexRetriever.retrieve", "retriever_retrieve"),
66
- ("llama_index.core.retrievers.base", "BaseRetriever.retrieve",
67
- "retriever_retrieve"),
90
+ (
91
+ "llama_index.core.indices.base",
92
+ "BaseIndex.as_retriever",
93
+ "retriever_create",
94
+ ),
95
+ (
96
+ "llama_index.core.indices.vector_store.retrievers.retriever",
97
+ "VectorIndexRetriever.retrieve",
98
+ "retriever_retrieve",
99
+ ),
100
+ (
101
+ "llama_index.core.retrievers.base",
102
+ "BaseRetriever.retrieve",
103
+ "retriever_retrieve",
104
+ ),
68
105
  # LLM & Embedding Operations
69
106
  ("llama_index.core.llms.llm", "LLM.complete", "llm_complete"),
70
107
  ("llama_index.core.llms.llm", "LLM.chat", "llm_chat"),
71
- ("llama_index.core.embeddings.base",
72
- "BaseEmbedding.get_text_embedding_batch", "embedding_generate"),
108
+ (
109
+ "llama_index.core.embeddings.base",
110
+ "BaseEmbedding.get_text_embedding_batch",
111
+ "embedding_generate",
112
+ ),
73
113
  ]
74
114
 
75
115
  # === ASYNC OPERATIONS - 13 operations ===
76
116
  async_operations = [
77
- ("llama_index.core.readers", "SimpleDirectoryReader.aload_data", "document_load_async"),
78
- ("llama_index.core.readers.base", "BaseReader.aload_data", "document_load_async"),
79
- ("llama_index.core.query_engine.retriever_query_engine", "RetrieverQueryEngine.aquery", "query_engine_query_async"),
80
- ("llama_index.core.query_engine.transform_query_engine", "TransformQueryEngine.aquery", "query_engine_query_async"),
81
- ("llama_index.core.indices.vector_store.retrievers.retriever",
82
- "VectorIndexRetriever.aretrieve", "retriever_retrieve_async"),
83
- ("llama_index.core.retrievers.base", "BaseRetriever.aretrieve", "retriever_retrieve_async"),
84
- ("llama_index.core.embeddings.base", "BaseEmbedding.aget_text_embedding", "embedding_generate_async"),
85
- ("llama_index.core.embeddings.base", "BaseEmbedding.aget_text_embedding_batch", "embedding_generate_async"),
117
+ (
118
+ "llama_index.core.readers",
119
+ "SimpleDirectoryReader.aload_data",
120
+ "document_load_async",
121
+ ),
122
+ (
123
+ "llama_index.core.readers.base",
124
+ "BaseReader.aload_data",
125
+ "document_load_async",
126
+ ),
127
+ (
128
+ "llama_index.core.query_engine.retriever_query_engine",
129
+ "RetrieverQueryEngine.aquery",
130
+ "query_engine_query_async",
131
+ ),
132
+ (
133
+ "llama_index.core.query_engine.transform_query_engine",
134
+ "TransformQueryEngine.aquery",
135
+ "query_engine_query_async",
136
+ ),
137
+ (
138
+ "llama_index.core.indices.vector_store.retrievers.retriever",
139
+ "VectorIndexRetriever.aretrieve",
140
+ "retriever_retrieve_async",
141
+ ),
142
+ (
143
+ "llama_index.core.retrievers.base",
144
+ "BaseRetriever.aretrieve",
145
+ "retriever_retrieve_async",
146
+ ),
147
+ (
148
+ "llama_index.core.embeddings.base",
149
+ "BaseEmbedding.aget_text_embedding",
150
+ "embedding_generate_async",
151
+ ),
152
+ (
153
+ "llama_index.core.embeddings.base",
154
+ "BaseEmbedding.aget_text_embedding_batch",
155
+ "embedding_generate_async",
156
+ ),
86
157
  ("llama_index.core.llms.llm", "LLM.acomplete", "llm_complete_async"),
87
158
  ("llama_index.core.llms.llm", "LLM.achat", "llm_chat_async"),
88
159
  ("llama_index.core.llms.llm", "LLM.astream_complete", "llm_stream_async"),
89
160
  ("llama_index.core.llms.llm", "LLM.astream_chat", "llm_stream_async"),
90
- ("llama_index.core.response_synthesizers.base", "BaseSynthesizer.asynthesize", "response_generate_async"),
161
+ (
162
+ "llama_index.core.response_synthesizers.base",
163
+ "BaseSynthesizer.asynthesize",
164
+ "response_generate_async",
165
+ ),
91
166
  ]
92
167
 
93
168
  # === COMPONENT OPERATIONS (Detailed tracing only) - 25 operations ===
94
169
  component_operations = [
95
170
  # Text Processing Components
96
- ("llama_index.core.node_parser.text.sentence", "SentenceSplitter.split_text", "text_splitter_split"),
97
- ("llama_index.core.node_parser.text.sentence", "SentenceSplitter._postprocess_nodes", "text_splitter_postprocess"),
98
- ("llama_index.core.node_parser.interface", "NodeParser.get_nodes_from_node", "node_parser_parse"),
99
-
171
+ (
172
+ "llama_index.core.node_parser.text.sentence",
173
+ "SentenceSplitter.split_text",
174
+ "text_splitter_split",
175
+ ),
176
+ (
177
+ "llama_index.core.node_parser.text.sentence",
178
+ "SentenceSplitter._postprocess_nodes",
179
+ "text_splitter_postprocess",
180
+ ),
181
+ (
182
+ "llama_index.core.node_parser.interface",
183
+ "NodeParser.get_nodes_from_node",
184
+ "node_parser_parse",
185
+ ),
100
186
  # Embedding Processing Components
101
- ("llama_index.core.embeddings.base", "BaseEmbedding._get_text_embeddings", "embedding_encode"),
102
- ("llama_index.core.embeddings.utils", "embed_nodes", "embedding_embed_nodes"),
187
+ (
188
+ "llama_index.core.embeddings.base",
189
+ "BaseEmbedding._get_text_embeddings",
190
+ "embedding_encode",
191
+ ),
192
+ (
193
+ "llama_index.core.embeddings.utils",
194
+ "embed_nodes",
195
+ "embedding_embed_nodes",
196
+ ),
103
197
  ("llama_index.core.embeddings.utils", "similarity", "embedding_similarity"),
104
-
105
198
  # Retrieval Processing Components
106
- ("llama_index.core.retrievers.base", "BaseRetriever._retrieve_nodes", "retrieval_retrieve_nodes"),
107
- ("llama_index.core.indices.vector_store.retrievers.retriever",
108
- "VectorIndexRetriever._get_nodes_with_embeddings", "retrieval_get_nodes"),
109
- ("llama_index.core.indices.vector_store.retrievers.retriever",
110
- "VectorIndexRetriever._build_node_list_from_query_result", "retrieval_build_nodes"),
111
- ("llama_index.core.postprocessor.node",
112
- "BaseNodePostprocessor.postprocess_nodes", "postprocessor_process"),
113
-
199
+ (
200
+ "llama_index.core.retrievers.base",
201
+ "BaseRetriever._retrieve_nodes",
202
+ "retrieval_retrieve_nodes",
203
+ ),
204
+ (
205
+ "llama_index.core.indices.vector_store.retrievers.retriever",
206
+ "VectorIndexRetriever._get_nodes_with_embeddings",
207
+ "retrieval_get_nodes",
208
+ ),
209
+ (
210
+ "llama_index.core.indices.vector_store.retrievers.retriever",
211
+ "VectorIndexRetriever._build_node_list_from_query_result",
212
+ "retrieval_build_nodes",
213
+ ),
214
+ (
215
+ "llama_index.core.postprocessor.node",
216
+ "BaseNodePostprocessor.postprocess_nodes",
217
+ "postprocessor_process",
218
+ ),
114
219
  # Response Generation Components
115
- ("llama_index.core.response_synthesizers.base",
116
- "BaseSynthesizer.synthesize", "response_synthesize"),
117
- ("llama_index.core.response_synthesizers.compact_and_refine",
118
- "CompactAndRefine.get_response", "response_compact_refine"),
119
- ("llama_index.core.response_synthesizers.tree_summarize",
120
- "TreeSummarize.get_response", "response_tree_summarize"),
121
-
220
+ (
221
+ "llama_index.core.response_synthesizers.base",
222
+ "BaseSynthesizer.synthesize",
223
+ "response_synthesize",
224
+ ),
225
+ (
226
+ "llama_index.core.response_synthesizers.compact_and_refine",
227
+ "CompactAndRefine.get_response",
228
+ "response_compact_refine",
229
+ ),
230
+ (
231
+ "llama_index.core.response_synthesizers.tree_summarize",
232
+ "TreeSummarize.get_response",
233
+ "response_tree_summarize",
234
+ ),
122
235
  # Vector Store Components
123
- ("llama_index.core.vector_stores.simple", "SimpleVectorStore.add", "vector_store_add"),
124
- ("llama_index.core.vector_stores.simple", "SimpleVectorStore.delete", "vector_store_delete"),
125
- ("llama_index.core.vector_stores.simple", "SimpleVectorStore.query", "vector_store_query"),
126
-
236
+ (
237
+ "llama_index.core.vector_stores.simple",
238
+ "SimpleVectorStore.add",
239
+ "vector_store_add",
240
+ ),
241
+ (
242
+ "llama_index.core.vector_stores.simple",
243
+ "SimpleVectorStore.delete",
244
+ "vector_store_delete",
245
+ ),
246
+ (
247
+ "llama_index.core.vector_stores.simple",
248
+ "SimpleVectorStore.query",
249
+ "vector_store_query",
250
+ ),
127
251
  # Index Maintenance Components
128
- ("llama_index.core.indices.vector_store.base", "VectorStoreIndex._insert", "index_insert"),
129
- ("llama_index.core.indices.vector_store.base", "VectorStoreIndex._delete_node", "index_delete"),
130
- ("llama_index.core.indices.vector_store.base", "VectorStoreIndex._build_index_from_nodes", "index_build"),
131
-
252
+ (
253
+ "llama_index.core.indices.vector_store.base",
254
+ "VectorStoreIndex._insert",
255
+ "index_insert",
256
+ ),
257
+ (
258
+ "llama_index.core.indices.vector_store.base",
259
+ "VectorStoreIndex._delete_node",
260
+ "index_delete",
261
+ ),
262
+ (
263
+ "llama_index.core.indices.vector_store.base",
264
+ "VectorStoreIndex._build_index_from_nodes",
265
+ "index_build",
266
+ ),
132
267
  # Additional Framework Components
133
268
  ("llama_index.core.schema", "Document.get_content", "document_get_content"),
134
269
  ("llama_index.core.schema", "TextNode.get_content", "node_get_content"),
135
- ("llama_index.core.schema", "TextNode.get_metadata_str", "node_get_metadata"),
136
- ("llama_index.core.readers.base", "BaseReader._extract_metadata", "document_extract_metadata"),
137
- ("llama_index.core.vector_stores.utils", "node_to_metadata_dict", "embedding_metadata"),
138
- ("llama_index.core.query_engine.retriever_query_engine",
139
- "RetrieverQueryEngine._prepare_response_builder", "query_prepare_response"),
270
+ (
271
+ "llama_index.core.schema",
272
+ "TextNode.get_metadata_str",
273
+ "node_get_metadata",
274
+ ),
275
+ (
276
+ "llama_index.core.readers.base",
277
+ "BaseReader._extract_metadata",
278
+ "document_extract_metadata",
279
+ ),
280
+ (
281
+ "llama_index.core.vector_stores.utils",
282
+ "node_to_metadata_dict",
283
+ "embedding_metadata",
284
+ ),
285
+ (
286
+ "llama_index.core.query_engine.retriever_query_engine",
287
+ "RetrieverQueryEngine._prepare_response_builder",
288
+ "query_prepare_response",
289
+ ),
140
290
  ]
141
291
 
142
292
  # Wrap workflow operations (always enabled)
143
293
  for module, method, operation_type in workflow_operations:
144
294
  try:
145
295
  wrap_function_wrapper(
146
- module, method,
147
- general_wrap(operation_type, version, environment, application_name,
148
- tracer, pricing_info, capture_message_content,
149
- metrics, disable_metrics)
296
+ module,
297
+ method,
298
+ general_wrap(
299
+ operation_type,
300
+ version,
301
+ environment,
302
+ application_name,
303
+ tracer,
304
+ pricing_info,
305
+ capture_message_content,
306
+ metrics,
307
+ disable_metrics,
308
+ ),
150
309
  )
151
310
  except Exception:
152
311
  pass
@@ -155,10 +314,19 @@ class LlamaIndexInstrumentor(BaseInstrumentor):
155
314
  for module, method, operation_type in async_operations:
156
315
  try:
157
316
  wrap_function_wrapper(
158
- module, method,
159
- async_general_wrap(operation_type, version, environment,
160
- application_name, tracer, pricing_info,
161
- capture_message_content, metrics, disable_metrics)
317
+ module,
318
+ method,
319
+ async_general_wrap(
320
+ operation_type,
321
+ version,
322
+ environment,
323
+ application_name,
324
+ tracer,
325
+ pricing_info,
326
+ capture_message_content,
327
+ metrics,
328
+ disable_metrics,
329
+ ),
162
330
  )
163
331
  except Exception:
164
332
  pass
@@ -168,10 +336,19 @@ class LlamaIndexInstrumentor(BaseInstrumentor):
168
336
  for module, method, operation_type in component_operations:
169
337
  try:
170
338
  wrap_function_wrapper(
171
- module, method,
172
- general_wrap(operation_type, version, environment,
173
- application_name, tracer, pricing_info,
174
- capture_message_content, metrics, disable_metrics)
339
+ module,
340
+ method,
341
+ general_wrap(
342
+ operation_type,
343
+ version,
344
+ environment,
345
+ application_name,
346
+ tracer,
347
+ pricing_info,
348
+ capture_message_content,
349
+ metrics,
350
+ disable_metrics,
351
+ ),
175
352
  )
176
353
  except Exception:
177
354
  pass
@@ -12,8 +12,18 @@ from openlit.instrumentation.llamaindex.utils import (
12
12
  set_server_address_and_port,
13
13
  )
14
14
 
15
- def async_general_wrap(gen_ai_endpoint, version, environment, application_name,
16
- tracer, pricing_info, capture_message_content, metrics, disable_metrics):
15
+
16
+ def async_general_wrap(
17
+ gen_ai_endpoint,
18
+ version,
19
+ environment,
20
+ application_name,
21
+ tracer,
22
+ pricing_info,
23
+ capture_message_content,
24
+ metrics,
25
+ disable_metrics,
26
+ ):
17
27
  """
18
28
  Generates a telemetry wrapper for LlamaIndex async function calls.
19
29
  """
@@ -39,10 +49,22 @@ def async_general_wrap(gen_ai_endpoint, version, environment, application_name,
39
49
  try:
40
50
  # Process response and generate telemetry
41
51
  response = process_llamaindex_response(
42
- response, operation_type, server_address, server_port,
43
- environment, application_name, metrics, start_time, span,
44
- capture_message_content, disable_metrics, version,
45
- instance, args, endpoint=gen_ai_endpoint, **kwargs
52
+ response,
53
+ operation_type,
54
+ server_address,
55
+ server_port,
56
+ environment,
57
+ application_name,
58
+ metrics,
59
+ start_time,
60
+ span,
61
+ capture_message_content,
62
+ disable_metrics,
63
+ version,
64
+ instance,
65
+ args,
66
+ endpoint=gen_ai_endpoint,
67
+ **kwargs,
46
68
  )
47
69
 
48
70
  except Exception as e:
@@ -13,8 +13,18 @@ from openlit.instrumentation.llamaindex.utils import (
13
13
  set_server_address_and_port,
14
14
  )
15
15
 
16
- def general_wrap(gen_ai_endpoint, version, environment, application_name,
17
- tracer, pricing_info, capture_message_content, metrics, disable_metrics):
16
+
17
+ def general_wrap(
18
+ gen_ai_endpoint,
19
+ version,
20
+ environment,
21
+ application_name,
22
+ tracer,
23
+ pricing_info,
24
+ capture_message_content,
25
+ metrics,
26
+ disable_metrics,
27
+ ):
18
28
  """
19
29
  Generates a telemetry wrapper for LlamaIndex function calls.
20
30
  """
@@ -40,10 +50,22 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
40
50
  try:
41
51
  # Process response and generate telemetry
42
52
  response = process_llamaindex_response(
43
- response, operation_type, server_address, server_port,
44
- environment, application_name, metrics, start_time, span,
45
- capture_message_content, disable_metrics, version,
46
- instance, args, endpoint=gen_ai_endpoint, **kwargs
53
+ response,
54
+ operation_type,
55
+ server_address,
56
+ server_port,
57
+ environment,
58
+ application_name,
59
+ metrics,
60
+ start_time,
61
+ span,
62
+ capture_message_content,
63
+ disable_metrics,
64
+ version,
65
+ instance,
66
+ args,
67
+ endpoint=gen_ai_endpoint,
68
+ **kwargs,
47
69
  )
48
70
 
49
71
  except Exception as e: