nvidia-nat-ragaai 1.2.0rc5__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 nvidia-nat-ragaai might be problematic. Click here for more details.
- aiq/meta/pypi.md +23 -0
- aiq/plugins/ragaai/__init__.py +14 -0
- aiq/plugins/ragaai/mixin/__init__.py +14 -0
- aiq/plugins/ragaai/mixin/ragaai_catalyst_mixin.py +244 -0
- aiq/plugins/ragaai/ragaai_catalyst_exporter.py +68 -0
- aiq/plugins/ragaai/register.py +73 -0
- nvidia_nat_ragaai-1.2.0rc5.dist-info/METADATA +34 -0
- nvidia_nat_ragaai-1.2.0rc5.dist-info/RECORD +11 -0
- nvidia_nat_ragaai-1.2.0rc5.dist-info/WHEEL +5 -0
- nvidia_nat_ragaai-1.2.0rc5.dist-info/entry_points.txt +2 -0
- nvidia_nat_ragaai-1.2.0rc5.dist-info/top_level.txt +1 -0
aiq/meta/pypi.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
-->
|
|
17
|
+
|
|
18
|
+
.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import asyncio
|
|
17
|
+
import json
|
|
18
|
+
import logging
|
|
19
|
+
import os
|
|
20
|
+
from dataclasses import asdict
|
|
21
|
+
|
|
22
|
+
import ragaai_catalyst
|
|
23
|
+
from ragaai_catalyst.tracers.agentic_tracing.utils.trace_utils import format_interactions
|
|
24
|
+
from ragaai_catalyst.tracers.agentic_tracing.utils.zip_list_of_unique_files import zip_list_of_unique_files
|
|
25
|
+
from ragaai_catalyst.tracers.exporters import DynamicTraceExporter
|
|
26
|
+
from ragaai_catalyst.tracers.exporters.ragaai_trace_exporter import RAGATraceExporter
|
|
27
|
+
from ragaai_catalyst.tracers.exporters.ragaai_trace_exporter import TracerJSONEncoder
|
|
28
|
+
from ragaai_catalyst.tracers.utils.trace_json_converter import convert_json_format
|
|
29
|
+
|
|
30
|
+
from aiq.plugins.opentelemetry.otel_span import OtelSpan
|
|
31
|
+
|
|
32
|
+
logger = logging.getLogger(__name__)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class RAGATraceExporterOptWrite(RAGATraceExporter):
|
|
36
|
+
"""Custom RAGATraceExporter that provides optional local file writing.
|
|
37
|
+
|
|
38
|
+
This subclass of RAGATraceExporter allows control over whether the
|
|
39
|
+
rag_agent_traces.json file is written to the current directory.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
debug_mode: When False (default), creates local rag_agent_traces.json file.
|
|
43
|
+
When True, skips local file creation for cleaner operation.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
def __init__(self, *args, debug_mode: bool = False, **kwargs):
|
|
47
|
+
super().__init__(*args, **kwargs)
|
|
48
|
+
self.debug_mode = debug_mode
|
|
49
|
+
|
|
50
|
+
def prepare_trace(self, spans, trace_id):
|
|
51
|
+
try:
|
|
52
|
+
try:
|
|
53
|
+
ragaai_trace = convert_json_format(spans,
|
|
54
|
+
self.custom_model_cost,
|
|
55
|
+
self.user_context,
|
|
56
|
+
self.user_gt,
|
|
57
|
+
self.external_id)
|
|
58
|
+
except Exception as e:
|
|
59
|
+
print(f"Error in convert_json_format function: {trace_id}: {e}")
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
interactions = format_interactions(ragaai_trace)
|
|
64
|
+
if interactions and 'workflow' in interactions:
|
|
65
|
+
ragaai_trace["workflow"] = interactions['workflow']
|
|
66
|
+
except Exception as e:
|
|
67
|
+
print(f"Error in format_interactions function: {trace_id}: {e}")
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
try:
|
|
71
|
+
# Add source code hash
|
|
72
|
+
files_to_zip = self.files_to_zip or []
|
|
73
|
+
hash_id, zip_path = zip_list_of_unique_files(files_to_zip, output_dir=self.tmp_dir)
|
|
74
|
+
except Exception as e:
|
|
75
|
+
print(f"Error in zip_list_of_unique_files function: {trace_id}: {e}")
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
try:
|
|
79
|
+
ragaai_trace["metadata"]["system_info"] = asdict(self.system_monitor.get_system_info())
|
|
80
|
+
ragaai_trace["metadata"]["resources"] = asdict(self.system_monitor.get_resources())
|
|
81
|
+
except Exception as e:
|
|
82
|
+
print(f"Error in get_system_info or get_resources function: {trace_id}: {e}")
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
try:
|
|
86
|
+
ragaai_trace["metadata"]["system_info"]["source_code"] = hash_id
|
|
87
|
+
except Exception as e:
|
|
88
|
+
print(f"Error in adding source code hash: {trace_id}: {e}")
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
try:
|
|
92
|
+
if "data" in ragaai_trace and ragaai_trace["data"] and len(ragaai_trace["data"]) > 0:
|
|
93
|
+
if "start_time" in ragaai_trace:
|
|
94
|
+
ragaai_trace["data"][0]["start_time"] = ragaai_trace["start_time"]
|
|
95
|
+
if "end_time" in ragaai_trace:
|
|
96
|
+
ragaai_trace["data"][0]["end_time"] = ragaai_trace["end_time"]
|
|
97
|
+
except Exception as e:
|
|
98
|
+
print(f"Error in adding start_time or end_time: {trace_id}: {e}")
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
try:
|
|
102
|
+
if hasattr(self, 'project_name'):
|
|
103
|
+
ragaai_trace["project_name"] = self.project_name
|
|
104
|
+
except Exception as e:
|
|
105
|
+
print(f"Error in adding project name: {trace_id}: {e}")
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
try:
|
|
109
|
+
# Add tracer type to the trace
|
|
110
|
+
if hasattr(self, 'tracer_type'):
|
|
111
|
+
ragaai_trace["tracer_type"] = self.tracer_type
|
|
112
|
+
except Exception as e:
|
|
113
|
+
print(f"Error in adding tracer type: {trace_id}: {e}")
|
|
114
|
+
return None
|
|
115
|
+
|
|
116
|
+
# Add user passed metadata to the trace
|
|
117
|
+
try:
|
|
118
|
+
logger.debug("Started adding user passed metadata")
|
|
119
|
+
|
|
120
|
+
metadata = (self.user_details.get("trace_user_detail", {}).get("metadata", {})
|
|
121
|
+
if self.user_details else {})
|
|
122
|
+
|
|
123
|
+
if isinstance(metadata, dict):
|
|
124
|
+
for key, value in metadata.items():
|
|
125
|
+
if key not in {"log_source", "recorded_on"}:
|
|
126
|
+
ragaai_trace.setdefault("metadata", {})[key] = value
|
|
127
|
+
|
|
128
|
+
logger.debug("Completed adding user passed metadata")
|
|
129
|
+
except Exception as e:
|
|
130
|
+
print(f"Error in adding metadata: {trace_id}: {e}")
|
|
131
|
+
return None
|
|
132
|
+
|
|
133
|
+
try:
|
|
134
|
+
# Save the trace_json
|
|
135
|
+
trace_file_path = os.path.join(self.tmp_dir, f"{trace_id}.json")
|
|
136
|
+
with open(trace_file_path, "w", encoding="utf-8") as file:
|
|
137
|
+
json.dump(ragaai_trace, file, cls=TracerJSONEncoder, indent=2)
|
|
138
|
+
|
|
139
|
+
if self.debug_mode:
|
|
140
|
+
with open(os.path.join(os.getcwd(), 'rag_agent_traces.json'), 'w', encoding="utf-8") as f:
|
|
141
|
+
json.dump(ragaai_trace, f, cls=TracerJSONEncoder, indent=2)
|
|
142
|
+
except Exception as e:
|
|
143
|
+
print(f"Error in saving trace json: {trace_id}: {e}")
|
|
144
|
+
return None
|
|
145
|
+
|
|
146
|
+
return {'trace_file_path': trace_file_path, 'code_zip_path': zip_path, 'hash_id': hash_id}
|
|
147
|
+
except Exception as e:
|
|
148
|
+
print(f"Error converting trace {trace_id}: {str(e)}")
|
|
149
|
+
return None
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class DynamicTraceExporterOptWrite(DynamicTraceExporter):
|
|
153
|
+
"""Custom DynamicTraceExporter that uses RAGATraceExporterOptWrite internally.
|
|
154
|
+
|
|
155
|
+
This subclass of DynamicTraceExporter creates a RAGATraceExporterOptWrite
|
|
156
|
+
instance instead of the default RAGATraceExporter, providing control over
|
|
157
|
+
local file creation.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
debug_mode: When False (default), creates local rag_agent_traces.json file.
|
|
161
|
+
When True, skips local file creation for cleaner operation.
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
def __init__(self, *args, debug_mode: bool = False, **kwargs):
|
|
165
|
+
super().__init__(*args, **kwargs)
|
|
166
|
+
self._exporter = RAGATraceExporterOptWrite(*args, debug_mode=debug_mode, **kwargs)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class RagaAICatalystMixin:
|
|
170
|
+
"""Mixin for RagaAI Catalyst exporters.
|
|
171
|
+
|
|
172
|
+
This mixin provides RagaAI Catalyst-specific functionality for OpenTelemetry span exporters.
|
|
173
|
+
It handles RagaAI Catalyst project and dataset configuration and uses custom subclassed
|
|
174
|
+
exporters to control local file creation behavior.
|
|
175
|
+
|
|
176
|
+
Key Features:
|
|
177
|
+
- RagaAI Catalyst authentication with access key and secret key
|
|
178
|
+
- Project and dataset scoping for trace organization
|
|
179
|
+
- Integration with custom DynamicTraceExporter for telemetry transmission
|
|
180
|
+
- Automatic initialization of RagaAI Catalyst client
|
|
181
|
+
- Configurable local file creation via debug_mode parameter
|
|
182
|
+
|
|
183
|
+
This mixin uses subclassed exporters (RAGATraceExporterOptWrite and DynamicTraceExporterOptWrite)
|
|
184
|
+
to provide clean control over whether the rag_agent_traces.json file is created locally.
|
|
185
|
+
|
|
186
|
+
This mixin is designed to be used with OtelSpanExporter as a base class:
|
|
187
|
+
|
|
188
|
+
Example:
|
|
189
|
+
class MyCatalystExporter(OtelSpanExporter, RagaAICatalystMixin):
|
|
190
|
+
def __init__(self, base_url, access_key, secret_key, project, dataset, **kwargs):
|
|
191
|
+
super().__init__(base_url=base_url, access_key=access_key,
|
|
192
|
+
secret_key=secret_key, project=project, dataset=dataset, **kwargs)
|
|
193
|
+
"""
|
|
194
|
+
|
|
195
|
+
def __init__(self,
|
|
196
|
+
*args,
|
|
197
|
+
base_url: str,
|
|
198
|
+
access_key: str,
|
|
199
|
+
secret_key: str,
|
|
200
|
+
project: str,
|
|
201
|
+
dataset: str,
|
|
202
|
+
tracer_type: str,
|
|
203
|
+
debug_mode: bool = False,
|
|
204
|
+
**kwargs):
|
|
205
|
+
"""Initialize the RagaAI Catalyst exporter.
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
base_url: RagaAI Catalyst base URL.
|
|
209
|
+
access_key: RagaAI Catalyst access key.
|
|
210
|
+
secret_key: RagaAI Catalyst secret key.
|
|
211
|
+
project: RagaAI Catalyst project name.
|
|
212
|
+
dataset: RagaAI Catalyst dataset name.
|
|
213
|
+
tracer_type: RagaAI Catalyst tracer type.
|
|
214
|
+
debug_mode: When False (default), creates local rag_agent_traces.json file.
|
|
215
|
+
When True, skips local file creation for cleaner operation.
|
|
216
|
+
**kwargs: Additional keyword arguments passed to parent classes.
|
|
217
|
+
"""
|
|
218
|
+
logger.info("RagaAICatalystMixin initialized with debug_mode=%s", debug_mode)
|
|
219
|
+
|
|
220
|
+
ragaai_catalyst.RagaAICatalyst(access_key=access_key, secret_key=secret_key, base_url=base_url)
|
|
221
|
+
|
|
222
|
+
# Create the DynamicTraceExporter (this will trigger our hook)
|
|
223
|
+
self._exporter = DynamicTraceExporterOptWrite(project, dataset, base_url, tracer_type, debug_mode=debug_mode)
|
|
224
|
+
|
|
225
|
+
super().__init__(*args, **kwargs)
|
|
226
|
+
|
|
227
|
+
async def export_otel_spans(self, spans: list[OtelSpan]) -> None:
|
|
228
|
+
"""Export a list of OtelSpans using the custom RagaAI Catalyst exporter.
|
|
229
|
+
|
|
230
|
+
This method uses the DynamicTraceExporterOptWrite instance to export spans,
|
|
231
|
+
with local file creation controlled by the debug_mode setting.
|
|
232
|
+
|
|
233
|
+
Args:
|
|
234
|
+
spans (list[OtelSpan]): The list of spans to export.
|
|
235
|
+
|
|
236
|
+
Raises:
|
|
237
|
+
Exception: If there's an error during span export (logged but not re-raised).
|
|
238
|
+
"""
|
|
239
|
+
try:
|
|
240
|
+
# Run the blocking export operation in a thread pool to make it non-blocking
|
|
241
|
+
loop = asyncio.get_event_loop()
|
|
242
|
+
await loop.run_in_executor(None, lambda: self._exporter.export(spans)) # type: ignore[arg-type]
|
|
243
|
+
except Exception as e:
|
|
244
|
+
logger.error("Error exporting spans: %s", e, exc_info=True)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import logging
|
|
17
|
+
|
|
18
|
+
from aiq.builder.context import AIQContextState
|
|
19
|
+
from aiq.plugins.opentelemetry.otel_span_exporter import OtelSpanExporter
|
|
20
|
+
from aiq.plugins.ragaai.mixin.ragaai_catalyst_mixin import RagaAICatalystMixin
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class RagaAICatalystExporter(RagaAICatalystMixin, OtelSpanExporter): # pylint: disable=R0901
|
|
26
|
+
"""RagaAI Catalyst exporter for AI workflow observability.
|
|
27
|
+
|
|
28
|
+
Exports OpenTelemetry-compatible traces to RagaAI Catalyst for visualization
|
|
29
|
+
and analysis of AI agent behavior and performance.
|
|
30
|
+
|
|
31
|
+
Features:
|
|
32
|
+
- Automatic span conversion from AIQ events
|
|
33
|
+
- RagaAI Catalyst-specific authentication
|
|
34
|
+
- Project and dataset-based trace organization
|
|
35
|
+
- Integration with custom DynamicTraceExporter for optimal local file control
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
context_state: Execution context for isolation
|
|
39
|
+
base_url: RagaAI Catalyst base URL
|
|
40
|
+
access_key: RagaAI Catalyst access key
|
|
41
|
+
secret_key: RagaAI Catalyst secret key
|
|
42
|
+
project: Project name for trace grouping
|
|
43
|
+
dataset: Dataset name for trace organization
|
|
44
|
+
tracer_type: RagaAI Catalyst tracer type.
|
|
45
|
+
debug_mode: When False (default), creates local rag_agent_traces.json file.
|
|
46
|
+
When True, skips local file creation for cleaner operation.
|
|
47
|
+
batch_size: Batch size for exporting
|
|
48
|
+
flush_interval: Flush interval for exporting
|
|
49
|
+
max_queue_size: Maximum queue size for exporting
|
|
50
|
+
drop_on_overflow: Drop on overflow for exporting
|
|
51
|
+
shutdown_timeout: Shutdown timeout for exporting
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
def __init__(self,
|
|
55
|
+
context_state: AIQContextState | None = None,
|
|
56
|
+
batch_size: int = 100,
|
|
57
|
+
flush_interval: float = 5.0,
|
|
58
|
+
max_queue_size: int = 1000,
|
|
59
|
+
drop_on_overflow: bool = False,
|
|
60
|
+
shutdown_timeout: float = 10.0,
|
|
61
|
+
**catalyst_kwargs):
|
|
62
|
+
super().__init__(context_state=context_state,
|
|
63
|
+
batch_size=batch_size,
|
|
64
|
+
flush_interval=flush_interval,
|
|
65
|
+
max_queue_size=max_queue_size,
|
|
66
|
+
drop_on_overflow=drop_on_overflow,
|
|
67
|
+
shutdown_timeout=shutdown_timeout,
|
|
68
|
+
**catalyst_kwargs)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import logging
|
|
17
|
+
|
|
18
|
+
from pydantic import Field
|
|
19
|
+
|
|
20
|
+
from aiq.builder.builder import Builder
|
|
21
|
+
from aiq.cli.register_workflow import register_telemetry_exporter
|
|
22
|
+
from aiq.data_models.telemetry_exporter import TelemetryExporterBaseConfig
|
|
23
|
+
from aiq.observability.mixin.batch_config_mixin import BatchConfigMixin
|
|
24
|
+
from aiq.observability.mixin.collector_config_mixin import CollectorConfigMixin
|
|
25
|
+
|
|
26
|
+
logger = logging.getLogger(__name__)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CatalystTelemetryExporter(BatchConfigMixin, CollectorConfigMixin, TelemetryExporterBaseConfig, name="catalyst"):
|
|
30
|
+
"""A telemetry exporter to transmit traces to RagaAI catalyst."""
|
|
31
|
+
endpoint: str = Field(description="The RagaAI Catalyst endpoint", default="https://catalyst.raga.ai/api")
|
|
32
|
+
access_key: str = Field(description="The RagaAI Catalyst API access key", default="")
|
|
33
|
+
secret_key: str = Field(description="The RagaAI Catalyst API secret key", default="")
|
|
34
|
+
dataset: str | None = Field(description="The RagaAI Catalyst dataset name", default=None)
|
|
35
|
+
tracer_type: str = Field(description="The RagaAI Catalyst tracer type", default="agentic/nemo-framework")
|
|
36
|
+
|
|
37
|
+
# Debug mode control options
|
|
38
|
+
debug_mode: bool = Field(description="When False (default), creates local rag_agent_traces.json file. "
|
|
39
|
+
"When True, skips local file creation for cleaner operation.",
|
|
40
|
+
default=False)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@register_telemetry_exporter(config_type=CatalystTelemetryExporter)
|
|
44
|
+
async def catalyst_telemetry_exporter(config: CatalystTelemetryExporter, builder: Builder): # pylint: disable=W0613
|
|
45
|
+
"""Create a Catalyst telemetry exporter."""
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
import os
|
|
49
|
+
|
|
50
|
+
from aiq.plugins.ragaai.ragaai_catalyst_exporter import RagaAICatalystExporter
|
|
51
|
+
|
|
52
|
+
access_key = config.access_key or os.environ.get("CATALYST_ACCESS_KEY")
|
|
53
|
+
secret_key = config.secret_key or os.environ.get("CATALYST_SECRET_KEY")
|
|
54
|
+
endpoint = config.endpoint or os.environ.get("CATALYST_ENDPOINT")
|
|
55
|
+
|
|
56
|
+
assert endpoint is not None, "catalyst endpoint is not set"
|
|
57
|
+
assert access_key is not None, "catalyst access key is not set"
|
|
58
|
+
assert secret_key is not None, "catalyst secret key is not set"
|
|
59
|
+
|
|
60
|
+
yield RagaAICatalystExporter(base_url=endpoint,
|
|
61
|
+
access_key=access_key,
|
|
62
|
+
secret_key=secret_key,
|
|
63
|
+
project=config.project,
|
|
64
|
+
dataset=config.dataset,
|
|
65
|
+
tracer_type=config.tracer_type,
|
|
66
|
+
debug_mode=config.debug_mode,
|
|
67
|
+
batch_size=config.batch_size,
|
|
68
|
+
flush_interval=config.flush_interval,
|
|
69
|
+
max_queue_size=config.max_queue_size,
|
|
70
|
+
drop_on_overflow=config.drop_on_overflow,
|
|
71
|
+
shutdown_timeout=config.shutdown_timeout)
|
|
72
|
+
except Exception as e:
|
|
73
|
+
logger.warning("Error creating catalyst telemetry exporter: %s", e, exc_info=True)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nvidia-nat-ragaai
|
|
3
|
+
Version: 1.2.0rc5
|
|
4
|
+
Summary: Subpackage for RagaAI Catalyst integration in AIQtoolkit
|
|
5
|
+
Keywords: ai,observability,ragaai catalyst
|
|
6
|
+
Classifier: Programming Language :: Python
|
|
7
|
+
Requires-Python: <3.13,>=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: nvidia-nat[opentelemetry]~=1.2
|
|
10
|
+
Requires-Dist: ragaai-catalyst<2.3,>=2.2.0
|
|
11
|
+
|
|
12
|
+
<!--
|
|
13
|
+
SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
14
|
+
SPDX-License-Identifier: Apache-2.0
|
|
15
|
+
|
|
16
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
you may not use this file except in compliance with the License.
|
|
18
|
+
You may obtain a copy of the License at
|
|
19
|
+
|
|
20
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
|
|
22
|
+
Unless required by applicable law or agreed to in writing, software
|
|
23
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
+
See the License for the specific language governing permissions and
|
|
26
|
+
limitations under the License.
|
|
27
|
+
-->
|
|
28
|
+
|
|
29
|
+
.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
aiq/meta/pypi.md,sha256=iXOgvEl_QMB_qjj7fzcisG85J-UC1qUtAXln5dDg6u4,1122
|
|
2
|
+
aiq/plugins/ragaai/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
|
|
3
|
+
aiq/plugins/ragaai/ragaai_catalyst_exporter.py,sha256=1mblHLAv3bO-6Nlsw-ZmMUp7zq7FMFlfVojSgAvvr7Y,3000
|
|
4
|
+
aiq/plugins/ragaai/register.py,sha256=R4EWLsyub_1uq_6cc7RStO6qQbZKcDenOoemclSLTCY,3786
|
|
5
|
+
aiq/plugins/ragaai/mixin/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
|
|
6
|
+
aiq/plugins/ragaai/mixin/ragaai_catalyst_mixin.py,sha256=vjIjKItalJD5LPrkbBUPayZwpsjYCyQGKJ1n2QGtJ8I,10920
|
|
7
|
+
nvidia_nat_ragaai-1.2.0rc5.dist-info/METADATA,sha256=1D0-no_QtILVJ3uuxVLwsKJl4eTtqaH8U4i5Vlu8bgA,1498
|
|
8
|
+
nvidia_nat_ragaai-1.2.0rc5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
nvidia_nat_ragaai-1.2.0rc5.dist-info/entry_points.txt,sha256=YwaRUww8SsUuP4SPi5DRcBP3z5fpZ_r_PGddumHNYWs,58
|
|
10
|
+
nvidia_nat_ragaai-1.2.0rc5.dist-info/top_level.txt,sha256=fo7AzYcNhZ_tRWrhGumtxwnxMew4xrT1iwouDy_f0Kc,4
|
|
11
|
+
nvidia_nat_ragaai-1.2.0rc5.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aiq
|