gooddata-eval 1.80.1.dev3__py3-none-any.whl → 1.80.1.dev4__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.
gooddata_eval/cli/main.py CHANGED
@@ -15,6 +15,7 @@ from rich.console import Console
15
15
  from rich.table import Table
16
16
 
17
17
  from gooddata_eval.cli.agentic_runner import AGENTIC_TEST_KINDS, UNGATED_AGENTIC_TEST_KINDS, run_agentic_items
18
+ from gooddata_eval.core.catalog.http_client import CatalogMetadataClient
18
19
  from gooddata_eval.core.chat.sse_client import ChatClient, set_default_item_timeout, set_default_turn_timeout
19
20
  from gooddata_eval.core.config import (
20
21
  DEFAULT_GATE,
@@ -48,7 +49,8 @@ class _RoutingBackend:
48
49
  """Dispatch each item to the right backend by test_kind.
49
50
 
50
51
  Kinds in `by_kind` go to their dedicated endpoint client (`dashboard_summary` to the
51
- summary endpoint, `document_takeaway` to the takeaway endpoint); everything else uses
52
+ summary endpoint, `document_takeaway` to the takeaway endpoint, `catalog_metadata` to the
53
+ Analytics Catalog generate endpoints); everything else uses
52
54
  the conversational chat endpoint.
53
55
  """
54
56
 
@@ -620,6 +622,9 @@ def _run(config: RunConfig) -> int:
620
622
  "document_takeaway": TakeawayClient(
621
623
  host=config.host, token=config.token, workspace_id=config.workspace_id
622
624
  ),
625
+ "catalog_metadata": CatalogMetadataClient(
626
+ host=config.host, token=config.token, workspace_id=config.workspace_id
627
+ ),
623
628
  },
624
629
  )
625
630
  try:
@@ -13,6 +13,8 @@ import time
13
13
  from collections.abc import Callable
14
14
  from typing import TypeVar
15
15
 
16
+ import httpx
17
+
16
18
  _log = logging.getLogger(__name__)
17
19
 
18
20
  T = TypeVar("T")
@@ -24,6 +26,31 @@ T = TypeVar("T")
24
26
  RETRYABLE_STATUS_CODES: frozenset[int] = frozenset({429, 500, 502, 503, 504})
25
27
 
26
28
 
29
+ # Failures of the single-shot endpoint clients (takeaway, catalog) that say nothing about the
30
+ # request. A read timeout is left out: the server was computing, and retrying spends the whole
31
+ # timeout again on every attempt.
32
+ RETRYABLE_TRANSPORT_ERRORS = (httpx.ConnectError, httpx.ConnectTimeout, httpx.RemoteProtocolError, httpx.PoolTimeout)
33
+
34
+
35
+ def is_retryable_request_error(exc: Exception) -> bool:
36
+ """Whether a single-shot endpoint client retries this failure: a retryable status or transport error."""
37
+ if isinstance(exc, httpx.HTTPStatusError):
38
+ return exc.response.status_code in RETRYABLE_STATUS_CODES
39
+ return isinstance(exc, RETRYABLE_TRANSPORT_ERRORS)
40
+
41
+
42
+ def is_transient(exc: httpx.HTTPError) -> bool:
43
+ """Whether a failure left after the client's retries says nothing about the request.
44
+
45
+ 429, 5xx and transport failures (a read timeout included) are transient; any other 4xx
46
+ (flag off, no agent, invalid body) and an unsupported URL scheme are setup problems.
47
+ """
48
+ if isinstance(exc, httpx.HTTPStatusError):
49
+ status = exc.response.status_code
50
+ return status == 429 or status >= 500
51
+ return isinstance(exc, httpx.TransportError) and not isinstance(exc, httpx.UnsupportedProtocol)
52
+
53
+
27
54
  def int_env(name: str, default: int) -> int:
28
55
  """Read an int from the environment, falling back to ``default`` when unset or blank."""
29
56
  raw = os.getenv(name)
@@ -0,0 +1 @@
1
+ # (C) 2026 GoodData Corporation
@@ -0,0 +1,268 @@
1
+ # (C) 2026 GoodData Corporation
2
+ """Entry point for evaluating one catalog_metadata item K times, for the Tavern shim.
3
+
4
+ The CLI evaluates catalog items through the single-shot runner; CI goes through
5
+ ``evaluate_catalog_metadata``, which owns the K-run loop, the gate and the Langfuse
6
+ experiment item the same way ``evaluate_document_takeaway`` does, so the nightly report
7
+ reads it unchanged.
8
+
9
+ The generate endpoints return no conversation id, so there is no gen-ai trace to link:
10
+ every score is written to gd-eval's own experiment span.
11
+
12
+ A run whose request still fails transiently after the client's retries (5xx, 429, a
13
+ connection failure or a read timeout) is recorded as an errored run and left ungraded;
14
+ the item raises it only when no run completed. Any other 4xx (no AI entitlement, invalid
15
+ body) or an unsupported URL scheme is a setup problem and raises on the first run.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import time
21
+ from dataclasses import dataclass
22
+ from typing import Any
23
+
24
+ import httpx
25
+
26
+ from gooddata_eval.core._retry import is_transient
27
+ from gooddata_eval.core.agentic._failed_runs import build_failed_runs
28
+ from gooddata_eval.core.agentic._gate import (
29
+ DEFAULT_GATE,
30
+ EvalGate,
31
+ gate_failure_note,
32
+ gate_passed,
33
+ log_gate_scores,
34
+ stamp_gate_metadata,
35
+ )
36
+ from gooddata_eval.core.agentic._trace_linker import (
37
+ RunIdentity,
38
+ RunTraceContext,
39
+ SubmitTraceLink,
40
+ open_trace_window,
41
+ run_trace_link_inline,
42
+ submit_trace_scoring,
43
+ utc_now,
44
+ )
45
+ from gooddata_eval.core.catalog.http_client import CatalogMetadataClient
46
+ from gooddata_eval.core.config import ReasoningEffort
47
+ from gooddata_eval.core.evaluators._llm_judge import JudgeResponseError
48
+ from gooddata_eval.core.evaluators.base import ItemEvaluation
49
+ from gooddata_eval.core.evaluators.catalog_metadata import CatalogMetadataEvaluator
50
+ from gooddata_eval.core.models import AgenticAssertionError, AgenticEvalOutcome, ChatResult, DatasetItem
51
+ from gooddata_eval.core.timing import PhaseTimings, sum_timings
52
+
53
+ _TEST_KIND = "catalog_metadata"
54
+ _COUNT_SCORES = ("word_count", "unusable_retries")
55
+
56
+
57
+ class CatalogMetadataAssertionError(AgenticAssertionError):
58
+ """Raised when a catalog_metadata evaluation fails its gate."""
59
+
60
+
61
+ @dataclass
62
+ class _CatalogRun:
63
+ chat_result: ChatResult
64
+ evaluation: ItemEvaluation
65
+ latency_s: float
66
+ timings: PhaseTimings
67
+ request_error: httpx.HTTPError | None = None
68
+
69
+ @property
70
+ def judge_error(self) -> str | None:
71
+ return self.evaluation.error
72
+
73
+ @property
74
+ def checks(self) -> dict[str, bool]:
75
+ return {k: v for k, v in self.evaluation.detail.items() if isinstance(v, bool)}
76
+
77
+
78
+ def _dataset_item(dataset_item: dict, dataset_name: str) -> DatasetItem:
79
+ item = DatasetItem.model_validate(
80
+ {"id": "", "test_kind": _TEST_KIND, "expected_output": {}, **dataset_item, "dataset_name": dataset_name}
81
+ )
82
+ if item.catalog_input is None:
83
+ raise ValueError(f"catalog_metadata item '{item.id}' is missing required 'catalog_input'.")
84
+ return item
85
+
86
+
87
+ def _run_once(client: CatalogMetadataClient, evaluator: CatalogMetadataEvaluator, item: DatasetItem) -> _CatalogRun:
88
+ started = time.monotonic()
89
+ try:
90
+ chat_result = client.ask(item)
91
+ except httpx.HTTPError as exc:
92
+ if not is_transient(exc):
93
+ raise
94
+ elapsed = time.monotonic() - started
95
+ error = f"{type(exc).__name__}: {exc}"
96
+ evaluation = ItemEvaluation(passed=False, rank_key=(-2, 0.0), detail={"request_error": error}, error=error)
97
+ return _CatalogRun(ChatResult(), evaluation, elapsed, PhaseTimings(agent_s=elapsed), request_error=exc)
98
+ asked = time.monotonic()
99
+ evaluation = evaluator.evaluate(item, chat_result)
100
+ judged = time.monotonic()
101
+ return _CatalogRun(
102
+ chat_result, evaluation, asked - started, PhaseTimings(agent_s=asked - started, judge_s=judged - asked)
103
+ )
104
+
105
+
106
+ def evaluate_catalog_metadata(
107
+ *,
108
+ host: str,
109
+ token: str,
110
+ workspace_id: str,
111
+ dataset_item: dict,
112
+ dataset_name: str,
113
+ run_timestamp: str | None,
114
+ model_version_override: str | None = None,
115
+ reasoning_effort: ReasoningEffort | None = None,
116
+ k: int = 1,
117
+ gate: EvalGate = DEFAULT_GATE,
118
+ run_metadata_extra: dict | None = None,
119
+ langfuse: object | None = None,
120
+ submit_trace_link: SubmitTraceLink = run_trace_link_inline,
121
+ client: CatalogMetadataClient | None = None,
122
+ evaluator: CatalogMetadataEvaluator | None = None,
123
+ ) -> AgenticEvalOutcome:
124
+ """Generate the item's title or description K times, grade each, log to Langfuse, and raise on a failed gate.
125
+
126
+ Args:
127
+ host: GoodData host URL.
128
+ token: API token.
129
+ workspace_id: Workspace the catalog object lives in.
130
+ dataset_item: The item as stored: `id`, `question`, `expected_output`, `catalog_input`.
131
+ dataset_name: Langfuse dataset name; prefixes the experiment run name.
132
+ run_timestamp: Shared run timestamp for the run name.
133
+ model_version_override: Model-version tag for the run; the workspace's active LLM
134
+ provider otherwise.
135
+ reasoning_effort: Only names the run: the generate endpoints have no reasoning option.
136
+ k: Runs per item.
137
+ gate: `any` (pass@K) or `power` (pass^K).
138
+ run_metadata_extra: Extra experiment-run metadata, e.g. `testing_framework`.
139
+ langfuse: Langfuse client; built from the LANGFUSE_* environment when None.
140
+ submit_trace_link: How the Langfuse block is run; inline by default.
141
+ client: Catalog client to use instead of one built from host/token/workspace.
142
+ evaluator: Evaluator to use instead of a default one.
143
+
144
+ Raises:
145
+ CatalogMetadataAssertionError: the gate did not pass.
146
+ ValueError: the item has no `catalog_input` or an `expected_output` the evaluator
147
+ cannot read, raised before any request.
148
+ httpx.HTTPError: the endpoint refused with a non-transient 4xx, or no run completed;
149
+ the message carries status and body.
150
+ JudgeResponseError: the judge returned no readable verdict for any run.
151
+ """
152
+ item = _dataset_item(dataset_item, dataset_name)
153
+ evaluator = evaluator or CatalogMetadataEvaluator()
154
+ evaluator.validate(item)
155
+ own_client = client is None
156
+ catalog_client = client or CatalogMetadataClient(host=host, token=token, workspace_id=workspace_id)
157
+ langfuse, window_start = open_trace_window(langfuse)
158
+ try:
159
+ runs = [_run_once(catalog_client, evaluator, item) for _ in range(k)]
160
+ finally:
161
+ if own_client:
162
+ catalog_client.close()
163
+
164
+ completed = [r for r in runs if r.request_error is None]
165
+ if not completed:
166
+ raise runs[-1].request_error or RuntimeError("no catalog_metadata run completed")
167
+ graded = [r for r in runs if r.judge_error is None]
168
+ pass_at_k = any(r.evaluation.passed for r in graded)
169
+ pass_power_k = all(r.evaluation.passed for r in runs)
170
+
171
+ if langfuse is not None and item.id:
172
+ window_end = utc_now()
173
+
174
+ def _write_scores(ctx: RunTraceContext) -> None:
175
+ stamp_gate_metadata(ctx.run_metadata, k=len(runs), gate=gate)
176
+ for run_idx, run in enumerate(runs):
177
+ if run.judge_error is not None:
178
+ continue
179
+ with ctx.observe(None, run_idx, output=run.chat_result.raw_response) as tid:
180
+ for name, value in run.checks.items():
181
+ ctx.score(tid, name=name, value=float(value), data_type="BOOLEAN")
182
+ for name in _COUNT_SCORES:
183
+ if name in run.evaluation.detail:
184
+ ctx.score(tid, name=name, value=run.evaluation.detail[name], data_type="NUMERIC")
185
+ ctx.score(
186
+ tid, name="catalog_metadata_pass", value=float(run.evaluation.passed), data_type="BOOLEAN"
187
+ )
188
+ log_gate_scores(ctx, tid, gate=gate, pass_at_k=pass_at_k, pass_power_k=pass_power_k)
189
+ ctx.quality(tid, strict_checks=run.checks, latency_sec=run.latency_s, cost_usd=None)
190
+
191
+ submit_trace_scoring(
192
+ submit_trace_link,
193
+ RunIdentity(
194
+ host,
195
+ token,
196
+ workspace_id,
197
+ dataset_name,
198
+ run_timestamp,
199
+ model_version_override,
200
+ run_metadata_extra,
201
+ reasoning_effort,
202
+ ),
203
+ langfuse=langfuse,
204
+ dataset_item_id=item.id,
205
+ conversation_ids=[],
206
+ window_start=window_start,
207
+ window_end=window_end,
208
+ suffix_runs=len(runs) > 1,
209
+ write_scores=_write_scores,
210
+ item_input=item.question,
211
+ )
212
+
213
+ item_timings = sum_timings([r.timings for r in runs])
214
+ unscored = [r.judge_error for r in runs if r.judge_error is not None]
215
+ request_errors = [r.judge_error for r in runs if r.request_error is not None and r.judge_error is not None]
216
+ judge_errors = [r.judge_error for r in completed if r.judge_error is not None]
217
+ best = max(completed, key=lambda r: r.evaluation.rank_key)
218
+ runs_passed = sum(1 for r in runs if r.evaluation.passed)
219
+ detail: dict[str, Any] = {
220
+ **best.evaluation.detail,
221
+ **({"unscored_runs": len(unscored)} if unscored else {}),
222
+ **({"judge_errors": judge_errors} if judge_errors else {}),
223
+ **({"request_errors": request_errors} if request_errors else {}),
224
+ }
225
+ failed_runs = build_failed_runs(runs, passed=lambda r: r.evaluation.passed, detail=lambda r: r.evaluation.detail)
226
+
227
+ def _attach(exc: CatalogMetadataAssertionError | JudgeResponseError) -> None:
228
+ exc.reasoning_steps = []
229
+ exc.conversation_id = ""
230
+ exc.response_id = None
231
+ exc.timings = item_timings
232
+ exc.detail = detail
233
+ exc.runs_passed = runs_passed
234
+ exc.runs_effective = len(runs)
235
+ exc.failed_runs = failed_runs
236
+
237
+ if not graded:
238
+ if request_errors:
239
+ causes = [
240
+ *([f"judge returned no readable verdict for {len(judge_errors)} run(s)"] if judge_errors else []),
241
+ f"request failed for {len(request_errors)} run(s)",
242
+ ]
243
+ message = f"no run of {len(runs)} could be graded: {', '.join(causes)}: "
244
+ else:
245
+ message = f"judge returned no readable verdict for any of the {len(runs)} run(s): "
246
+ exc_judge = JudgeResponseError(message + " | ".join(unscored))
247
+ _attach(exc_judge)
248
+ raise exc_judge
249
+
250
+ if not gate_passed(gate, pass_at_k=pass_at_k, pass_power_k=pass_power_k):
251
+ failed = [name for name, ok in best.checks.items() if not ok]
252
+ parts = [
253
+ "Catalog metadata assertion failed.",
254
+ gate_failure_note(gate, runs_passed, len(runs), len(unscored)),
255
+ *([f"Failed checks: {', '.join(failed)}."] if failed else []),
256
+ *([f"Request errors: {' | '.join(request_errors)}"] if request_errors else []),
257
+ f"Generated: {best.chat_result.text_response!r}",
258
+ ]
259
+ exc = CatalogMetadataAssertionError(" ".join(parts))
260
+ _attach(exc)
261
+ raise exc
262
+ return AgenticEvalOutcome(
263
+ detail=detail,
264
+ timings=item_timings,
265
+ runs_passed=runs_passed,
266
+ runs_effective=len(runs),
267
+ failed_runs=failed_runs,
268
+ )
@@ -0,0 +1,98 @@
1
+ # (C) 2026 GoodData Corporation
2
+ """HTTP client for the Analytics Catalog title/description generation endpoints.
3
+
4
+ Endpoints (afm-exec-api, served by gen-ai):
5
+ POST /api/v1/actions/workspaces/{workspace_id}/ai/analyticsCatalog/generateTitle
6
+ POST /api/v1/actions/workspaces/{workspace_id}/ai/analyticsCatalog/generateDescription
7
+
8
+ Both take ``{"objectType", "objectId"}`` and answer ``{"title"|"description", "note"}``.
9
+ The generated text becomes ``ChatResult.text_response``; the whole response body is kept
10
+ on ``raw_response`` with two extra keys the evaluator reads: ``output`` (which field was
11
+ asked for) and ``unusable_retries``. A placeholder ``"string"`` is dropped from both the
12
+ text and the note.
13
+
14
+ A 200 answer can carry no usable text: a null value with a null note, or the literal
15
+ schema placeholder ``"string"``. The endpoint is asked again once in that case, and the
16
+ retry is recorded, so a run reports the answer a user gets after one regenerate click.
17
+ A null value that comes with a note is the endpoint declining on purpose and is kept.
18
+ """
19
+
20
+ from typing import Any
21
+
22
+ import httpx
23
+
24
+ from gooddata_eval.core._retry import is_retryable_request_error, retry_transient
25
+ from gooddata_eval.core.models import CatalogInput, ChatResult, DatasetItem
26
+
27
+ _PATH = "/api/v1/actions/workspaces/{workspace_id}/ai/analyticsCatalog/{action}"
28
+ _ACTIONS = {"title": "generateTitle", "description": "generateDescription"}
29
+ _PLACEHOLDER = "string"
30
+
31
+
32
+ def _text(value: Any) -> str:
33
+ """A field's text for the usable check: blank and the schema placeholder count as none."""
34
+ text = value.strip() if isinstance(value, str) else ""
35
+ return "" if text == _PLACEHOLDER else text
36
+
37
+
38
+ def is_unusable(data: dict[str, Any], output: str) -> bool:
39
+ """Whether a 200 answer carries neither a generated text nor a reason for its absence."""
40
+ return not _text(data.get(output)) and not _text(data.get("note"))
41
+
42
+
43
+ class CatalogMetadataClient:
44
+ """Single-shot client for the Analytics Catalog generate endpoints."""
45
+
46
+ def __init__(self, host: str, token: str, workspace_id: str, *, timeout: float = 120.0, unusable_retries: int = 1):
47
+ self._base = host.rstrip("/")
48
+ self._workspace_id = workspace_id
49
+ self._auth = {"Authorization": f"Bearer {token}"}
50
+ self._client = httpx.Client(timeout=timeout)
51
+ self._unusable_retries = unusable_retries
52
+
53
+ def ask(self, item: DatasetItem) -> ChatResult:
54
+ """Generate the title or description an item asks for and adapt it to a ChatResult.
55
+
56
+ Raises:
57
+ ValueError: The item carries no `catalog_input`.
58
+ httpx.HTTPStatusError: As `request`.
59
+ """
60
+ ci = item.catalog_input
61
+ if ci is None:
62
+ raise ValueError(f"catalog_metadata item '{item.id}' is missing required 'catalog_input'.")
63
+ return self.request(ci)
64
+
65
+ def request(self, ci: CatalogInput) -> ChatResult:
66
+ """Generate one text and adapt it to a ChatResult.
67
+
68
+ Raises:
69
+ httpx.HTTPStatusError: The endpoint answered non-2xx after the transient retries.
70
+ """
71
+ url = f"{self._base}{_PATH.format(workspace_id=self._workspace_id, action=_ACTIONS[ci.output])}"
72
+ body = {"objectType": ci.object_type, "objectId": ci.object_id}
73
+
74
+ def _post() -> httpx.Response:
75
+ resp = self._client.post(url, json=body, headers={**self._auth, "Content-Type": "application/json"})
76
+ if not resp.is_success:
77
+ raise httpx.HTTPStatusError(
78
+ f"Catalog generate request failed with {resp.status_code} for {url}: {resp.text}",
79
+ request=resp.request,
80
+ response=resp,
81
+ )
82
+ return resp
83
+
84
+ retries = 0
85
+ data: dict[str, Any] = retry_transient(_post, is_retryable=is_retryable_request_error).json()
86
+ while is_unusable(data, ci.output) and retries < self._unusable_retries:
87
+ retries += 1
88
+ data = retry_transient(_post, is_retryable=is_retryable_request_error).json()
89
+ text = _text(data.get(ci.output))
90
+ # The placeholder is no reason either: a declined answer must carry a real note.
91
+ note = _text(data.get("note")) or None
92
+ return ChatResult(
93
+ text_response=text,
94
+ raw_response={**data, "note": note, "output": ci.output, "unusable_retries": retries},
95
+ )
96
+
97
+ def close(self) -> None:
98
+ self._client.close()
@@ -18,7 +18,7 @@ import httpx
18
18
  from pydantic import ValidationError
19
19
 
20
20
  from gooddata_eval.core.langfuse._env import make_http_client
21
- from gooddata_eval.core.models import DatasetItem, SummaryInput, TakeawayInput
21
+ from gooddata_eval.core.models import CatalogInput, DatasetItem, SummaryInput, TakeawayInput
22
22
 
23
23
  _PAGE_SIZE = 100
24
24
 
@@ -60,6 +60,27 @@ def _summary_input_from_raw(raw: dict, expected_output: Any) -> SummaryInput | N
60
60
  return SummaryInput.model_validate(candidate) if candidate is not None else None
61
61
 
62
62
 
63
+ def _catalog_input_from_raw(raw: dict, expected_output: Any) -> CatalogInput | None:
64
+ """Locate a catalog_metadata item's `catalog_input`.
65
+
66
+ Raises:
67
+ ValueError: The value found is not a valid `catalog_input` object.
68
+ """
69
+ for source in (raw.get("input"), raw.get("metadata"), expected_output):
70
+ if not isinstance(source, dict) or source.get("catalog_input") is None:
71
+ continue
72
+ found = source["catalog_input"]
73
+ if not isinstance(found, dict):
74
+ raise ValueError(
75
+ f"Langfuse item {raw.get('id')!r}: catalog_input must be a JSON object, got {type(found).__name__}"
76
+ )
77
+ try:
78
+ return CatalogInput.model_validate(found)
79
+ except ValidationError as e:
80
+ raise ValueError(f"Langfuse item {raw.get('id')!r}: invalid catalog_input: {e}") from e
81
+ return None
82
+
83
+
63
84
  def _takeaway_input_from_raw(raw: dict, expected_output: Any) -> TakeawayInput | None:
64
85
  """Locate a document_takeaway item's `takeaway_input`.
65
86
 
@@ -138,9 +159,14 @@ def _item_from_raw(raw: dict, *, dataset_name: str, test_kind: str) -> DatasetIt
138
159
  # REST API returns camelCase: expectedOutput, not expected_output
139
160
  expected_output = raw.get("expectedOutput") or raw.get("expected_output")
140
161
  takeaway_input = _takeaway_input_from_raw(raw, expected_output)
141
- # An item carrying `takeaway_input` can only be a takeaway item, so it stands in for
142
- # the CLI default; an explicit test_kind or a structural match still wins.
143
- default_kind = "document_takeaway" if takeaway_input is not None else test_kind
162
+ catalog_input = _catalog_input_from_raw(raw, expected_output)
163
+ # An item carrying `takeaway_input` or `catalog_input` can only be of that kind, so it stands
164
+ # in for the CLI default; an explicit test_kind or a structural match still wins.
165
+ default_kind = test_kind
166
+ if catalog_input is not None:
167
+ default_kind = "catalog_metadata"
168
+ if takeaway_input is not None:
169
+ default_kind = "document_takeaway"
144
170
  resolved_kind = _infer_test_kind(expected_output, default_kind, raw.get("metadata"))
145
171
  return DatasetItem(
146
172
  id=str(raw["id"]),
@@ -150,6 +176,7 @@ def _item_from_raw(raw: dict, *, dataset_name: str, test_kind: str) -> DatasetIt
150
176
  expected_output=expected_output,
151
177
  summary_input=_summary_input_from_raw(raw, expected_output),
152
178
  takeaway_input=takeaway_input,
179
+ catalog_input=catalog_input,
153
180
  user_context=_user_context_from_raw(raw),
154
181
  )
155
182
 
@@ -21,7 +21,7 @@ _EAGER_EVALUATORS: dict[str, Evaluator] = {
21
21
  }
22
22
 
23
23
  # LLM-judge evaluators (general_question, guardrail, dashboard_summary, knowledge_question,
24
- # document_takeaway)
24
+ # document_takeaway, catalog_metadata)
25
25
  # require the [llm-judge] extra. Their modules are imported lazily on first use so the CLI
26
26
  # starts without openai.
27
27
  #
@@ -36,6 +36,7 @@ _LAZY_EVALUATOR_MODULES: dict[str, str] = {
36
36
  "dashboard_summary": "gooddata_eval.core.evaluators.summary",
37
37
  "knowledge_question": "gooddata_eval.core.evaluators.general_question",
38
38
  "document_takeaway": "gooddata_eval.core.evaluators.takeaway",
39
+ "catalog_metadata": "gooddata_eval.core.evaluators.catalog_metadata",
39
40
  }
40
41
  _LAZY_EVALUATOR_CLASSES: dict[str, str] = {
41
42
  "general_question": "GeneralQuestionEvaluator",
@@ -43,6 +44,7 @@ _LAZY_EVALUATOR_CLASSES: dict[str, str] = {
43
44
  "dashboard_summary": "DashboardSummaryEvaluator",
44
45
  "knowledge_question": "GeneralQuestionEvaluator",
45
46
  "document_takeaway": "DocumentTakeawayEvaluator",
47
+ "catalog_metadata": "CatalogMetadataEvaluator",
46
48
  }
47
49
 
48
50
 
@@ -69,7 +71,7 @@ def supported_test_kinds() -> set[str]:
69
71
  """Return all supported test_kind values.
70
72
 
71
73
  LLM-judge kinds (general_question, guardrail, dashboard_summary,
72
- knowledge_question, document_takeaway) are excluded when the [llm-judge] extra (openai) is
74
+ knowledge_question, document_takeaway, catalog_metadata) are excluded when the [llm-judge] extra (openai) is
73
75
  not installed — those items are skipped rather than erroring out mid-run.
74
76
  """
75
77
  kinds = set(_EAGER_EVALUATORS)
@@ -1,5 +1,8 @@
1
1
  # (C) 2026 GoodData Corporation
2
- """Shared text-extraction helpers for text-answer evaluators."""
2
+ """Shared text helpers for text-answer evaluators: answer extraction, word and sentence counts."""
3
+
4
+ import re
5
+ from collections.abc import Collection
3
6
 
4
7
  from gooddata_eval.core.chat.render import render_answer_text
5
8
  from gooddata_eval.core.models import ChatResult
@@ -8,3 +11,33 @@ from gooddata_eval.core.models import ChatResult
8
11
  def extract_text(chat_result: ChatResult) -> str:
9
12
  """Extract the agent's answer: prose plus any content-bearing non-text part."""
10
13
  return render_answer_text(chat_result)
14
+
15
+
16
+ # A terminator, any closing quotes or brackets, then whitespace before the next sentence.
17
+ _SENTENCE_BREAK = re.compile(r"[.!?]+[\"'”’»)\]]*\s+(?=\S)")
18
+ _SENTENCE_OPENERS = "\"'“‘„«(["
19
+
20
+
21
+ def count_words(text: str) -> int:
22
+ """Words in `text`: whitespace-separated tokens holding a letter or digit, bold markers ignored."""
23
+ return sum(1 for token in text.replace("**", " ").split() if any(ch.isalnum() for ch in token))
24
+
25
+
26
+ def count_sentences(text: str, abbreviations: Collection[str]) -> int:
27
+ """Sentences in `text`; a break needs the next sentence to open with a capital, digit or quote.
28
+
29
+ That keeps "vs. last" or "např. v" from splitting one sentence in two. A terminator right
30
+ after a token in `abbreviations` (lowercase, without its final dot: "vs", "e.g") is no
31
+ break either. Each evaluator passes its own list, so tuning one cannot move another's verdicts.
32
+ """
33
+ plain = text.replace("**", "").strip()
34
+ if not plain:
35
+ return 0
36
+ breaks = 0
37
+ for match in _SENTENCE_BREAK.finditer(plain):
38
+ nxt = plain[match.end()]
39
+ token = (plain[: match.start()].rsplit(maxsplit=1) or [""])[-1].lstrip("\"'“‘„«([").lower()
40
+ if token in abbreviations:
41
+ continue
42
+ breaks += nxt.isupper() or nxt.isdigit() or nxt in _SENTENCE_OPENERS
43
+ return breaks + 1
@@ -0,0 +1,200 @@
1
+ # (C) 2026 GoodData Corporation
2
+ """Evaluator for catalog_metadata: format checks plus an LLM-judge rubric on a generated title or description.
3
+
4
+ The Analytics Catalog generates a title (a short label) or a description (one to three
5
+ plain sentences) for one object from its metadata. The default limits (title 10 words,
6
+ description 4 sentences) sit one step above what the product prompt asks for (2-8 words,
7
+ 1-3 sentences): they catch a broken shape, not a slightly long answer. `expected_output` is:
8
+
9
+ {
10
+ "expect_note": false,
11
+ "format": {...overrides of the output's default format...},
12
+ "must_include": ["...criteria the text must satisfy..."],
13
+ "must_not_include": ["...characteristics the text must not show..."],
14
+ "rubric": ["...soft quality dimensions..."]
15
+ }
16
+
17
+ Every key is optional. The format checks need no judge and gate the verdict; a ``format``
18
+ value of ``false`` or ``null`` switches its check off. ``expect_note`` decides the item
19
+ alone: the endpoint must return no text and a non-empty note (it declined, e.g. the
20
+ object does not exist). Judge criteria grade like ``dashboard_summary``; the item's
21
+ question is what the judge reads as INPUT, so it states the object's real metadata in
22
+ plain words.
23
+ """
24
+
25
+ import re
26
+ from typing import Any
27
+
28
+ from gooddata_eval.core.evaluators._llm_judge import LLMJudge
29
+ from gooddata_eval.core.evaluators._rubric import Criterion, grade_rubric
30
+ from gooddata_eval.core.evaluators._text_utils import count_sentences, count_words
31
+ from gooddata_eval.core.evaluators.base import ItemEvaluation
32
+ from gooddata_eval.core.models import ChatResult, DatasetItem
33
+
34
+ _DEFAULT_FORMAT: dict[str, dict[str, Any]] = {
35
+ "title": {"max_words": 10, "max_sentences": 1, "no_end_period": True, "no_markup": True, "no_ids": True},
36
+ "description": {"max_words": 80, "max_sentences": 4, "no_end_period": False, "no_markup": True, "no_ids": True},
37
+ }
38
+
39
+ _POSITIVE_STEPS = [
40
+ "Read the INPUT (the analytics object the text was generated for, with its real metadata) and the "
41
+ "EXPECTED OUTPUT (one criterion the text must satisfy).",
42
+ "Read the ACTUAL OUTPUT (the generated title or description).",
43
+ "Score 1 if the actual output clearly satisfies the criterion.",
44
+ "Score 0 if the criterion is missing, contradicted, or only partially addressed.",
45
+ ]
46
+
47
+ # A presence question, inverted in code -- see the same split in summary.py. The INPUT
48
+ # carries the object's real metadata, which pulls the judge towards grading correctness;
49
+ # the third step keeps it on presence.
50
+ _VIOLATION_STEPS = [
51
+ "Read the CHARACTERISTIC described in EXPECTED OUTPUT, including any exceptions it states.",
52
+ "Read the ACTUAL OUTPUT (the generated title or description).",
53
+ "Decide only whether the actual output exhibits the characteristic, not whether it is correct or wanted.",
54
+ "Score 1 if the actual output clearly exhibits the described characteristic.",
55
+ "Score 0 if it does not exhibit it.",
56
+ ]
57
+
58
+ # Bold, single emphasis (*x*, _x_), code, a heading or a list item. A leading "# of" is a metric
59
+ # name ("# of Orders"), not a heading.
60
+ _MARKUP = re.compile(
61
+ r"\*\*|`|(?<![\w*])[*_](?=\S)[^*_\n]+(?<=\S)[*_](?![\w*])|^\s*#{1,6}\s(?!of\b)|^\s*(?:[-*•]|\d+[.)])\s",
62
+ re.MULTILINE,
63
+ )
64
+ _LIMITS = ("max_words", "max_sentences")
65
+ # Label abbreviations a title or description may keep: "Avg. Order Value", "U.K. Sales".
66
+ _ABBREVIATIONS = frozenset(
67
+ {
68
+ "vs",
69
+ "e.g",
70
+ "i.e",
71
+ "etc",
72
+ "incl",
73
+ "excl",
74
+ "approx",
75
+ "avg",
76
+ "est",
77
+ "no",
78
+ "nr",
79
+ "qty",
80
+ "pct",
81
+ "yr",
82
+ "yrs",
83
+ "mo",
84
+ "min",
85
+ "max",
86
+ "dept",
87
+ "u.s",
88
+ "u.k",
89
+ "e.u",
90
+ }
91
+ )
92
+ # A UUID, a MAQL reference such as {metric/net_sales}, or a snake_case identifier.
93
+ _IDS = re.compile(
94
+ r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|\{\w+/[^}]*\}|\b[a-z0-9]+(?:_[a-z0-9]+)+\b",
95
+ re.IGNORECASE,
96
+ )
97
+
98
+
99
+ def _limit_on(value: Any) -> bool:
100
+ return value is not None and value is not False
101
+
102
+
103
+ class CatalogMetadataEvaluator:
104
+ test_kind = "catalog_metadata"
105
+
106
+ def __init__(self):
107
+ self._positive_judge = LLMJudge(evaluation_steps=_POSITIVE_STEPS)
108
+ self._violation_judge = LLMJudge(evaluation_steps=_VIOLATION_STEPS)
109
+
110
+ @staticmethod
111
+ def validate(item: DatasetItem) -> None:
112
+ """Reject an item this evaluator cannot read, before any request.
113
+
114
+ Raises:
115
+ ValueError: No `catalog_input`, `format` is not an object or has an unknown key,
116
+ or a criteria key is not a JSON array.
117
+ """
118
+ if item.catalog_input is None:
119
+ raise ValueError(f"catalog_metadata item '{item.id}' is missing required 'catalog_input'")
120
+ expected = item.expected_output if isinstance(item.expected_output, dict) else {}
121
+ overrides = expected.get("format") or {}
122
+ if not isinstance(overrides, dict):
123
+ raise ValueError(f"catalog_metadata item '{item.id}': format must be a JSON object")
124
+ known = _DEFAULT_FORMAT[item.catalog_input.output]
125
+ unknown = sorted(set(overrides) - set(known))
126
+ if unknown:
127
+ raise ValueError(
128
+ f"catalog_metadata item '{item.id}': unknown format key(s) {unknown}; known: {sorted(known)}"
129
+ )
130
+ for key, value in overrides.items():
131
+ is_limit = isinstance(value, int) and not isinstance(value, bool) and value > 0
132
+ if not (value is None or value is False or (is_limit if key in _LIMITS else value is True)):
133
+ kind = "a positive integer" if key in _LIMITS else "true"
134
+ raise ValueError(f"catalog_metadata item '{item.id}': format.{key} must be {kind}, false or null")
135
+ for key in ("must_include", "must_not_include", "rubric"):
136
+ if not isinstance(expected.get(key, []), list):
137
+ raise ValueError(f"catalog_metadata item '{item.id}': {key} must be a JSON array")
138
+
139
+ def evaluate(self, item: DatasetItem, chat_result: ChatResult) -> ItemEvaluation:
140
+ self.validate(item)
141
+ assert item.catalog_input is not None # validate() guarantees it
142
+ output = item.catalog_input.output
143
+ expected: dict[str, Any] = item.expected_output if isinstance(item.expected_output, dict) else {}
144
+ raw = chat_result.raw_response or {}
145
+ text = (chat_result.text_response or "").strip()
146
+ note = raw.get("note") or ""
147
+ detail: dict[str, Any] = {
148
+ "actual_output": text,
149
+ "note": note,
150
+ "unusable_retries": raw.get("unusable_retries", 0),
151
+ }
152
+
153
+ if expected.get("expect_note") is True:
154
+ ok = not text and bool(note.strip())
155
+ detail["declined_with_note"] = ok
156
+ return ItemEvaluation(passed=ok, rank_key=(int(ok), float(ok)), detail=detail)
157
+
158
+ detail["generated"] = bool(text)
159
+ detail["no_note"] = not note.strip()
160
+ if text:
161
+ detail.update(self._format_checks(output, expected, text))
162
+ passed = all(v for v in detail.values() if isinstance(v, bool))
163
+ if not text:
164
+ return ItemEvaluation(passed=False, rank_key=(0, 0.0), detail=detail)
165
+
166
+ must_include: list[Criterion] = [
167
+ (f"include_{i}", str(c)) for i, c in enumerate(expected.get("must_include", []))
168
+ ]
169
+ must_not_include: list[Criterion] = [
170
+ (f"exclude_{i}", str(c)) for i, c in enumerate(expected.get("must_not_include", []))
171
+ ]
172
+ rubric: list[Criterion] = [(f"rubric_{i}", str(c)) for i, c in enumerate(expected.get("rubric", []))]
173
+ return grade_rubric(
174
+ self._positive_judge,
175
+ self._violation_judge,
176
+ question=item.question,
177
+ actual=text,
178
+ must_include=must_include,
179
+ must_not_include=must_not_include,
180
+ rubric=rubric,
181
+ detail=detail,
182
+ passed=passed,
183
+ )
184
+
185
+ @staticmethod
186
+ def _format_checks(output: str, expected: dict[str, Any], text: str) -> dict[str, Any]:
187
+ """Deterministic checks keyed by name, plus `word_count`."""
188
+ fmt = {**_DEFAULT_FORMAT[output], **(expected.get("format") or {})}
189
+ checks: dict[str, Any] = {"word_count": count_words(text)}
190
+ if _limit_on(fmt["max_words"]):
191
+ checks["max_words"] = checks["word_count"] <= fmt["max_words"]
192
+ if _limit_on(fmt["max_sentences"]):
193
+ checks["max_sentences"] = count_sentences(text, _ABBREVIATIONS) <= fmt["max_sentences"]
194
+ if fmt["no_end_period"]:
195
+ checks["no_end_period"] = not text.endswith(".")
196
+ if fmt["no_markup"]:
197
+ checks["no_markup"] = not _MARKUP.search(text)
198
+ if fmt["no_ids"]:
199
+ checks["no_ids"] = not _IDS.search(text)
200
+ return checks
@@ -30,6 +30,7 @@ from typing import Any
30
30
 
31
31
  from gooddata_eval.core.evaluators._llm_judge import LLMJudge
32
32
  from gooddata_eval.core.evaluators._rubric import Criterion, grade_rubric
33
+ from gooddata_eval.core.evaluators._text_utils import count_sentences, count_words
33
34
  from gooddata_eval.core.evaluators.base import ItemEvaluation
34
35
  from gooddata_eval.core.models import ChatResult, DatasetItem
35
36
 
@@ -45,12 +46,16 @@ DEFAULT_MUST_NOT_INCLUDE: dict[str, str] = {
45
46
  "'Key takeaways' or 'Things to watch', or lists several separate findings one after another, "
46
47
  "or gives recommendations, an outlook or a closing conclusion."
47
48
  ),
48
- "chart_walkthrough": "Walks through the charts one by one instead of stating one finding that connects them.",
49
+ "chart_walkthrough": (
50
+ "Walks through two or more charts one by one instead of stating one finding that connects them."
51
+ ),
49
52
  "background_opener": "Opens with background or a description of the page instead of the finding itself.",
50
53
  "exact_figure": (
51
54
  "States a figure in digits: an amount, count, percentage or share, including rounded or hedged ones "
52
- "such as 'about $270M', 'roughly 1.2K', 'in the low $100Ks' or '~40%'. A rough size or direction in words, such as "
53
- "'roughly doubled', 'about a third' or 'most orders', does not count. Numbers that are part of a "
55
+ "such as 'about $270M', 'roughly 1.2K', 'in the low $100Ks' or '~40%'. Only digits count: a size, "
56
+ "range or direction written in words, in any language, does not count, even when hedged, such as "
57
+ "'roughly doubled', 'about a third', 'nearly nine-tenths', 'roughly a million', 'the low teens', "
58
+ "'a six- to seven-figure range', 'most orders' or 'etwa eine Million'. Numbers that are part of a "
54
59
  "visualization or metric title, such as 'Top 10', do not count."
55
60
  ),
56
61
  "date_or_period": (
@@ -61,7 +66,7 @@ DEFAULT_MUST_NOT_INCLUDE: dict[str, str] = {
61
66
  "Makes an explicit causal claim (such as 'because', 'due to' or 'driven by') that attributes a change "
62
67
  "to a factor that is not in the data, such as a campaign, a season or a market event. Comparisons "
63
68
  "between segments, and naming the segment in the data that led a change (such as 'led by the "
64
- "Nordics'), are not causal claims."
69
+ "Nordics' or 'driven by new customers'), are not causal claims."
65
70
  ),
66
71
  "chart_description": "Describes what a chart displays instead of what the data means.",
67
72
  }
@@ -93,9 +98,6 @@ _VIOLATION_STEPS = [
93
98
  ]
94
99
 
95
100
  _HEADLINE = re.compile(r"^\s*\*\*(.+?)\*\*", re.DOTALL)
96
- # A terminator, any closing quotes or brackets, then whitespace before the next sentence.
97
- _SENTENCE_BREAK = re.compile(r"[.!?]+[\"'”’»)\]]*\s+(?=\S)")
98
- _SENTENCE_OPENERS = "\"'“‘„«(["
99
101
  _ABBREVIATIONS = frozenset({"vs", "e.g", "i.e", "u.s", "cca", "např", "tj", "tzn", "apod", "resp", "atd"})
100
102
  _BLANK_LINE = re.compile(r"\n\s*\n")
101
103
  _HEADING_LINE = re.compile(r"^\s*#{1,6}\s", re.MULTILINE)
@@ -111,7 +113,7 @@ _META_OPENER = re.compile(
111
113
 
112
114
 
113
115
  def _words(text: str) -> int:
114
- return sum(1 for token in text.replace("**", " ").split() if any(ch.isalnum() for ch in token))
116
+ return count_words(text)
115
117
 
116
118
 
117
119
  def _limit_on(value: Any) -> bool:
@@ -119,22 +121,8 @@ def _limit_on(value: Any) -> bool:
119
121
 
120
122
 
121
123
  def _sentences(text: str) -> int:
122
- """Sentences in `text`; a break needs the next sentence to open with a capital, digit or quote.
123
-
124
- That keeps "vs. last", "U.S. sales" or "např. v" from splitting one sentence in two; a
125
- terminator right after a known abbreviation ("vs. Europe", "e.g. Nordics") is no break.
126
- """
127
- plain = text.replace("**", "").strip()
128
- if not plain:
129
- return 0
130
- breaks = 0
131
- for match in _SENTENCE_BREAK.finditer(plain):
132
- nxt = plain[match.end()]
133
- token = (plain[: match.start()].rsplit(maxsplit=1) or [""])[-1].lstrip("\"'“‘„«([").lower()
134
- if token in _ABBREVIATIONS:
135
- continue
136
- breaks += nxt.isupper() or nxt.isdigit() or nxt in _SENTENCE_OPENERS
137
- return breaks + 1
124
+ """Sentences in `text`, with the takeaway's abbreviations ("vs. Europe", "e.g. Nordics")."""
125
+ return count_sentences(text, _ABBREVIATIONS)
138
126
 
139
127
 
140
128
  def _has_meta_opener(text: str, headline: str | None, body: str) -> bool:
@@ -7,7 +7,7 @@ Ported from gdc-nas tavern-e2e app/llm_as_judge/schemas/chat.py.
7
7
  import json
8
8
  import re
9
9
  from enum import Enum
10
- from typing import Any
10
+ from typing import Any, Literal
11
11
 
12
12
  from pydantic import BaseModel, ConfigDict, Field, SerializerFunctionWrapHandler, field_validator, model_serializer
13
13
 
@@ -564,6 +564,21 @@ class TakeawayInput(BaseModel):
564
564
  agent_id: str | None = None
565
565
 
566
566
 
567
+ class CatalogInput(BaseModel):
568
+ """Structured input for the `catalog_metadata` test kind.
569
+
570
+ Names one Analytics Catalog object and which text to generate for it: `title` calls
571
+ `generateTitle`, `description` calls `generateDescription`. Unknown keys are rejected
572
+ so a typo in a dataset item fails loudly.
573
+ """
574
+
575
+ model_config = ConfigDict(extra="forbid")
576
+
577
+ object_type: Literal["Visualization", "Dashboard", "Metric", "Fact", "Attribute"]
578
+ object_id: str = Field(min_length=1)
579
+ output: Literal["title", "description"]
580
+
581
+
567
582
  class DatasetItem(BaseModel):
568
583
  """Common dataset envelope. `expected_output` stays raw; each evaluator parses its own shape."""
569
584
 
@@ -578,6 +593,8 @@ class DatasetItem(BaseModel):
578
593
  summary_input: SummaryInput | None = None
579
594
  # Only used by the `document_takeaway` test kind; ignored by all others.
580
595
  takeaway_input: TakeawayInput | None = None
596
+ # Only used by the `catalog_metadata` test kind; ignored by all others.
597
+ catalog_input: CatalogInput | None = None
581
598
  # Relayed verbatim as the chat request's `userContext`. Deliberately opaque: gen-ai owns
582
599
  # that schema (a discriminated union of view/widget descriptors), so re-modelling it here
583
600
  # would only create a second copy to keep in sync.
@@ -17,9 +17,11 @@ from typing import Any
17
17
 
18
18
  import httpx
19
19
 
20
- from gooddata_eval.core._retry import RETRYABLE_STATUS_CODES, retry_transient
20
+ from gooddata_eval.core._retry import is_retryable_request_error, is_transient, retry_transient
21
21
  from gooddata_eval.core.models import ChatResult, DatasetItem, TakeawayInput, TakeawayVisualization
22
22
 
23
+ __all__ = ["TakeawayClient", "is_transient"]
24
+
23
25
  _PATH = "/api/v1/ai/workspaces/{workspace_id}/takeaway"
24
26
 
25
27
 
@@ -29,29 +31,6 @@ def _visualization_body(visualization: str | TakeawayVisualization) -> str | dic
29
31
  return {"visualizationId": visualization.visualization_id, "filters": visualization.filters}
30
32
 
31
33
 
32
- # Failures that say nothing about the request. A read timeout is left out: the page was
33
- # being computed, and retrying spends the whole timeout again on every attempt.
34
- _RETRYABLE_TRANSPORT_ERRORS = (httpx.ConnectError, httpx.ConnectTimeout, httpx.RemoteProtocolError, httpx.PoolTimeout)
35
-
36
-
37
- def _is_retryable(exc: Exception) -> bool:
38
- if isinstance(exc, httpx.HTTPStatusError):
39
- return exc.response.status_code in RETRYABLE_STATUS_CODES
40
- return isinstance(exc, _RETRYABLE_TRANSPORT_ERRORS)
41
-
42
-
43
- def is_transient(exc: httpx.HTTPError) -> bool:
44
- """Whether a failure left after the client's retries says nothing about the request.
45
-
46
- 429, 5xx and transport failures (a read timeout included) are transient; any other 4xx
47
- (flag off, no agent, invalid body) and an unsupported URL scheme are setup problems.
48
- """
49
- if isinstance(exc, httpx.HTTPStatusError):
50
- status = exc.response.status_code
51
- return status == 429 or status >= 500
52
- return isinstance(exc, httpx.TransportError) and not isinstance(exc, httpx.UnsupportedProtocol)
53
-
54
-
55
34
  def _request_body(ti: TakeawayInput) -> dict[str, Any]:
56
35
  body: dict[str, Any] = {}
57
36
  if ti.agent_id is not None:
@@ -116,7 +95,7 @@ class TakeawayClient:
116
95
  )
117
96
  return resp
118
97
 
119
- data = retry_transient(_post, is_retryable=_is_retryable).json()
98
+ data = retry_transient(_post, is_retryable=is_retryable_request_error).json()
120
99
  return ChatResult(text_response=data.get("takeaway") or "", raw_response=data)
121
100
 
122
101
  def close(self) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: gooddata-eval
3
- Version: 1.80.1.dev3
3
+ Version: 1.80.1.dev4
4
4
  Summary: Evaluate the GoodData AI agent against your own questions and models.
5
5
  Project-URL: Source, https://github.com/gooddata/gooddata-python-sdk
6
6
  Author-email: GoodData <support@gooddata.com>
@@ -18,7 +18,7 @@ Classifier: Topic :: Scientific/Engineering
18
18
  Classifier: Topic :: Software Development
19
19
  Classifier: Typing :: Typed
20
20
  Requires-Python: >=3.11
21
- Requires-Dist: gooddata-sdk~=1.80.1.dev3
21
+ Requires-Dist: gooddata-sdk~=1.80.1.dev4
22
22
  Requires-Dist: httpx<1.0,>=0.27
23
23
  Requires-Dist: jsonpatch<2.0,>=1.33
24
24
  Requires-Dist: orjson<4.0.0,>=3.9.15
@@ -162,8 +162,8 @@ gd-eval run \
162
162
  | `--runs K` | `2` | Independent runs per item. |
163
163
  | `--gate` | `any` | Which verdict decides an item: `any` = pass@K (a run passing is enough), `power` = pass^K (every run must pass, so the verdict measures stability). Identical at `--runs 1`. Kinds that repeat K runs only — `power` is refused when the dataset also has non-agentic items or `agentic_conversation`, which are always decided on pass@K. |
164
164
  | `--concurrency K` | `1` | Number of items evaluated concurrently. `1` = sequential (default). Increase to load-test the agent under simultaneous requests — see *Concurrency and workspace safety* below. |
165
- | `--judge-model MODEL` | `gpt-4o` | Model used for LLM-as-judge scoring — `agentic_general_question`, `agentic_guardrail`, `general_question`, `guardrail`, `dashboard_summary` and `document_takeaway`. Also settable via `GD_EVAL_JUDGE_MODEL`. Two things to weigh before changing it: the gpt-5 family rejects `temperature=0`, so verdicts stop being reproducible (the run warns when this happens); and choosing the same model the agent runs means the judge grades its own family's output. |
166
- | `--reasoning-effort LEVEL` | server default | `LOW`, `MEDIUM` or `HIGH`, sent as `options.reasoningEffort` on every chat message. Requires the `enableGenAiReasoningEffort` feature flag on the target organization — without it the server ignores the value. Applies to chat items only; `dashboard_summary` and `document_takeaway` items go through their own endpoints, which have no such option. |
165
+ | `--judge-model MODEL` | `gpt-4o` | Model used for LLM-as-judge scoring — `agentic_general_question`, `agentic_guardrail`, `general_question`, `guardrail`, `dashboard_summary`, `document_takeaway` and `catalog_metadata`. Also settable via `GD_EVAL_JUDGE_MODEL`. Two things to weigh before changing it: the gpt-5 family rejects `temperature=0`, so verdicts stop being reproducible (the run warns when this happens); and choosing the same model the agent runs means the judge grades its own family's output. |
166
+ | `--reasoning-effort LEVEL` | server default | `LOW`, `MEDIUM` or `HIGH`, sent as `options.reasoningEffort` on every chat message. Requires the `enableGenAiReasoningEffort` feature flag on the target organization — without it the server ignores the value. Applies to chat items only; `dashboard_summary`, `document_takeaway` and `catalog_metadata` items go through their own endpoints, which have no such option. |
167
167
 
168
168
  **Concurrency and workspace safety.** Agentic kinds that create workspace objects
169
169
  (`agentic_metric_skill`, `agentic_alert_skill`, `agentic_conversation`, `agentic_kda_skill`) always run one at a
@@ -738,7 +738,8 @@ A dataset is a folder of `.json` files, one per question:
738
738
  ```
739
739
 
740
740
  Supported `test_kind` values: `visualization`, `metric_skill`, `alert_skill`,
741
- `search_tool`, `general_question`, `guardrail`, `dashboard_summary`, `document_takeaway`.
741
+ `search_tool`, `general_question`, `guardrail`, `dashboard_summary`, `document_takeaway`,
742
+ `catalog_metadata`.
742
743
 
743
744
  ### `visualization` items
744
745
 
@@ -885,7 +886,8 @@ an item carrying `takeaway_input` is a `document_takeaway` item unless it declar
885
886
 
886
887
  `word_count` and `headline_word_count` are reported in the item detail. The default judge
887
888
  criteria are calibrated with `make calibrate-takeaway` (needs `OPENAI_API_KEY`); re-run it
888
- after changing their wording.
889
+ after changing their wording. The judge reads the item's `input` as the page label, and the
890
+ label can change a verdict, so describe the page and the request in plain words.
889
891
 
890
892
  The client retries 429/5xx answers and connection failures. A request error that survives
891
893
  the retries is handled differently by the two entry points: `gd-eval run` aborts the item
@@ -895,6 +897,51 @@ and raises only when no run completed. A read timeout is not retried, and the CI
895
897
  point records it as an errored run too. Any other 4xx and an unsupported URL scheme are
896
898
  never retried and fail the item in both.
897
899
 
900
+ ### `catalog_metadata` items
901
+
902
+ Catalog items call the Analytics Catalog generate endpoints
903
+ (`POST /api/v1/actions/workspaces/{ws}/ai/analyticsCatalog/generateTitle` or
904
+ `/generateDescription`) for one object, named by a `catalog_input` block. In a Langfuse
905
+ dataset the block goes in the item's `metadata` or its `input` object (`input` wins); a
906
+ value that is not an object fails the item. An item carrying
907
+ `catalog_input` is a `catalog_metadata` item unless it declares another `test_kind`. The
908
+ judge reads the item's `question` as the ground truth, so state the object's real metadata
909
+ there in plain words (what a metric computes, which filters a visualization has).
910
+
911
+ ```json
912
+ {
913
+ "id": "catalog-001",
914
+ "dataset_name": "analytics_catalog_generate",
915
+ "test_kind": "catalog_metadata",
916
+ "question": "Description for the metric '# of Single Orders'. Its MAQL counts customers who placed exactly one order.",
917
+ "catalog_input": {"object_type": "Metric", "object_id": "of_orders_1", "output": "description"},
918
+ "expected_output": {
919
+ "must_include": ["Says that it counts customers who placed exactly one order."],
920
+ "must_not_include": ["Says the metric counts orders rather than customers."],
921
+ "rubric": []
922
+ }
923
+ }
924
+ ```
925
+
926
+ `object_type` is one of `Visualization`, `Dashboard`, `Metric`, `Fact`, `Attribute`;
927
+ `output` is `title` or `description`; unknown keys are rejected. Every `expected_output`
928
+ key is optional:
929
+
930
+ - `expect_note` — `true` for an object the endpoint must decline: the item passes on no
931
+ text plus a non-empty `note`, and nothing else is graded.
932
+ - `format` — overrides of the deterministic checks, which gate pass/fail: `max_words`
933
+ (title 10, description 80), `max_sentences` (title 1, description 4), `no_end_period`
934
+ (title), `no_markup`, `no_ids`. `false` or `null` switches a check off; unknown keys are
935
+ rejected. A generated text (`generated`) and an empty `note` (`no_note`) always apply.
936
+ - `must_include`, `must_not_include`, `rubric` — judge criteria, graded like
937
+ `dashboard_summary`. Criteria may name the object's metadata; the judge sees no data.
938
+
939
+ A 200 answer with no usable text (a null value without a note, or the placeholder
940
+ `"string"`) is asked again once; `unusable_retries` in the item detail records it, with
941
+ `word_count`. The judge steps are calibrated with `make calibrate-catalog-metadata` (needs
942
+ `OPENAI_API_KEY`); re-run it after changing them. Request errors are handled as for
943
+ `document_takeaway`; the CI entry point is `evaluate_catalog_metadata`.
944
+
898
945
  ### Items asked in a dashboard context (`user_context`)
899
946
 
900
947
  An item can be asked the way a user asks from an open dashboard or an attached widget.
@@ -995,6 +1042,7 @@ from that turn on until another turn changes it, as the attached context does in
995
1042
  | `guardrail` | Refusal/redirect (visualization response auto-fails) | `[llm-judge]` |
996
1043
  | `dashboard_summary` | Dashboard summary (via `/summary` endpoint) scored against a rubric by LLM | `[llm-judge]` |
997
1044
  | `document_takeaway` | One short takeaway for a page (via `/takeaway` endpoint): deterministic format checks plus a rubric scored by LLM | `[llm-judge]` |
1045
+ | `catalog_metadata` | Analytics Catalog title or description for one object (via the `analyticsCatalog/generate*` endpoints): format checks plus a rubric scored by LLM | `[llm-judge]` |
998
1046
 
999
1047
  ## Optional extras
1000
1048
 
@@ -2,15 +2,15 @@ gooddata_eval/__init__.py,sha256=9Nz0iJXzkJWiL40PijM6AMpAqQOH-dbYNfDtDysBPYc,186
2
2
  gooddata_eval/_version.py,sha256=L4nT6RJQ2vc_F9stvO59xZv92xsRUqbpUh1sGlb-UNU,195
3
3
  gooddata_eval/cli/__init__.py,sha256=U54lANKm34yjqm7dZL9KkGouPbwAaQWC9wiAmb5B5g4,32
4
4
  gooddata_eval/cli/agentic_runner.py,sha256=Os6Ljt4yKAia0DlL54osEwxhHfz_Jr6_uB-gyzwnClY,32053
5
- gooddata_eval/cli/main.py,sha256=OJQWOyOWaHbxTRz_9nu-cAIzotTahhysjEYBd_PhnQU,34468
5
+ gooddata_eval/cli/main.py,sha256=_SEw16H2Hc772K-TB9tZyZKUlL_k695KM--aYitaIa8,34790
6
6
  gooddata_eval/core/__init__.py,sha256=U54lANKm34yjqm7dZL9KkGouPbwAaQWC9wiAmb5B5g4,32
7
7
  gooddata_eval/core/_output.py,sha256=sFbNtKg1lx431jpb15jISLlOXGTZ-r_KodfaTVyka6I,580
8
- gooddata_eval/core/_retry.py,sha256=86ZPWu6ahCYC2GLvcbwjHTtj2RrGPOuxIFlCbtmNpvw,2990
8
+ gooddata_eval/core/_retry.py,sha256=H2jZLGYbD72hUXI4S0KDQzcg93h3iz76D2A7mjXGKvI,4245
9
9
  gooddata_eval/core/config.py,sha256=hla5t294uHC5Q9bzrhPjsdkwEcetLsEH-GqGAhs94b4,4823
10
10
  gooddata_eval/core/connection.py,sha256=mh-Do5-Ti0-DXXikfCIH10eTTUbKuZUAS_sLoPNDJ5I,1229
11
11
  gooddata_eval/core/granularity.py,sha256=CbniwgxtVj0oyf41UjeeZbBzOpeisSBlAfdkL79e6O0,3932
12
12
  gooddata_eval/core/interaction.py,sha256=lyGAhUj2bywAP5O8QCWZRi2AZMc5WyvNRx-hqm9mm5E,2161
13
- gooddata_eval/core/models.py,sha256=SySTp6BwKjTh39lcuNDU7K6xCQ_l7S3-R22HOv70B2g,28160
13
+ gooddata_eval/core/models.py,sha256=zeCq3CPlwBJK6Zmgu05mPUF0cfTL0bSb4Nl1HYo9LBQ,28838
14
14
  gooddata_eval/core/number_format.py,sha256=bQv3YqlMtBHNSMZx2_qGMWXFDdeXNkAGVg3WFIKUd-k,9264
15
15
  gooddata_eval/core/outcome.py,sha256=Ax9uAgxUlKSATWd_xFp959jijVhsNoH0oSmRyOnXsWA,6509
16
16
  gooddata_eval/core/runner.py,sha256=IrMOVFUd-WkcYLhYiQYeEzZjacYKnjao3GBm6JGtisQ,21605
@@ -44,28 +44,32 @@ gooddata_eval/core/agentic/report_skill.py,sha256=ZpuKuQpor56ywDKauzQKAx18vFHcW6
44
44
  gooddata_eval/core/agentic/search_tool.py,sha256=ceWVrNihNbEBNnQEu7IE-d0E-Lp0weYY4pUPgjZDnkc,15066
45
45
  gooddata_eval/core/agentic/visualization.py,sha256=JATOgLGNhNlenLYf15d5z2GX1RtotDQm3O8uez8Av44,38438
46
46
  gooddata_eval/core/agentic/what_if.py,sha256=AA3DJOrtezRLnUxzq48olwSgDQN6Qfwqfbx5XnsQhrA,28746
47
+ gooddata_eval/core/catalog/__init__.py,sha256=U54lANKm34yjqm7dZL9KkGouPbwAaQWC9wiAmb5B5g4,32
48
+ gooddata_eval/core/catalog/evaluate.py,sha256=Uf4ABvlIY0ks5OKTUpJsoFKHBai390cPidzFZIro_ZE,11373
49
+ gooddata_eval/core/catalog/http_client.py,sha256=OsT6tvSVXirSRkwKGGikJpAE1zETQO7V5KBLzvOm800,4439
47
50
  gooddata_eval/core/chat/__init__.py,sha256=U54lANKm34yjqm7dZL9KkGouPbwAaQWC9wiAmb5B5g4,32
48
51
  gooddata_eval/core/chat/render.py,sha256=wfA5opgrWt-H9L-H8hJm1zBR0kIEqvFros8gtG1_yXo,2116
49
52
  gooddata_eval/core/chat/sse_client.py,sha256=43RVL8W1_7oJRdyjPBQQO8UUHm92Q-nJxBdZ0Kh3d2g,34760
50
53
  gooddata_eval/core/dataset/__init__.py,sha256=U54lANKm34yjqm7dZL9KkGouPbwAaQWC9wiAmb5B5g4,32
51
54
  gooddata_eval/core/dataset/from_insights.py,sha256=v4Ev_WZHFzRFnGBzEyDppe-JvKW1I-WQwVHMHXXJ6wU,41212
52
- gooddata_eval/core/dataset/langfuse_source.py,sha256=II-6fenEPhdyfckrL0iVdJpavjv67wUvy7OIuvHntrg,8697
55
+ gooddata_eval/core/dataset/langfuse_source.py,sha256=FEBWOaIiD-tutlr7ttiTXrvJsohXqfU05r3Hj-RiySc,9806
53
56
  gooddata_eval/core/dataset/local.py,sha256=qoFFtRx_bNwlT1U37o8CKkSPwCad3JpmHPcNRuGSbjE,1233
54
- gooddata_eval/core/evaluators/__init__.py,sha256=QJYfQdlc5cGYPj4Y_BBETuqGyP54G7FbkkokjXJAqUs,3291
57
+ gooddata_eval/core/evaluators/__init__.py,sha256=F3SSLO9_QeIlYdL3vJJ4qjhL3gV9b81EjQePQQHOmJk,3453
55
58
  gooddata_eval/core/evaluators/_deep_subset.py,sha256=TonPUfkUZL4q1a9t3cczDC2vSF54ynEDDQRxP6p-fvc,1407
56
59
  gooddata_eval/core/evaluators/_guardrail_criteria.py,sha256=OEAFKXjHIl03oER7UDSodcQoXJ5WxaUp_Rknxauhwrk,2532
57
60
  gooddata_eval/core/evaluators/_llm_judge.py,sha256=A5lukKt8IG26BoN_oU2DvkOHAQwV0b4U86tiNn1oXwE,15962
58
61
  gooddata_eval/core/evaluators/_maql.py,sha256=XpamaPXixBTpiMGrZYnV0t_4DEmuPSa32PqQOk0RG_k,4348
59
62
  gooddata_eval/core/evaluators/_rubric.py,sha256=hHBsE52M2E2JaRuN07Vs1ST0nVaq44kft5QqgoaO3-g,4248
60
- gooddata_eval/core/evaluators/_text_utils.py,sha256=wY7lx5buV5dBC_a7L5K2IE7GU-XXWqfDsT3WKQ_8jY4,388
63
+ gooddata_eval/core/evaluators/_text_utils.py,sha256=GWGJB6uJFhwZTiy4QcthXd2z_GtUdh5p6gZqHVnfBo4,1816
61
64
  gooddata_eval/core/evaluators/alert_skill.py,sha256=I5Zgo972JR6WhqYeDZ8ttncBr8tehlklFQhukqPdy8M,6203
62
65
  gooddata_eval/core/evaluators/base.py,sha256=H9EMG57jX0W4vmasgJNUhwRjtGRuVBik2MhN9ZDV1Jk,777
66
+ gooddata_eval/core/evaluators/catalog_metadata.py,sha256=knj_7N_nEznHHnJMnBVYsNGMqA4GYQLmfGnQHUkIg9Y,8868
63
67
  gooddata_eval/core/evaluators/general_question.py,sha256=3YIuCH7t_Ih6Of8hozRUHd6Vaum2X3KxhKFCjzthLHg,2170
64
68
  gooddata_eval/core/evaluators/guardrail.py,sha256=J3sX0v_ImbV-GC3c_vMtQrn9Sn0sy-zH5B-Bdc_8TXI,3157
65
69
  gooddata_eval/core/evaluators/metric_skill.py,sha256=ckQvo-TX_bwGWcTkxaHMztMcg7lYBegH5uFOK4wfNSo,3005
66
70
  gooddata_eval/core/evaluators/search_tool.py,sha256=c6iK_tHMaDaUjYuo5EnAYDGe53gTDTQtUl226hZq0JY,3070
67
71
  gooddata_eval/core/evaluators/summary.py,sha256=h3Z3Zu5cwc9TVLMa7Q6yUwLjPpFtOEGSHyRgyuYukNc,4258
68
- gooddata_eval/core/evaluators/takeaway.py,sha256=QdBu9p4y7c6hPVLe3c1vg7ftjH0nyZikCvSAPjqx__Y,11766
72
+ gooddata_eval/core/evaluators/takeaway.py,sha256=mdWuC6tJkypJZFTgFi74d5oz4cmeC1DxftM5qD-Fn5A,11248
69
73
  gooddata_eval/core/evaluators/visualization.py,sha256=eC575w1MgV9_gpeBCsX3w1twiydmxQsVO8INFZWzeuU,40465
70
74
  gooddata_eval/core/langfuse/__init__.py,sha256=U54lANKm34yjqm7dZL9KkGouPbwAaQWC9wiAmb5B5g4,32
71
75
  gooddata_eval/core/langfuse/_env.py,sha256=amkX9h4bgktVJSyx9pLiSxKdBgWXYa61V4cvvLq3qUY,2838
@@ -84,9 +88,9 @@ gooddata_eval/core/summary/__init__.py,sha256=U54lANKm34yjqm7dZL9KkGouPbwAaQWC9w
84
88
  gooddata_eval/core/summary/http_client.py,sha256=Umae42fiiJQ0e4hv63NRROHYvcFAGgX5K5QEQY3F95c,2583
85
89
  gooddata_eval/core/takeaway/__init__.py,sha256=U54lANKm34yjqm7dZL9KkGouPbwAaQWC9wiAmb5B5g4,32
86
90
  gooddata_eval/core/takeaway/evaluate.py,sha256=AjS_rCHWUSJKv0jfEfL0-dVPoDaf3RkGdmeZiIwjd6A,11312
87
- gooddata_eval/core/takeaway/http_client.py,sha256=BAgi-pX6zrUUlWFbNm5xpVyP2MCw_XyAotjSBL9adFs,4944
88
- gooddata_eval-1.80.1.dev3.dist-info/METADATA,sha256=tQl_6TW2he0T3iNXc7Gq4F-PES0YcYtJcmX-FexGZxQ,63174
89
- gooddata_eval-1.80.1.dev3.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
90
- gooddata_eval-1.80.1.dev3.dist-info/entry_points.txt,sha256=28nFp5Viknx4haPYgzK9QHlwPFfC6rPF6RmjC2ht8EI,56
91
- gooddata_eval-1.80.1.dev3.dist-info/licenses/LICENSE.txt,sha256=LVfVlC9maU3K9lgMwdZnClQQsOIbOekdcdVKr9qzJtk,256836
92
- gooddata_eval-1.80.1.dev3.dist-info/RECORD,,
91
+ gooddata_eval/core/takeaway/http_client.py,sha256=YMfafOcHJ184i49Qoh0ZNPKKTMKBSgeDUM4zk_H3yM8,3955
92
+ gooddata_eval-1.80.1.dev4.dist-info/METADATA,sha256=fogQFnkdFelIKkZFtcRts4xK-XDpV9W1NRm8CSBIAZs,66070
93
+ gooddata_eval-1.80.1.dev4.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
94
+ gooddata_eval-1.80.1.dev4.dist-info/entry_points.txt,sha256=28nFp5Viknx4haPYgzK9QHlwPFfC6rPF6RmjC2ht8EI,56
95
+ gooddata_eval-1.80.1.dev4.dist-info/licenses/LICENSE.txt,sha256=LVfVlC9maU3K9lgMwdZnClQQsOIbOekdcdVKr9qzJtk,256836
96
+ gooddata_eval-1.80.1.dev4.dist-info/RECORD,,