aiqtoolkit 1.2.0a20250527__py3-none-any.whl → 1.2.0a20250529__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 aiqtoolkit might be problematic. Click here for more details.

aiq/cli/commands/start.py CHANGED
@@ -33,7 +33,7 @@ from aiq.utils.type_utils import DecomposedType
33
33
  logger = logging.getLogger(__name__)
34
34
 
35
35
 
36
- class StartCommandGroup(click.MultiCommand):
36
+ class StartCommandGroup(click.Group):
37
37
 
38
38
  # pylint: disable=too-many-positional-arguments
39
39
  def __init__(
aiq/eval/evaluate.py CHANGED
@@ -84,15 +84,19 @@ class EvaluationRun: # pylint: disable=too-many-public-methods
84
84
  return "", []
85
85
 
86
86
  async with session_manager.run(item.input_obj) as runner:
87
+ if not session_manager.workflow.has_single_output:
88
+ # raise an error if the workflow has multiple outputs
89
+ raise NotImplementedError("Multiple outputs are not supported")
90
+
91
+ runner_result = None
92
+ intermediate_future = None
93
+
87
94
  try:
95
+
88
96
  # Start usage stats and intermediate steps collection in parallel
89
97
  intermediate_future = pull_intermediate()
90
-
91
- if session_manager.workflow.has_single_output:
92
- base_output = await runner.result()
93
- else:
94
- # raise an error if the workflow has multiple outputs
95
- raise NotImplementedError("Multiple outputs are not supported")
98
+ runner_result = runner.result()
99
+ base_output = await runner_result
96
100
  intermediate_steps = await intermediate_future
97
101
  except NotImplementedError as e:
98
102
  # raise original error
@@ -101,6 +105,13 @@ class EvaluationRun: # pylint: disable=too-many-public-methods
101
105
  logger.exception("Failed to run the workflow: %s", e, exc_info=True)
102
106
  # stop processing if a workflow error occurs
103
107
  self.workflow_interrupted = True
108
+
109
+ # Cancel any coroutines that are still running, avoiding a warning about unawaited coroutines
110
+ # (typically one of these two is what raised the exception and the other is still running)
111
+ for coro in (runner_result, intermediate_future):
112
+ if coro is not None:
113
+ asyncio.ensure_future(coro).cancel()
114
+
104
115
  stop_event.set()
105
116
  return
106
117
 
@@ -15,6 +15,7 @@
15
15
 
16
16
  import logging
17
17
  import re
18
+ import warnings
18
19
  from contextlib import asynccontextmanager
19
20
  from contextlib import contextmanager
20
21
  from typing import Any
@@ -30,10 +31,20 @@ from aiq.utils.optional_imports import TelemetryOptionalImportError
30
31
  from aiq.utils.optional_imports import try_import_opentelemetry
31
32
 
32
33
  try:
33
- from weave.trace.context import weave_client_context
34
- from weave.trace.context.call_context import get_current_call
35
- from weave.trace.context.call_context import set_call_stack
36
- from weave.trace.weave_client import Call
34
+ with warnings.catch_warnings():
35
+ # Ignore deprecation warnings being triggered by weave. https://github.com/wandb/weave/issues/3666
36
+ # and https://github.com/wandb/weave/issues/4533
37
+ warnings.filterwarnings("ignore", category=DeprecationWarning, message=r"^`sentry_sdk\.Hub` is deprecated")
38
+ warnings.filterwarnings("ignore",
39
+ category=DeprecationWarning,
40
+ message=r"^Using extra keyword arguments on `Field` is deprecated")
41
+ warnings.filterwarnings("ignore",
42
+ category=DeprecationWarning,
43
+ message=r"^`include` is deprecated and does nothing")
44
+ from weave.trace.context import weave_client_context
45
+ from weave.trace.context.call_context import get_current_call
46
+ from weave.trace.context.call_context import set_call_stack
47
+ from weave.trace.weave_client import Call
37
48
  WEAVE_AVAILABLE = True
38
49
  except ImportError:
39
50
  WEAVE_AVAILABLE = False
@@ -14,6 +14,7 @@
14
14
  # limitations under the License.
15
15
 
16
16
  import logging
17
+ import os
17
18
 
18
19
  from pydantic import Field
19
20
 
@@ -22,6 +23,7 @@ from aiq.cli.register_workflow import register_logging_method
22
23
  from aiq.cli.register_workflow import register_telemetry_exporter
23
24
  from aiq.data_models.logging import LoggingBaseConfig
24
25
  from aiq.data_models.telemetry_exporter import TelemetryExporterBaseConfig
26
+ from aiq.utils.optional_imports import telemetry_optional_import
25
27
  from aiq.utils.optional_imports import try_import_opentelemetry
26
28
  from aiq.utils.optional_imports import try_import_phoenix
27
29
 
@@ -42,11 +44,67 @@ async def phoenix_telemetry_exporter(config: PhoenixTelemetryExporter, builder:
42
44
  # If the dependencies are not installed, a TelemetryOptionalImportError will be raised
43
45
  phoenix = try_import_phoenix() # noqa: F841
44
46
  from phoenix.otel import HTTPSpanExporter
47
+
45
48
  yield HTTPSpanExporter(config.endpoint)
46
49
  except ConnectionError as ex:
47
- logger.warning("Unable to connect to Phoenix at port 6006. Are you sure Phoenix is running?\n %s",
48
- ex,
49
- exc_info=True)
50
+ logger.warning(
51
+ "Unable to connect to Phoenix at port 6006. Are you sure Phoenix is running?\n %s",
52
+ ex,
53
+ exc_info=True,
54
+ )
55
+
56
+
57
+ class LangfuseTelemetryExporter(TelemetryExporterBaseConfig, name="langfuse"):
58
+ """A telemetry exporter to transmit traces to externally hosted langfuse service."""
59
+
60
+ endpoint: str = Field(description="The langfuse OTEL endpoint (/api/public/otel/v1/traces)")
61
+ public_key: str = Field(description="The Langfuse public key", default="")
62
+ secret_key: str = Field(description="The Langfuse secret key", default="")
63
+
64
+
65
+ @register_telemetry_exporter(config_type=LangfuseTelemetryExporter)
66
+ async def langfuse_telemetry_exporter(config: LangfuseTelemetryExporter, builder: Builder):
67
+ """Create a Langfuse telemetry exporter."""
68
+
69
+ import base64
70
+
71
+ trace_exporter = telemetry_optional_import("opentelemetry.exporter.otlp.proto.http.trace_exporter")
72
+
73
+ secret_key = config.secret_key or os.environ.get("LANGFUSE_SECRET_KEY")
74
+ public_key = config.public_key or os.environ.get("LANGFUSE_PUBLIC_KEY")
75
+ if not secret_key or not public_key:
76
+ raise ValueError("secret and public keys are required for langfuse")
77
+
78
+ credentials = f"{public_key}:{secret_key}".encode("utf-8")
79
+ auth_header = base64.b64encode(credentials).decode("utf-8")
80
+ headers = {"Authorization": f"Basic {auth_header}"}
81
+
82
+ yield trace_exporter.OTLPSpanExporter(endpoint=config.endpoint, headers=headers)
83
+
84
+
85
+ class LangsmithTelemetryExporter(TelemetryExporterBaseConfig, name="langsmith"):
86
+ """A telemetry exporter to transmit traces to externally hosted langsmith service."""
87
+
88
+ endpoint: str = Field(
89
+ description="The langsmith OTEL endpoint",
90
+ default="https://api.smith.langchain.com/otel/v1/traces",
91
+ )
92
+ api_key: str = Field(description="The Langsmith API key", default="")
93
+ project: str = Field(description="The project name to group the telemetry traces.")
94
+
95
+
96
+ @register_telemetry_exporter(config_type=LangsmithTelemetryExporter)
97
+ async def langsmith_telemetry_exporter(config: LangsmithTelemetryExporter, builder: Builder):
98
+ """Create a Langsmith telemetry exporter."""
99
+
100
+ trace_exporter = telemetry_optional_import("opentelemetry.exporter.otlp.proto.http.trace_exporter")
101
+
102
+ api_key = config.api_key or os.environ.get("LANGSMITH_API_KEY")
103
+ if not api_key:
104
+ raise ValueError("API key is required for langsmith")
105
+
106
+ headers = {"x-api-key": api_key, "LANGSMITH_PROJECT": config.project}
107
+ yield trace_exporter.OTLPSpanExporter(endpoint=config.endpoint, headers=headers)
50
108
 
51
109
 
52
110
  class OtelCollectorTelemetryExporter(TelemetryExporterBaseConfig, name="otelcollector"):
@@ -73,8 +131,8 @@ class ConsoleLoggingMethod(LoggingBaseConfig, name="console"):
73
131
  @register_logging_method(config_type=ConsoleLoggingMethod)
74
132
  async def console_logging_method(config: ConsoleLoggingMethod, builder: Builder):
75
133
  """
76
- Build and return a StreamHandler for console-based logging.
77
- """
134
+ Build and return a StreamHandler for console-based logging.
135
+ """
78
136
  level = getattr(logging, config.level.upper(), logging.INFO)
79
137
  handler = logging.StreamHandler()
80
138
  handler.setLevel(level)
@@ -91,8 +149,8 @@ class FileLoggingMethod(LoggingBaseConfig, name="file"):
91
149
  @register_logging_method(config_type=FileLoggingMethod)
92
150
  async def file_logging_method(config: FileLoggingMethod, builder: Builder):
93
151
  """
94
- Build and return a FileHandler for file-based logging.
95
- """
152
+ Build and return a FileHandler for file-based logging.
153
+ """
96
154
  level = getattr(logging, config.level.upper(), logging.INFO)
97
155
  handler = logging.FileHandler(filename=config.path, mode="a", encoding="utf-8")
98
156
  handler.setLevel(level)
@@ -220,7 +220,7 @@ class CallNode(BaseModel):
220
220
  return "\n".join([info] + child_strs)
221
221
 
222
222
 
223
- CallNode.update_forward_refs()
223
+ CallNode.model_rebuild()
224
224
 
225
225
 
226
226
  class NodeMetrics(BaseModel):
@@ -296,7 +296,7 @@ class ConcurrencyCallNode(CallNode):
296
296
  llm_text_output: str | None = None
297
297
 
298
298
 
299
- ConcurrencyCallNode.update_forward_refs()
299
+ ConcurrencyCallNode.model_rebuild()
300
300
 
301
301
 
302
302
  class ConcurrencySpikeInfo(BaseModel):
@@ -176,8 +176,8 @@ class LLMMetrics:
176
176
  return subdf
177
177
 
178
178
  # Apply the group metrics
179
- df = (df.groupby(['example_number', 'function_name'],
180
- group_keys=False).apply(_compute_group_metrics).sort_index())
179
+ df_group = df.groupby(['example_number', 'function_name'], group_keys=False)
180
+ df = df_group[df.columns].apply(_compute_group_metrics).sort_index()
181
181
 
182
182
  # ---------------------------------------------------------------------
183
183
  # 5. NOVA-Predicted-OSL
aiq/runtime/loader.py CHANGED
@@ -132,7 +132,7 @@ def discover_entrypoints(plugin_type: PluginTypes):
132
132
  plugin_groups.append("aiq.evaluators")
133
133
 
134
134
  # Get the entry points for the specified groups
135
- aiq_plugins = reduce(lambda x, y: x + y, [entry_points.select(group=y) for y in plugin_groups])
135
+ aiq_plugins = reduce(lambda x, y: list(x) + list(y), [entry_points.select(group=y) for y in plugin_groups])
136
136
 
137
137
  return aiq_plugins
138
138
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiqtoolkit
3
- Version: 1.2.0a20250527
3
+ Version: 1.2.0a20250529
4
4
  Summary: NVIDIA Agent Intelligence toolkit
5
5
  Author: NVIDIA Corporation
6
6
  Maintainer: NVIDIA Corporation
@@ -44,7 +44,7 @@ aiq/cli/cli_utils/config_override.py,sha256=WuX9ki1W0Z6jTqjm553U_owWFxbVzjbKRWGJ
44
44
  aiq/cli/cli_utils/validation.py,sha256=GlKpoi3HfE5HELjmz5wk8ezGbb5iZeY0zmA3uxmCrBU,1302
45
45
  aiq/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  aiq/cli/commands/evaluate.py,sha256=_pqAuvrNKBf0DvGpZFO28vAKBWp6izMpaLbAVnP57_4,4783
47
- aiq/cli/commands/start.py,sha256=7vBtp6BE82bp_G4H0mtTdll7ynrq90HBO4Fy7KB4Aok,9995
47
+ aiq/cli/commands/start.py,sha256=tP0V8I6i0abPBKAVrMObgekIZICtijkG17G7z_m83wM,9988
48
48
  aiq/cli/commands/uninstall.py,sha256=tTb5WsyRPPXo511yAGSvSG7U19swbQs8Cf_B4rh7mxQ,3248
49
49
  aiq/cli/commands/validate.py,sha256=YfYNRK7m5te_jkKp1klhGp4PdUVCuDyVG4LRW1YXZk0,1669
50
50
  aiq/cli/commands/configure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -107,7 +107,7 @@ aiq/embedder/openai_embedder.py,sha256=5FO3xsyNvEmbLBsZb3xsCpbN1Soxio4yf4b5gTPVx
107
107
  aiq/embedder/register.py,sha256=3MTZrfNQKp6AZTbfaA-PpTnyXiMyu-8HH9JnDCC0v9o,978
108
108
  aiq/eval/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
109
109
  aiq/eval/config.py,sha256=IlOr2o618kbkXP0G1F-AklZfsKYVos9UB4Dvlxf66xk,1431
110
- aiq/eval/evaluate.py,sha256=WPGLBeJ46mwIlnprbtia1cm2MwMqZ-GskXoTn6R4oV0,14624
110
+ aiq/eval/evaluate.py,sha256=FFKIWRse9C3z6A7Fyu8GN0ZHMrxGspw9LnhQ7ulEYSE,15125
111
111
  aiq/eval/intermediate_step_adapter.py,sha256=4cSsGgFBvNjXnclk5FvZnQaFEdeulp7VEdRWKLcREAQ,4498
112
112
  aiq/eval/register.py,sha256=QOHJqA2CQixeWMC9InyKbzXo1jByvrntD_m9-2Mvg9k,1076
113
113
  aiq/eval/remote_workflow.py,sha256=Fb7Z6gdP2L_gqyWB--AEWfcXe9xPpQ_hPsf9lmqGXjI,5524
@@ -173,8 +173,8 @@ aiq/memory/models.py,sha256=c5dA7nKHQ4AS1_ptQZcfC_oXO495-ehocnf_qXTE6c8,4319
173
173
  aiq/meta/module_to_distro.json,sha256=1XV7edobFrdDKvsSoynfodXg_hczUWpDrQzGkW9qqEs,28
174
174
  aiq/meta/pypi.md,sha256=Ukj1J--Q6GF7Zh1tKonygttN3aiq_Lf2-445nz0sE-o,4362
175
175
  aiq/observability/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
176
- aiq/observability/async_otel_listener.py,sha256=oyDO_8XNzQqyiFe-8iJhZr3z9kWsEJEuKEoOPf7L-Bk,17667
177
- aiq/observability/register.py,sha256=ZDQOaSuy9igc7nAKG7XWP2u6JanC2T8yufMWItNpPJI,4245
176
+ aiq/observability/async_otel_listener.py,sha256=gR8fEdpZ9L8vGZiXLI7FwbwtSiGgQHMDDj5d-vKjZGc,18407
177
+ aiq/observability/register.py,sha256=WLPGY1b_RmVv48od-hIytvJrCqNoJupriHCzyxvTbUw,6723
178
178
  aiq/plugins/.namespace,sha256=Gace0pOC3ETEJf-TBVuNw0TQV6J_KtOPpEiSzMH-odo,215
179
179
  aiq/profiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
180
180
  aiq/profiler/data_frame_row.py,sha256=vudqk1ZzZtlZln2Ir43mPl3nwNc0pQlhwbtdY9oSKtI,1755
@@ -200,8 +200,8 @@ aiq/profiler/forecasting/models/forecasting_base_model.py,sha256=6-oe3jn-X9_m3Qv
200
200
  aiq/profiler/forecasting/models/linear_model.py,sha256=quIKTY0NxaKB4-VIffP6YHmnWXuqp1FV0a2Nt9nYWPI,6993
201
201
  aiq/profiler/forecasting/models/random_forest_regressor.py,sha256=139cOJTnJKkYOOU9ZDxPq9BvJ5nj1sV0JZIcjpy1JfU,9533
202
202
  aiq/profiler/inference_optimization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
203
- aiq/profiler/inference_optimization/data_models.py,sha256=wMXJBJUUHo-3W85vuPoiBT1YZHeNel7bMrwGyBOOgwI,11896
204
- aiq/profiler/inference_optimization/llm_metrics.py,sha256=uRQv21x5nIVF4S4XYNz-qW_6Qu4dFTj7qQ-Mf1vjKas,9469
203
+ aiq/profiler/inference_optimization/data_models.py,sha256=lK6EPAgEPtJMMpe3SFoDqx4BntJVo8fMQzLfqOMKpB0,11884
204
+ aiq/profiler/inference_optimization/llm_metrics.py,sha256=uvd2KMPPiEjZbuLqK7iJFK8UUrOUb5F3n53T76vKzd8,9482
205
205
  aiq/profiler/inference_optimization/prompt_caching.py,sha256=LGfxJG4R2y4vMFoiFztJkdeBivhBOO4sk7cKY-llTXk,6505
206
206
  aiq/profiler/inference_optimization/token_uniqueness.py,sha256=OCNlVmemMLS2kt0OZIXOGt8MbrTy5mbdhSMPYHs31a4,4571
207
207
  aiq/profiler/inference_optimization/workflow_runtimes.py,sha256=lnGa0eTpHiDEbx9rX-tcx100qSd6amePLlgb4Gx7JBc,2664
@@ -244,7 +244,7 @@ aiq/retriever/nemo_retriever/__init__.py,sha256=GUJrgGtpvyMUCjUBvR3faAdv-tZzbU9W
244
244
  aiq/retriever/nemo_retriever/register.py,sha256=ODV-TZfXzDs1VJHHLdj2kC05odirtlQZSeh9c1zw8AQ,2893
245
245
  aiq/retriever/nemo_retriever/retriever.py,sha256=IvScUr9XuDLiMR__I3QsboLaM52N5D5Qu94qtTOGQw8,6958
246
246
  aiq/runtime/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
247
- aiq/runtime/loader.py,sha256=jw_ZPM1vBJkyDtuXeyx42ACpu3EyXeimbo3Fb6k9-gM,6811
247
+ aiq/runtime/loader.py,sha256=4K96mko9BfSEdYg2cLZ6a5G8j-6PAkl6JSigSOshg1A,6823
248
248
  aiq/runtime/runner.py,sha256=WUAiliqI5Se9OgRmimpeFdrl38d9gRTJQ8uf59lvk7U,5836
249
249
  aiq/runtime/session.py,sha256=Hd92_MjYkPNdjbuoxQVV5EOJ0d_X2re449O6XHDlJZI,5039
250
250
  aiq/runtime/user_metadata.py,sha256=d7K5CFdOvaXpP2NCUIFBY2lHxB1FnjqV4yOlT4C7fuU,3697
@@ -307,10 +307,10 @@ aiq/utils/reactive/base/observer_base.py,sha256=UAlyAY_ky4q2t0P81RVFo2Bs_R7z5Nde
307
307
  aiq/utils/reactive/base/subject_base.py,sha256=Ed-AC6P7cT3qkW1EXjzbd5M9WpVoeN_9KCe3OM3FLU4,2521
308
308
  aiq/utils/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
309
309
  aiq/utils/settings/global_settings.py,sha256=U9TCLdoZsKq5qOVGjREipGVv9e-FlStzqy5zv82_VYk,7454
310
- aiqtoolkit-1.2.0a20250527.dist-info/licenses/LICENSE-3rd-party.txt,sha256=8o7aySJa9CBvFshPcsRdJbczzdNyDGJ8b0J67WRUQ2k,183936
311
- aiqtoolkit-1.2.0a20250527.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
312
- aiqtoolkit-1.2.0a20250527.dist-info/METADATA,sha256=hYPjikwtuznnhuOiEVVgsZ9gkR5-1PfHfPcx73ltznQ,20174
313
- aiqtoolkit-1.2.0a20250527.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
314
- aiqtoolkit-1.2.0a20250527.dist-info/entry_points.txt,sha256=gRlPfR5g21t328WNEQ4CcEz80S1sJNS8A7rMDYnzl4A,452
315
- aiqtoolkit-1.2.0a20250527.dist-info/top_level.txt,sha256=fo7AzYcNhZ_tRWrhGumtxwnxMew4xrT1iwouDy_f0Kc,4
316
- aiqtoolkit-1.2.0a20250527.dist-info/RECORD,,
310
+ aiqtoolkit-1.2.0a20250529.dist-info/licenses/LICENSE-3rd-party.txt,sha256=8o7aySJa9CBvFshPcsRdJbczzdNyDGJ8b0J67WRUQ2k,183936
311
+ aiqtoolkit-1.2.0a20250529.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
312
+ aiqtoolkit-1.2.0a20250529.dist-info/METADATA,sha256=BadJ83ZSQ3tyHqklgqjTRULCgVbBPDtbyqqqL24PPWM,20174
313
+ aiqtoolkit-1.2.0a20250529.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
314
+ aiqtoolkit-1.2.0a20250529.dist-info/entry_points.txt,sha256=gRlPfR5g21t328WNEQ4CcEz80S1sJNS8A7rMDYnzl4A,452
315
+ aiqtoolkit-1.2.0a20250529.dist-info/top_level.txt,sha256=fo7AzYcNhZ_tRWrhGumtxwnxMew4xrT1iwouDy_f0Kc,4
316
+ aiqtoolkit-1.2.0a20250529.dist-info/RECORD,,