aiqtoolkit 1.2.0a20250627__py3-none-any.whl → 1.2.0a20250628__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.

@@ -30,7 +30,8 @@ from aiq.data_models.common import TypedBaseModel
30
30
 
31
31
  class EvalS3Config(BaseModel):
32
32
 
33
- endpoint_url: str
33
+ endpoint_url: str | None = None
34
+ region_name: str | None = None
34
35
  bucket: str
35
36
  access_key: str
36
37
  secret_key: str
@@ -78,9 +78,18 @@ class OutputUploader:
78
78
 
79
79
  session = aioboto3.Session()
80
80
  try:
81
+ if self.s3_config.endpoint_url:
82
+ region_name = None
83
+ endpoint_url = self.s3_config.endpoint_url
84
+ elif self.s3_config.region_name:
85
+ region_name = self.s3_config.region_name
86
+ endpoint_url = None
87
+ else:
88
+ raise ValueError("No endpoint_url or region_name provided in the config: eval.general.output.s3")
81
89
  async with session.client(
82
90
  "s3",
83
- endpoint_url=self.s3_config.endpoint_url,
91
+ endpoint_url=endpoint_url,
92
+ region_name=region_name,
84
93
  aws_access_key_id=self.s3_config.access_key,
85
94
  aws_secret_access_key=self.s3_config.secret_key,
86
95
  ) as s3_client:
@@ -23,3 +23,6 @@ class InferenceMetricsModel(BaseModel):
23
23
  ninetieth_interval: tuple[float, float] = Field(default=(0, 0), description="90% confidence interval")
24
24
  ninety_fifth_interval: tuple[float, float] = Field(default=(0, 0), description="95% confidence interval")
25
25
  ninety_ninth_interval: tuple[float, float] = Field(default=(0, 0), description="99% confidence interval")
26
+ p90: float = Field(default=0, description="90th percentile of the samples")
27
+ p95: float = Field(default=0, description="95th percentile of the samples")
28
+ p99: float = Field(default=0, description="99th percentile of the samples")
@@ -394,7 +394,8 @@ class ProfilerRunner:
394
394
 
395
395
  def _compute_confidence_intervals(self, data: list[float], metric_name: str) -> InferenceMetricsModel:
396
396
  """
397
- Helper to compute 90, 95, 99% confidence intervals for the mean of a dataset.
397
+ Helper to compute 90, 95, 99% confidence intervals **and** the empirical
398
+ 90th/95th/99th percentiles (p90/p95/p99) for the mean of a dataset.
398
399
  Uses a z-score from the normal approximation for large samples.
399
400
 
400
401
  Returns a dict like::
@@ -412,11 +413,16 @@ class ProfilerRunner:
412
413
  n = len(data)
413
414
  mean_val = statistics.mean(data)
414
415
  if n <= 1:
415
- return InferenceMetricsModel(n=n,
416
- mean=mean_val,
417
- ninetieth_interval=(mean_val, mean_val),
418
- ninety_fifth_interval=(mean_val, mean_val),
419
- ninety_ninth_interval=(mean_val, mean_val))
416
+ return InferenceMetricsModel(
417
+ n=n,
418
+ mean=mean_val,
419
+ ninetieth_interval=(mean_val, mean_val),
420
+ ninety_fifth_interval=(mean_val, mean_val),
421
+ ninety_ninth_interval=(mean_val, mean_val),
422
+ p90=mean_val,
423
+ p95=mean_val,
424
+ p99=mean_val,
425
+ )
420
426
 
421
427
  stdev_val = statistics.pstdev(data) # population stdev or use stdev for sample
422
428
  # standard error
@@ -433,4 +439,32 @@ class ProfilerRunner:
433
439
  # Optionally, store more info
434
440
  intervals["n"] = n
435
441
  intervals["mean"] = mean_val
442
+
443
+ # ------------------------------------------------------------------
444
+ # Percentiles
445
+ # ------------------------------------------------------------------
446
+ sorted_data = sorted(data)
447
+
448
+ def _percentile(arr: list[float], pct: float) -> float:
449
+ """
450
+ Linear interpolation between closest ranks.
451
+ pct is given from 0‑100 (e.g. 90 for p90).
452
+ """
453
+ if not arr:
454
+ return 0.0
455
+ k = (len(arr) - 1) * (pct / 100.0)
456
+ f = math.floor(k)
457
+ c = math.ceil(k)
458
+ if f == c:
459
+ return arr[int(k)]
460
+ return arr[f] + (arr[c] - arr[f]) * (k - f)
461
+
462
+ p90_val = _percentile(sorted_data, 90)
463
+ p95_val = _percentile(sorted_data, 95)
464
+ p99_val = _percentile(sorted_data, 99)
465
+
466
+ intervals["p90"] = p90_val
467
+ intervals["p95"] = p95_val
468
+ intervals["p99"] = p99_val
469
+
436
470
  return InferenceMetricsModel(**intervals)
@@ -68,6 +68,16 @@ def model_from_mcp_schema(name: str, mcp_input_schema: dict) -> type[BaseModel]:
68
68
  else:
69
69
  item_type = _type_map.get(item_properties.get("type", "string"), Any)
70
70
  field_type = list[item_type]
71
+ elif isinstance(json_type, list):
72
+ field_type = None
73
+ for t in json_type:
74
+ mapped = _type_map.get(t, Any)
75
+ field_type = mapped if field_type is None else field_type | mapped
76
+
77
+ return field_type, Field(
78
+ default=field_properties.get("default", None if "null" in json_type else ...),
79
+ description=field_properties.get("description", "")
80
+ )
71
81
  else:
72
82
  field_type = _type_map.get(json_type, Any)
73
83
 
aiq/tool/mcp/mcp_tool.py CHANGED
@@ -75,7 +75,8 @@ async def mcp_tool(config: MCPToolConfig, builder: Builder): # pylint: disable=
75
75
  return await tool.acall(args)
76
76
 
77
77
  _ = tool.input_schema.model_validate(kwargs)
78
- return await tool.acall(kwargs)
78
+ filtered_kwargs = {k: v for k, v in kwargs.items() if v is not None}
79
+ return await tool.acall(filtered_kwargs)
79
80
  except Exception as e:
80
81
  if config.return_exception:
81
82
  if tool_input:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiqtoolkit
3
- Version: 1.2.0a20250627
3
+ Version: 1.2.0a20250628
4
4
  Summary: NVIDIA Agent Intelligence toolkit
5
5
  Author: NVIDIA Corporation
6
6
  Maintainer: NVIDIA Corporation
@@ -79,7 +79,7 @@ aiq/data_models/common.py,sha256=G63rUXvDAtK6p1SrRyH0VlHGqrDgCZVVjbnzgGSl2Ic,421
79
79
  aiq/data_models/component.py,sha256=x6jm1Fhn1k1hGu-5AjM0ywuyvs6ztaZfapD8bLUXSqc,1469
80
80
  aiq/data_models/component_ref.py,sha256=GyyIf4k80aUIn6LV9r84m5imbiVhpdaY7uKMMpYpbzU,3872
81
81
  aiq/data_models/config.py,sha256=ERLjZY0iqexZ-gSXsCSN1UqgNeiwkEjWdYJEdKqeYTY,14116
82
- aiq/data_models/dataset_handler.py,sha256=SifWhFHtxTMEjrXaXOYQgBOSKfWOzkc6OtOoPJ39pD4,3978
82
+ aiq/data_models/dataset_handler.py,sha256=liMB3xRohkr4VTMmNWPvWi9qhbhlJQfQK36g5Rknweo,4027
83
83
  aiq/data_models/discovery_metadata.py,sha256=OcITQc5VeML4bTHurrsMNiK_oB3z7wudMxcyN7LI8pY,12785
84
84
  aiq/data_models/embedder.py,sha256=0v917IiohVA_7zdF7hoO_zQcmNe4hQEFhh4fxRiYBbk,940
85
85
  aiq/data_models/evaluate.py,sha256=WBeABZsIa6W04MPj24SRu4s-ty2PkJ7_4SLojXmj5Pk,4704
@@ -133,7 +133,7 @@ aiq/eval/tunable_rag_evaluator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
133
133
  aiq/eval/tunable_rag_evaluator/evaluate.py,sha256=f4jfn9VVLmkOg631TQr2wy7hPwGMJMsQa4kmXsu0-Uc,13069
134
134
  aiq/eval/tunable_rag_evaluator/register.py,sha256=q4p2rFyMzWmaINJc961ZV4jzIlAN4GfWsoImHo0ovsY,2558
135
135
  aiq/eval/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
- aiq/eval/utils/output_uploader.py,sha256=SaQbZPkw-Q0H7t5yG60Kh-p1cflR7gPklVkilC4uPbU,5141
136
+ aiq/eval/utils/output_uploader.py,sha256=lkV63Jr97YuG1vr04uOZDvs9e1pGP4FbJykRxS2d7a4,5579
137
137
  aiq/eval/utils/tqdm_position_registry.py,sha256=9CtpCk1wtYCSyieHPaSp8nlZu6EcNUOaUz2RTqfekrA,1286
138
138
  aiq/eval/utils/weave_eval.py,sha256=l9NTkgLTb30wBnfiHI_yefPFVNyIBrNdbPNq2o58HO4,7088
139
139
  aiq/front_ends/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
@@ -183,9 +183,9 @@ aiq/plugins/.namespace,sha256=Gace0pOC3ETEJf-TBVuNw0TQV6J_KtOPpEiSzMH-odo,215
183
183
  aiq/profiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
184
184
  aiq/profiler/data_frame_row.py,sha256=vudqk1ZzZtlZln2Ir43mPl3nwNc0pQlhwbtdY9oSKtI,1755
185
185
  aiq/profiler/data_models.py,sha256=I8k1zjg8KaLjjpc1SxMgaEC2h_jW2bv1cENl1BsTcG8,899
186
- aiq/profiler/inference_metrics_model.py,sha256=e_M0ApsyDgPMrOIOnm1beHtNeHKwOh5CAxu-OiJaEzQ,1241
186
+ aiq/profiler/inference_metrics_model.py,sha256=Thz3OHBDzGrpPYaOm8m8_pNeEA_q0yDlUUDHFkQ3U90,1481
187
187
  aiq/profiler/intermediate_property_adapter.py,sha256=XZ_A8f2S5M-EJSkErY6I750Y8HAZPdXsr6Cpb1wXlNM,3537
188
- aiq/profiler/profile_runner.py,sha256=LWPQRqIppngWAE7NVtbpArrNcNkshi3HvvEIdCmw8KU,21065
188
+ aiq/profiler/profile_runner.py,sha256=Xyh0wl2aeRJtRBzvvkMYkFvqUptB7XUfYJ7jdbBCPuE,22102
189
189
  aiq/profiler/utils.py,sha256=hNh_JfxXDrACIp4usXtlriTfVuYUkk3Pv-x74K34MQg,8180
190
190
  aiq/profiler/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
191
191
  aiq/profiler/callbacks/agno_callback_handler.py,sha256=aDAUY6GDIUtly6KowXXKUqLc7NbE6khg1aXT1AritaA,14930
@@ -281,8 +281,8 @@ aiq/tool/github_tools/get_github_issue.py,sha256=vwLNkNOszLlymkQju0cR8BNvfdH4Enm
281
281
  aiq/tool/github_tools/get_github_pr.py,sha256=b7eCOqrVoejGjRwmUVdU45uF07ihbY8lRacMYOSgMrY,9716
282
282
  aiq/tool/github_tools/update_github_issue.py,sha256=TUElxUuzjZr_QldL_48RcqSx0A9b23NB_lA82QwFjkM,4103
283
283
  aiq/tool/mcp/__init__.py,sha256=GUJrgGtpvyMUCjUBvR3faAdv-tZzbU9W-izgx9aMEQg,680
284
- aiq/tool/mcp/mcp_client.py,sha256=lYbf669ATqGKkL0jjd76r0aAtAFnWeruWw-lOPsmYu8,8103
285
- aiq/tool/mcp/mcp_tool.py,sha256=rQQcaCT-GHQcDmG5weX-2Y-HxBPX-0cC73LjL1u0FUU,4009
284
+ aiq/tool/mcp/mcp_client.py,sha256=bTZGh_Y3mRJA9BGbbmfVNRddTIcK251jKlPL7kAjFK0,8553
285
+ aiq/tool/mcp/mcp_tool.py,sha256=0L2Zj1CBwrvv5P9A8-lj_Ao_oBaC6aYRJXw9q5Et4uo,4099
286
286
  aiq/tool/memory_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
287
287
  aiq/tool/memory_tools/add_memory_tool.py,sha256=9EjB3DpYhxwasz7o3O8Rq__Ys5986fciv44ahC6mVCo,3349
288
288
  aiq/tool/memory_tools/delete_memory_tool.py,sha256=wdB_I8y-1D1OpNtBi6ZOg36vvNkbaxp-yvdqFMc2Suk,2532
@@ -312,10 +312,10 @@ aiq/utils/reactive/base/observer_base.py,sha256=UAlyAY_ky4q2t0P81RVFo2Bs_R7z5Nde
312
312
  aiq/utils/reactive/base/subject_base.py,sha256=Ed-AC6P7cT3qkW1EXjzbd5M9WpVoeN_9KCe3OM3FLU4,2521
313
313
  aiq/utils/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
314
314
  aiq/utils/settings/global_settings.py,sha256=U9TCLdoZsKq5qOVGjREipGVv9e-FlStzqy5zv82_VYk,7454
315
- aiqtoolkit-1.2.0a20250627.dist-info/licenses/LICENSE-3rd-party.txt,sha256=8o7aySJa9CBvFshPcsRdJbczzdNyDGJ8b0J67WRUQ2k,183936
316
- aiqtoolkit-1.2.0a20250627.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
317
- aiqtoolkit-1.2.0a20250627.dist-info/METADATA,sha256=7zLpA6TTb4v0axNybwIbjM4LrJkRV7pTgdGMqRdPczM,20274
318
- aiqtoolkit-1.2.0a20250627.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
319
- aiqtoolkit-1.2.0a20250627.dist-info/entry_points.txt,sha256=gRlPfR5g21t328WNEQ4CcEz80S1sJNS8A7rMDYnzl4A,452
320
- aiqtoolkit-1.2.0a20250627.dist-info/top_level.txt,sha256=fo7AzYcNhZ_tRWrhGumtxwnxMew4xrT1iwouDy_f0Kc,4
321
- aiqtoolkit-1.2.0a20250627.dist-info/RECORD,,
315
+ aiqtoolkit-1.2.0a20250628.dist-info/licenses/LICENSE-3rd-party.txt,sha256=8o7aySJa9CBvFshPcsRdJbczzdNyDGJ8b0J67WRUQ2k,183936
316
+ aiqtoolkit-1.2.0a20250628.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
317
+ aiqtoolkit-1.2.0a20250628.dist-info/METADATA,sha256=kGslYo0xYh5ERzp0dvetOiCsiTWFe__dUyWxvxWkIiM,20274
318
+ aiqtoolkit-1.2.0a20250628.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
319
+ aiqtoolkit-1.2.0a20250628.dist-info/entry_points.txt,sha256=gRlPfR5g21t328WNEQ4CcEz80S1sJNS8A7rMDYnzl4A,452
320
+ aiqtoolkit-1.2.0a20250628.dist-info/top_level.txt,sha256=fo7AzYcNhZ_tRWrhGumtxwnxMew4xrT1iwouDy_f0Kc,4
321
+ aiqtoolkit-1.2.0a20250628.dist-info/RECORD,,