agentx-python 0.4.10__tar.gz → 0.4.11__tar.gz

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 (34) hide show
  1. {agentx_python-0.4.10/agentx_python.egg-info → agentx_python-0.4.11}/PKG-INFO +1 -1
  2. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/client.py +14 -0
  3. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/datasets.py +28 -0
  4. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/models.py +80 -0
  5. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/runner.py +33 -11
  6. agentx_python-0.4.11/agentx/version.py +1 -0
  7. {agentx_python-0.4.10 → agentx_python-0.4.11/agentx_python.egg-info}/PKG-INFO +1 -1
  8. agentx_python-0.4.10/agentx/version.py +0 -1
  9. {agentx_python-0.4.10 → agentx_python-0.4.11}/LICENSE +0 -0
  10. {agentx_python-0.4.10 → agentx_python-0.4.11}/README.md +0 -0
  11. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/__init__.py +0 -0
  12. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/agentx.py +0 -0
  13. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/__init__.py +0 -0
  14. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/_term.py +0 -0
  15. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/adapters/__init__.py +0 -0
  16. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/adapters/http_endpoint.py +0 -0
  17. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/adapters/precomputed.py +0 -0
  18. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/adapters/raw.py +0 -0
  19. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/redaction.py +0 -0
  20. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/reporting.py +0 -0
  21. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/results.py +0 -0
  22. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/evaluations/tracing.py +0 -0
  23. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/resources/__init__.py +0 -0
  24. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/resources/agent.py +0 -0
  25. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/resources/conversation.py +0 -0
  26. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/resources/workforce.py +0 -0
  27. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx/util.py +0 -0
  28. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx_python.egg-info/SOURCES.txt +0 -0
  29. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx_python.egg-info/dependency_links.txt +0 -0
  30. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx_python.egg-info/requires.txt +0 -0
  31. {agentx_python-0.4.10 → agentx_python-0.4.11}/agentx_python.egg-info/top_level.txt +0 -0
  32. {agentx_python-0.4.10 → agentx_python-0.4.11}/setup.cfg +0 -0
  33. {agentx_python-0.4.10 → agentx_python-0.4.11}/setup.py +0 -0
  34. {agentx_python-0.4.10 → agentx_python-0.4.11}/tests/test_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentx-python
3
- Version: 0.4.10
3
+ Version: 0.4.11
4
4
  Summary: Official Python SDK for AgentX (https://www.agentx.so/)
5
5
  Home-page: https://github.com/AgentX-ai/AgentX-python
6
6
  Author: Robin Wang and AgentX Team
@@ -14,6 +14,7 @@ from agentx.evaluations.models import (
14
14
  EvaluationResult,
15
15
  EvaluationRun,
16
16
  EvaluationSubject,
17
+ ModelInfo,
17
18
  Report,
18
19
  )
19
20
 
@@ -106,6 +107,19 @@ class EvaluationsClient:
106
107
  return resp.text
107
108
  raise AgentXEvaluationsError(f"Request failed after retries: {last_exc}")
108
109
 
110
+ # ------------------------------------------------------------------
111
+ # Model registry
112
+ # ------------------------------------------------------------------
113
+
114
+ def list_models(self, provider: Optional[str] = None) -> List[ModelInfo]:
115
+ """List the LLM models AgentX supports — the same set selectable for
116
+ the Sovereignty & Portability Index. Pass ``provider`` (e.g. "Google")
117
+ to filter."""
118
+ params = {"provider": provider} if provider else None
119
+ data = self._request("GET", "/models", params=params)
120
+ items = data if isinstance(data, list) else data.get("models", [])
121
+ return [ModelInfo(**m) for m in items]
122
+
109
123
  # ------------------------------------------------------------------
110
124
  # Dataset endpoints
111
125
  # ------------------------------------------------------------------
@@ -27,6 +27,10 @@ class DatasetBuilder:
27
27
  acceptance_criteria: Optional[str] = None,
28
28
  rejection_criteria: Optional[str] = None,
29
29
  evaluation_criteria: Optional[str] = None,
30
+ vector_similarity: bool = False,
31
+ jaccard_similarity: bool = False,
32
+ similarity_model: Optional[str] = None,
33
+ sovereignty_models: Optional[List[str]] = None,
30
34
  ):
31
35
  self._client = client
32
36
  self._payload: Dict[str, Any] = {
@@ -38,6 +42,22 @@ class DatasetBuilder:
38
42
  "evaluationCriteria": evaluation_criteria,
39
43
  "questions": [],
40
44
  }
45
+ # Opt-in similarity metrics, surfaced on the report as cosine_similarity /
46
+ # jaccard_similarity (computed against each case's expected_results).
47
+ if vector_similarity:
48
+ vs: Dict[str, Any] = {"enabled": True}
49
+ if similarity_model:
50
+ vs["model"] = similarity_model
51
+ self._payload["vectorSimilarity"] = vs
52
+ if jaccard_similarity:
53
+ self._payload["jaccardSimilarity"] = {"enabled": True}
54
+ # Sovereignty & Portability — the models to compare on this dataset (use
55
+ # client.evaluations.list_models() to discover valid ids).
56
+ if sovereignty_models:
57
+ self._payload["sovereigntyIndex"] = {
58
+ "enabled": True,
59
+ "models": list(sovereignty_models),
60
+ }
41
61
 
42
62
  def add_case(
43
63
  self,
@@ -190,6 +210,10 @@ class DatasetClient:
190
210
  acceptance_criteria: Optional[str] = None,
191
211
  rejection_criteria: Optional[str] = None,
192
212
  evaluation_criteria: Optional[str] = None,
213
+ vector_similarity: bool = False,
214
+ jaccard_similarity: bool = False,
215
+ similarity_model: Optional[str] = None,
216
+ sovereignty_models: Optional[List[str]] = None,
193
217
  ) -> DatasetBuilder:
194
218
  return DatasetBuilder(
195
219
  self._client,
@@ -199,6 +223,10 @@ class DatasetClient:
199
223
  acceptance_criteria=acceptance_criteria,
200
224
  rejection_criteria=rejection_criteria,
201
225
  evaluation_criteria=evaluation_criteria,
226
+ vector_similarity=vector_similarity,
227
+ jaccard_similarity=jaccard_similarity,
228
+ similarity_model=similarity_model,
229
+ sovereignty_models=sovereignty_models,
202
230
  )
203
231
 
204
232
  def from_csv(self, path: str, name: str, **kwargs) -> DatasetBuilder:
@@ -58,6 +58,18 @@ class Dataset(BaseModel):
58
58
  questions: List[DatasetQuestion] = Field(default_factory=list)
59
59
  status: str = "published"
60
60
  version_id: Optional[str] = Field(default=None, alias="versionId")
61
+ # Sovereignty & Portability — models selected to compare on this dataset.
62
+ # Hoisted from the nested ``sovereigntyIndex`` object when enabled.
63
+ sovereignty_models: List[str] = Field(default_factory=list)
64
+
65
+ @model_validator(mode="before")
66
+ @classmethod
67
+ def _extract_sovereignty_models(cls, data: Any) -> Any:
68
+ if isinstance(data, dict):
69
+ sov = data.get("sovereigntyIndex") or data.get("sovereignty_index") or {}
70
+ if isinstance(sov, dict) and sov.get("enabled") and sov.get("models"):
71
+ data = {**data, "sovereignty_models": list(sov.get("models") or [])}
72
+ return data
61
73
 
62
74
  class Config:
63
75
  populate_by_name = True
@@ -99,6 +111,30 @@ class EvaluationSubject(BaseModel):
99
111
  extra = "ignore"
100
112
 
101
113
 
114
+ # ---------------------------------------------------------------------------
115
+ # Supported models (the AgentX model registry / portability set)
116
+ # ---------------------------------------------------------------------------
117
+
118
+
119
+ class ModelInfo(BaseModel):
120
+ """One entry from the AgentX supported-model registry — the set selectable
121
+ for the Sovereignty & Portability Index. Returned by ``list_models()``."""
122
+
123
+ name: str
124
+ display: Optional[str] = None
125
+ provider: Optional[str] = None
126
+ context_window: Optional[int] = Field(default=None, alias="contextWindow")
127
+ max_output_tokens: Optional[int] = Field(default=None, alias="maxOutputTokens")
128
+ input_cost: Optional[float] = Field(default=None, alias="inputCost")
129
+ output_cost: Optional[float] = Field(default=None, alias="outputCost")
130
+ knowledge_cutoff: Optional[str] = Field(default=None, alias="knowledgeCutOff")
131
+ legacy: Optional[bool] = None
132
+
133
+ class Config:
134
+ populate_by_name = True
135
+ extra = "ignore"
136
+
137
+
102
138
  # ---------------------------------------------------------------------------
103
139
  # Run
104
140
  # ---------------------------------------------------------------------------
@@ -144,6 +180,10 @@ class EvaluationCase(BaseModel):
144
180
  expected_capabilities: Optional[List[str]] = None
145
181
  expected_knowledge_base: Optional[List[str]] = None
146
182
  expected_delegations: Optional[List[str]] = None
183
+ # Sovereignty & Portability: the model this case should run on. Set when the
184
+ # dataset selects comparison models; your callable can read it to pick the
185
+ # model. The SDK also tags the submitted result with it.
186
+ model: Optional[str] = None
147
187
 
148
188
  class Config:
149
189
  extra = "ignore"
@@ -299,6 +339,43 @@ class ReportRecommendation(BaseModel):
299
339
  extra = "ignore"
300
340
 
301
341
 
342
+ class SovereigntyModelMetrics(BaseModel):
343
+ """Per-model row of the Sovereignty & Portability matrix."""
344
+
345
+ model: str
346
+ provider: Optional[str] = None
347
+ is_baseline: bool = Field(default=False, alias="isBaseline")
348
+ run_count: int = Field(default=0, alias="runCount")
349
+ average_rating: Optional[float] = Field(default=None, alias="averageRating")
350
+ min_rating: Optional[float] = Field(default=None, alias="minRating")
351
+ max_rating: Optional[float] = Field(default=None, alias="maxRating")
352
+ rating_variance: Optional[float] = Field(default=None, alias="ratingVariance")
353
+ average_vector_similarity: Optional[float] = Field(
354
+ default=None, alias="averageVectorSimilarity"
355
+ )
356
+ average_jaccard_similarity: Optional[float] = Field(
357
+ default=None, alias="averageJaccardSimilarity"
358
+ )
359
+ average_latency_ms: Optional[float] = Field(default=None, alias="averageLatencyMs")
360
+ total_input_tokens: Optional[int] = Field(default=None, alias="totalInputTokens")
361
+ total_output_tokens: Optional[int] = Field(default=None, alias="totalOutputTokens")
362
+
363
+ class Config:
364
+ populate_by_name = True
365
+ extra = "ignore"
366
+
367
+
368
+ class SovereigntyIndex(BaseModel):
369
+ """Sovereignty & Portability matrix — side-by-side per-model performance,
370
+ grouped from the model-tagged results of a run."""
371
+
372
+ enabled: bool = False
373
+ models: List[SovereigntyModelMetrics] = Field(default_factory=list)
374
+
375
+ class Config:
376
+ extra = "ignore"
377
+
378
+
302
379
  class Report(BaseModel):
303
380
  run_id: str = Field(alias="runId")
304
381
  dataset_id: str = Field(alias="datasetId")
@@ -325,6 +402,9 @@ class Report(BaseModel):
325
402
  low_scoring_cases: List[Dict[str, Any]] = Field(
326
403
  default_factory=list, alias="lowScoringCases"
327
404
  )
405
+ sovereignty_index: Optional[SovereigntyIndex] = Field(
406
+ default=None, alias="sovereigntyIndex"
407
+ )
328
408
  dashboard_url: Optional[str] = Field(default=None, alias="dashboardUrl")
329
409
 
330
410
  class Config:
@@ -14,6 +14,7 @@ from agentx.evaluations.models import (
14
14
  EvaluationResult,
15
15
  EvaluationRun,
16
16
  EvaluationSubject,
17
+ ModelInfo,
17
18
  Report,
18
19
  )
19
20
  from agentx.evaluations.redaction import redact_dict
@@ -108,6 +109,12 @@ class EvaluationRunContext:
108
109
 
109
110
  result = normalized(case)
110
111
  result.idempotency_key = idem_key
112
+ # Tag the result with the case's model so the server can group it into
113
+ # the Sovereignty & Portability matrix (the callable may also set it).
114
+ if case.model:
115
+ meta = dict(result.metadata or {})
116
+ meta.setdefault("model", case.model)
117
+ result.metadata = meta
111
118
  result = EvaluationResult(
112
119
  **{**result.model_dump(), "idempotencyKey": idem_key}
113
120
  )
@@ -217,6 +224,13 @@ class EvaluationsRunner:
217
224
  self._client = client
218
225
  self.datasets = client.datasets
219
226
 
227
+ def list_models(self, provider: Optional[str] = None) -> List[ModelInfo]:
228
+ """List the LLM models AgentX supports — the same set selectable for
229
+ the Sovereignty & Portability Index. Pass ``provider`` (e.g. "Google")
230
+ to filter. Useful for discovering valid model identifiers to compare
231
+ against."""
232
+ return self._client.list_models(provider)
233
+
220
234
  def run(
221
235
  self,
222
236
  dataset_id: str,
@@ -257,21 +271,29 @@ def _wrap_adapter(adapter: AdapterLike) -> Callable[[EvaluationCase], Evaluation
257
271
  def _build_cases(dataset: Dataset) -> List[EvaluationCase]:
258
272
  cases: List[EvaluationCase] = []
259
273
  n_runs = max(dataset.number_of_requests, 1)
274
+ # Sovereignty & Portability: when the dataset selects comparison models, run
275
+ # every question/run once per model in this single run so the report groups
276
+ # results into a per-model portability matrix (mirrors the native route).
277
+ # ``[None]`` keeps legacy single-model behavior (case.model stays unset).
278
+ models: List[Optional[str]] = list(dataset.sovereignty_models) or [None]
260
279
  for q_idx, question in enumerate(dataset.questions):
261
280
  mq = question.main_question
262
281
  for run_num in range(1, n_runs + 1):
263
- cases.append(
264
- EvaluationCase(
265
- case_id=f"case-{q_idx}",
266
- question_index=q_idx,
267
- run_number=run_num,
268
- query=mq.query,
269
- expected_results=mq.expected_results,
270
- expected_capabilities=mq.expected_capabilities,
271
- expected_knowledge_base=mq.expected_knowledge_base,
272
- expected_delegations=mq.expected_delegations,
282
+ for model in models:
283
+ suffix = f"::{model}" if model else ""
284
+ cases.append(
285
+ EvaluationCase(
286
+ case_id=f"case-{q_idx}{suffix}",
287
+ question_index=q_idx,
288
+ run_number=run_num,
289
+ query=mq.query,
290
+ expected_results=mq.expected_results,
291
+ expected_capabilities=mq.expected_capabilities,
292
+ expected_knowledge_base=mq.expected_knowledge_base,
293
+ expected_delegations=mq.expected_delegations,
294
+ model=model,
295
+ )
273
296
  )
274
- )
275
297
  return cases
276
298
 
277
299
 
@@ -0,0 +1 @@
1
+ VERSION = "0.4.11"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentx-python
3
- Version: 0.4.10
3
+ Version: 0.4.11
4
4
  Summary: Official Python SDK for AgentX (https://www.agentx.so/)
5
5
  Home-page: https://github.com/AgentX-ai/AgentX-python
6
6
  Author: Robin Wang and AgentX Team
@@ -1 +0,0 @@
1
- VERSION = "0.4.10"
File without changes
File without changes
File without changes
File without changes