gooddata-eval 1.80.1.dev12__tar.gz → 1.81.1.dev1__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 (197) hide show
  1. gooddata_eval-1.80.1.dev12/README.md → gooddata_eval-1.81.1.dev1/PKG-INFO +82 -0
  2. gooddata_eval-1.80.1.dev12/PKG-INFO → gooddata_eval-1.81.1.dev1/README.md +52 -30
  3. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/pyproject.toml +2 -2
  4. gooddata_eval-1.81.1.dev1/src/gooddata_eval/core/agentic/_kda_expectation.py +365 -0
  5. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/kda_skill.py +116 -29
  6. gooddata_eval-1.81.1.dev1/tests/test_agentic_kda_skill_fields.py +827 -0
  7. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/.gitignore +0 -0
  8. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/AGENTS.md +0 -0
  9. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/CLAUDE.md +0 -0
  10. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/LICENSE.txt +0 -0
  11. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/Makefile +0 -0
  12. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/scripts/calibrate_catalog_metadata_judge.py +0 -0
  13. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/scripts/calibrate_knowledge_judge.py +0 -0
  14. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/scripts/calibrate_takeaway_judge.py +0 -0
  15. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/scripts/verify_guardrail_refusal_criteria.py +0 -0
  16. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/__init__.py +0 -0
  17. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/_version.py +0 -0
  18. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/cli/__init__.py +0 -0
  19. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/cli/agentic_runner.py +0 -0
  20. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/cli/main.py +0 -0
  21. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/__init__.py +0 -0
  22. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/_output.py +0 -0
  23. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/_retry.py +0 -0
  24. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/__init__.py +0 -0
  25. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_alert_update.py +0 -0
  26. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_catalog.py +0 -0
  27. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_clarification.py +0 -0
  28. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_conversation_context.py +0 -0
  29. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_editor_takeaways.py +0 -0
  30. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_failed_runs.py +0 -0
  31. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_failure_message.py +0 -0
  32. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_filters.py +0 -0
  33. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_gate.py +0 -0
  34. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_langfuse.py +0 -0
  35. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_metric_expectation.py +0 -0
  36. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_metric_workspace.py +0 -0
  37. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_outcome.py +0 -0
  38. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_search_expectation.py +0 -0
  39. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/_trace_linker.py +0 -0
  40. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/agent_switcher.py +0 -0
  41. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/alert_skill.py +0 -0
  42. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/anomaly_detection.py +0 -0
  43. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/conversation.py +0 -0
  44. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/dashboard_skill.py +0 -0
  45. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/dashboard_summary.py +0 -0
  46. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/document_skill.py +0 -0
  47. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/forecasting.py +0 -0
  48. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/general_question.py +0 -0
  49. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/guardrail.py +0 -0
  50. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/knowledge.py +0 -0
  51. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/metric_skill.py +0 -0
  52. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/report_skill.py +0 -0
  53. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/search_tool.py +0 -0
  54. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/visualization.py +0 -0
  55. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/agentic/what_if.py +0 -0
  56. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/catalog/__init__.py +0 -0
  57. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/catalog/evaluate.py +0 -0
  58. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/catalog/http_client.py +0 -0
  59. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/chat/__init__.py +0 -0
  60. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/chat/render.py +0 -0
  61. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/chat/sse_client.py +0 -0
  62. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/config.py +0 -0
  63. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/connection.py +0 -0
  64. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/dataset/__init__.py +0 -0
  65. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/dataset/from_insights.py +0 -0
  66. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/dataset/langfuse_source.py +0 -0
  67. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/dataset/local.py +0 -0
  68. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/__init__.py +0 -0
  69. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/_deep_subset.py +0 -0
  70. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/_guardrail_criteria.py +0 -0
  71. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/_llm_judge.py +0 -0
  72. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/_maql.py +0 -0
  73. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/_rubric.py +0 -0
  74. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/_text_utils.py +0 -0
  75. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/alert_skill.py +0 -0
  76. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/base.py +0 -0
  77. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/catalog_metadata.py +0 -0
  78. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/general_question.py +0 -0
  79. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/guardrail.py +0 -0
  80. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/knowledge.py +0 -0
  81. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/metric_skill.py +0 -0
  82. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/search_tool.py +0 -0
  83. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/summary.py +0 -0
  84. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/takeaway.py +0 -0
  85. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/evaluators/visualization.py +0 -0
  86. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/granularity.py +0 -0
  87. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/interaction.py +0 -0
  88. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/langfuse/__init__.py +0 -0
  89. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/langfuse/_env.py +0 -0
  90. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/langfuse/client.py +0 -0
  91. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/langfuse/experiment.py +0 -0
  92. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/langfuse/item_scope.py +0 -0
  93. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/langfuse/observations.py +0 -0
  94. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/langfuse/otlp.py +0 -0
  95. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/langfuse/sink.py +0 -0
  96. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/models.py +0 -0
  97. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/number_format.py +0 -0
  98. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/outcome.py +0 -0
  99. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/reporting/__init__.py +0 -0
  100. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/reporting/console.py +0 -0
  101. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/reporting/html_report.py +0 -0
  102. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/reporting/json_report.py +0 -0
  103. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/reporting/report_template.html +0 -0
  104. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/runner.py +0 -0
  105. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/scoring.py +0 -0
  106. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/summary/__init__.py +0 -0
  107. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/summary/http_client.py +0 -0
  108. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/takeaway/__init__.py +0 -0
  109. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/takeaway/evaluate.py +0 -0
  110. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/takeaway/http_client.py +0 -0
  111. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/timing.py +0 -0
  112. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/src/gooddata_eval/core/workspace.py +0 -0
  113. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/__init__.py +0 -0
  114. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/_fake_langfuse.py +0 -0
  115. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/conftest.py +0 -0
  116. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/fixtures/catalog_metadata_calibration.json +0 -0
  117. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/fixtures/knowledge_calibration.json +0 -0
  118. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/fixtures/sample_dataset/metric_skill_create.json +0 -0
  119. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/fixtures/sample_dataset/visualization_revenue.json +0 -0
  120. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/fixtures/sse_visualization_stream.txt +0 -0
  121. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/fixtures/takeaway_calibration.json +0 -0
  122. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_agent_switcher.py +0 -0
  123. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_alert_skill.py +0 -0
  124. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_alert_skill_checks.py +0 -0
  125. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_alert_update.py +0 -0
  126. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_anomaly_detection.py +0 -0
  127. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_conversation.py +0 -0
  128. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_dashboard_skill.py +0 -0
  129. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_dashboard_summary.py +0 -0
  130. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_document_editor_takeaways.py +0 -0
  131. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_document_skill.py +0 -0
  132. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_failure_message.py +0 -0
  133. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_forecasting.py +0 -0
  134. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_gate.py +0 -0
  135. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_general_question.py +0 -0
  136. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_guardrail.py +0 -0
  137. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_join_trace.py +0 -0
  138. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_kda_skill.py +0 -0
  139. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_knowledge.py +0 -0
  140. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_langfuse_trace.py +0 -0
  141. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_metric_skill.py +0 -0
  142. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_metric_skill_options.py +0 -0
  143. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_observe_experiment.py +0 -0
  144. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_run_context.py +0 -0
  145. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_runner.py +0 -0
  146. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_search_tool.py +0 -0
  147. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_search_tool_checks.py +0 -0
  148. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_visualization.py +0 -0
  149. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_agentic_what_if.py +0 -0
  150. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_alert_skill_evaluator.py +0 -0
  151. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_catalog_metadata_client.py +0 -0
  152. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_catalog_metadata_evaluate.py +0 -0
  153. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_catalog_metadata_evaluator.py +0 -0
  154. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_chat_render.py +0 -0
  155. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_cli.py +0 -0
  156. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_connection.py +0 -0
  157. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_context_date_filter.py +0 -0
  158. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_deep_subset.py +0 -0
  159. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_eval_error_scores.py +0 -0
  160. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_fake_langfuse.py +0 -0
  161. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_from_insights.py +0 -0
  162. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_guardrail_criteria.py +0 -0
  163. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_html_report.py +0 -0
  164. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_interaction.py +0 -0
  165. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_knowledge_evaluator.py +0 -0
  166. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_langfuse_client.py +0 -0
  167. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_langfuse_e2e_fake_server.py +0 -0
  168. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_langfuse_env.py +0 -0
  169. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_langfuse_experiment.py +0 -0
  170. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_langfuse_item_scope.py +0 -0
  171. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_langfuse_observations.py +0 -0
  172. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_langfuse_otlp.py +0 -0
  173. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_langfuse_sink.py +0 -0
  174. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_langfuse_source.py +0 -0
  175. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_llm_judge.py +0 -0
  176. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_local_loader.py +0 -0
  177. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_maql_normalize.py +0 -0
  178. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_metric_skill_evaluator.py +0 -0
  179. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_models.py +0 -0
  180. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_number_format.py +0 -0
  181. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_outcome.py +0 -0
  182. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_reporting.py +0 -0
  183. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_runner.py +0 -0
  184. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_scoring.py +0 -0
  185. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_search_tool_evaluator.py +0 -0
  186. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_sse_client.py +0 -0
  187. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_summary_client.py +0 -0
  188. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_summary_evaluator.py +0 -0
  189. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_takeaway_client.py +0 -0
  190. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_takeaway_evaluate.py +0 -0
  191. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_takeaway_evaluator.py +0 -0
  192. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_text_evaluators.py +0 -0
  193. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_timing.py +0 -0
  194. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_trace_linker.py +0 -0
  195. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_visualization_evaluator.py +0 -0
  196. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tests/test_workspace.py +0 -0
  197. {gooddata_eval-1.80.1.dev12 → gooddata_eval-1.81.1.dev1}/tox.ini +0 -0
@@ -1,3 +1,33 @@
1
+ Metadata-Version: 2.5
2
+ Name: gooddata-eval
3
+ Version: 1.81.1.dev1
4
+ Summary: Evaluate the GoodData AI agent against your own questions and models.
5
+ Project-URL: Source, https://github.com/gooddata/gooddata-python-sdk
6
+ Author-email: GoodData <support@gooddata.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE.txt
9
+ Keywords: ai,analytics,cli,evaluation,gooddata,llm
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: Python :: 3.15
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Classifier: Topic :: Software Development
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: gooddata-sdk~=1.81.1.dev1
22
+ Requires-Dist: httpx<1.0,>=0.27
23
+ Requires-Dist: jsonpatch<2.0,>=1.33
24
+ Requires-Dist: orjson<4.0.0,>=3.9.15
25
+ Requires-Dist: pydantic<3.0,>=2.6
26
+ Requires-Dist: rich<15.0,>=13.0
27
+ Provides-Extra: llm-judge
28
+ Requires-Dist: openai<2.0,>=1.45; extra == 'llm-judge'
29
+ Description-Content-Type: text/markdown
30
+
1
31
  # gooddata-eval
2
32
 
3
33
  CLI to evaluate the GoodData AI agent against a dataset of natural-language
@@ -1099,6 +1129,58 @@ the editors and the generated `description` are not compared) and `alert_not_rec
1099
1129
  (the alert still exists and the agent created none). A failing run reports the update
1100
1130
  arguments and every field that changed unasked.
1101
1131
 
1132
+ ### `agentic_kda_skill` field checks
1133
+
1134
+ A KDA item is scored on completion: `kda_triggered`, `kda_executed`, `kda_success` and
1135
+ `kda_turn_completed`. With `"check_fields": true` the run must also match every field of the
1136
+ `create_key_driver_analysis` call and the summary its execution returns:
1137
+
1138
+ ```json
1139
+ {
1140
+ "question": "What drove the change in Total Sales Amount in Q4 2024 versus Q3 2024, excluding the United States East region?",
1141
+ "expected_output": {
1142
+ "check_fields": true,
1143
+ "Measure": {"id": "total_sales_amount_daily_store", "type": "metric"},
1144
+ "Date Attribute": "transaction_date.quarter",
1145
+ "Analyzed Period": "2024-4",
1146
+ "Reference Period": "2024-3",
1147
+ "Filters": [
1148
+ {"type": "attribute_filter", "using": "label/dim_geography_region.region_name", "state": {"exclude": ["United States East"]}}
1149
+ ],
1150
+ "Summary": {"analyzed_value": 13868253.55, "reference_value": 15142121.31, "change": -1273867.76, "absolute_tolerance": 0.01}
1151
+ }
1152
+ }
1153
+ ```
1154
+
1155
+ | Score | Passes when |
1156
+ |---|---|
1157
+ | `kda_measure_correct` | the measure has the id and type of a `Measure` candidate (one object or a list), and its aggregation when the candidate states one |
1158
+ | `kda_date_attribute_correct` | `date_attribute_id` equals `Date Attribute` |
1159
+ | `kda_analyzed_period_correct`, `kda_reference_period_correct` | the period has the expected parts, numbers compared as numbers (`2024-1` is `2024-01`, `2024-Q3` is not `2024-3`) |
1160
+ | `kda_filters_correct` | the non-date filters equal `Filters` in any order (`[]` for none). Date filters are not compared: the periods set the scope, and a date filter that changes the numbers fails the summary |
1161
+ | `kda_summary_correct` | the execution succeeded and each of `analyzed_value`, `reference_value` and `change` the item states is within `absolute_tolerance` (default 0.01) |
1162
+
1163
+ `any_of` lists complete alternatives for a question two answers fit. Each option replaces some
1164
+ of the fields, and a run passes when one option matches all six. The summary depends on the
1165
+ date attribute, so an option that changes one states both:
1166
+
1167
+ ```json
1168
+ "any_of": [
1169
+ {"Date Attribute": "transaction_date.quarter", "Summary": {"analyzed_value": 184, "reference_value": 163}},
1170
+ {"Date Attribute": "return_date.quarter", "Summary": {"analyzed_value": 191, "reference_value": 156}}
1171
+ ]
1172
+ ```
1173
+
1174
+ A missing field, an unknown key, `check fields` or `any of` spelled with a space or capitals, a
1175
+ measure type or aggregation the tool does not take, an attribute filter without one non-empty
1176
+ `include` or `exclude` list of strings, a date filter in `Filters` or `any_of` without
1177
+ `check_fields` is rejected before any request. The execute call is paired with the create whose
1178
+ `kda_ref` it names; an execute naming a ref no create of the turn returned is not counted, and a
1179
+ create the tool rejected after an analysis ran does not replace it. `filters` that are not a list
1180
+ fail `kda_filters_correct`; omitted ones are no filters. The six names are `KDA_FIELD_SCORES`; a run that never called
1181
+ create publishes none of them. A failing run reports the expected and the actual value of each
1182
+ field it failed.
1183
+
1102
1184
  ### Items asked in a dashboard context (`user_context`)
1103
1185
 
1104
1186
  An item can be asked the way a user asks from an open dashboard or an attached widget.
@@ -1,33 +1,3 @@
1
- Metadata-Version: 2.5
2
- Name: gooddata-eval
3
- Version: 1.80.1.dev12
4
- Summary: Evaluate the GoodData AI agent against your own questions and models.
5
- Project-URL: Source, https://github.com/gooddata/gooddata-python-sdk
6
- Author-email: GoodData <support@gooddata.com>
7
- License-Expression: MIT
8
- License-File: LICENSE.txt
9
- Keywords: ai,analytics,cli,evaluation,gooddata,llm
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Environment :: Console
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
15
- Classifier: Programming Language :: Python :: 3.14
16
- Classifier: Programming Language :: Python :: 3.15
17
- Classifier: Topic :: Scientific/Engineering
18
- Classifier: Topic :: Software Development
19
- Classifier: Typing :: Typed
20
- Requires-Python: >=3.11
21
- Requires-Dist: gooddata-sdk~=1.80.1.dev12
22
- Requires-Dist: httpx<1.0,>=0.27
23
- Requires-Dist: jsonpatch<2.0,>=1.33
24
- Requires-Dist: orjson<4.0.0,>=3.9.15
25
- Requires-Dist: pydantic<3.0,>=2.6
26
- Requires-Dist: rich<15.0,>=13.0
27
- Provides-Extra: llm-judge
28
- Requires-Dist: openai<2.0,>=1.45; extra == 'llm-judge'
29
- Description-Content-Type: text/markdown
30
-
31
1
  # gooddata-eval
32
2
 
33
3
  CLI to evaluate the GoodData AI agent against a dataset of natural-language
@@ -1129,6 +1099,58 @@ the editors and the generated `description` are not compared) and `alert_not_rec
1129
1099
  (the alert still exists and the agent created none). A failing run reports the update
1130
1100
  arguments and every field that changed unasked.
1131
1101
 
1102
+ ### `agentic_kda_skill` field checks
1103
+
1104
+ A KDA item is scored on completion: `kda_triggered`, `kda_executed`, `kda_success` and
1105
+ `kda_turn_completed`. With `"check_fields": true` the run must also match every field of the
1106
+ `create_key_driver_analysis` call and the summary its execution returns:
1107
+
1108
+ ```json
1109
+ {
1110
+ "question": "What drove the change in Total Sales Amount in Q4 2024 versus Q3 2024, excluding the United States East region?",
1111
+ "expected_output": {
1112
+ "check_fields": true,
1113
+ "Measure": {"id": "total_sales_amount_daily_store", "type": "metric"},
1114
+ "Date Attribute": "transaction_date.quarter",
1115
+ "Analyzed Period": "2024-4",
1116
+ "Reference Period": "2024-3",
1117
+ "Filters": [
1118
+ {"type": "attribute_filter", "using": "label/dim_geography_region.region_name", "state": {"exclude": ["United States East"]}}
1119
+ ],
1120
+ "Summary": {"analyzed_value": 13868253.55, "reference_value": 15142121.31, "change": -1273867.76, "absolute_tolerance": 0.01}
1121
+ }
1122
+ }
1123
+ ```
1124
+
1125
+ | Score | Passes when |
1126
+ |---|---|
1127
+ | `kda_measure_correct` | the measure has the id and type of a `Measure` candidate (one object or a list), and its aggregation when the candidate states one |
1128
+ | `kda_date_attribute_correct` | `date_attribute_id` equals `Date Attribute` |
1129
+ | `kda_analyzed_period_correct`, `kda_reference_period_correct` | the period has the expected parts, numbers compared as numbers (`2024-1` is `2024-01`, `2024-Q3` is not `2024-3`) |
1130
+ | `kda_filters_correct` | the non-date filters equal `Filters` in any order (`[]` for none). Date filters are not compared: the periods set the scope, and a date filter that changes the numbers fails the summary |
1131
+ | `kda_summary_correct` | the execution succeeded and each of `analyzed_value`, `reference_value` and `change` the item states is within `absolute_tolerance` (default 0.01) |
1132
+
1133
+ `any_of` lists complete alternatives for a question two answers fit. Each option replaces some
1134
+ of the fields, and a run passes when one option matches all six. The summary depends on the
1135
+ date attribute, so an option that changes one states both:
1136
+
1137
+ ```json
1138
+ "any_of": [
1139
+ {"Date Attribute": "transaction_date.quarter", "Summary": {"analyzed_value": 184, "reference_value": 163}},
1140
+ {"Date Attribute": "return_date.quarter", "Summary": {"analyzed_value": 191, "reference_value": 156}}
1141
+ ]
1142
+ ```
1143
+
1144
+ A missing field, an unknown key, `check fields` or `any of` spelled with a space or capitals, a
1145
+ measure type or aggregation the tool does not take, an attribute filter without one non-empty
1146
+ `include` or `exclude` list of strings, a date filter in `Filters` or `any_of` without
1147
+ `check_fields` is rejected before any request. The execute call is paired with the create whose
1148
+ `kda_ref` it names; an execute naming a ref no create of the turn returned is not counted, and a
1149
+ create the tool rejected after an analysis ran does not replace it. `filters` that are not a list
1150
+ fail `kda_filters_correct`; omitted ones are no filters. The six names are `KDA_FIELD_SCORES`; a run that never called
1151
+ create publishes none of them. A failing run reports the expected and the actual value of each
1152
+ field it failed.
1153
+
1132
1154
  ### Items asked in a dashboard context (`user_context`)
1133
1155
 
1134
1156
  An item can be asked the way a user asks from an open dashboard or an attached widget.
@@ -1,7 +1,7 @@
1
1
  # (C) 2026 GoodData Corporation
2
2
  [project]
3
3
  name = "gooddata-eval"
4
- version = "1.80.1.dev12"
4
+ version = "1.81.1.dev1"
5
5
  description = "Evaluate the GoodData AI agent against your own questions and models."
6
6
  readme = "README.md"
7
7
  license = "MIT"
@@ -11,7 +11,7 @@ authors = [
11
11
  keywords = ["gooddata", "ai", "evaluation", "llm", "analytics", "cli"]
12
12
  requires-python = ">=3.11"
13
13
  dependencies = [
14
- "gooddata-sdk~=1.80.1.dev12",
14
+ "gooddata-sdk~=1.81.1.dev1",
15
15
  "httpx>=0.27,<1.0",
16
16
  "jsonpatch>=1.33,<2.0",
17
17
  "orjson>=3.9.15,<4.0.0",
@@ -0,0 +1,365 @@
1
+ # (C) 2026 GoodData Corporation. All rights reserved.
2
+ """The KDA item's field checks: what ``create_key_driver_analysis`` and its execution must match.
3
+
4
+ An item opts in with ``check_fields: true``. Its expected output then names the measure, the date
5
+ attribute, both periods, the non-date filters and the summary the execution must return. Without
6
+ the key, nothing here runs and the item is scored on completion only.
7
+
8
+ ``any_of`` lists complete alternatives. Each option replaces some fields of the item, and a run
9
+ passes when one option matches every field. The summary goes with the date attribute, so an
10
+ option that changes one usually states both.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import json
16
+ import math
17
+ import re
18
+ from collections.abc import Mapping
19
+ from dataclasses import dataclass
20
+ from decimal import Decimal
21
+ from typing import Any
22
+
23
+ # The fields in the order they are checked and published. Score ``kda_<field>_correct`` each.
24
+ KDA_FIELDS = ("measure", "date_attribute", "analyzed_period", "reference_period", "filters", "summary")
25
+ KDA_FIELD_SCORES = tuple(f"kda_{name}_correct" for name in KDA_FIELDS)
26
+
27
+ _FIELD_KEYS = {
28
+ "measure": "Measure",
29
+ "date_attribute": "Date Attribute",
30
+ "analyzed_period": "Analyzed Period",
31
+ "reference_period": "Reference Period",
32
+ "filters": "Filters",
33
+ "summary": "Summary",
34
+ }
35
+ _OPTION_KEYS = frozenset(_FIELD_KEYS.values())
36
+ _ITEM_KEYS = _OPTION_KEYS | {"check_fields", "any_of"}
37
+ _SUMMARY_VALUES = ("analyzed_value", "reference_value", "change")
38
+ _SUMMARY_KEYS = frozenset({*_SUMMARY_VALUES, "absolute_tolerance"})
39
+ _DEFAULT_TOLERANCE = 0.01
40
+ _MEASURE_KEYS = frozenset({"id", "type", "aggregation"})
41
+ # The values create_key_driver_analysis accepts. It upper-cases the aggregation itself.
42
+ _MEASURE_TYPES = ("metric", "fact", "attribute")
43
+ _AGGREGATIONS = ("SUM", "AVG", "MIN", "MAX", "MEDIAN", "COUNT")
44
+ _FILTER_STATES = ("include", "exclude")
45
+ # Spelled like the item's other keys, these would leave the checks off without a word.
46
+ _OPT_IN_KEYS = ("check_fields", "any_of")
47
+ _DATE_FILTER = "date_filter"
48
+ # The agent's tools take an attribute by its label or its attribute id. Both ids are equal in the
49
+ # eval workspaces, so a filter is matched on the id alone.
50
+ _TYPE_PREFIXES = ("label/", "attribute/")
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class KdaFieldOption:
55
+ """One complete set of expected fields."""
56
+
57
+ measures: tuple[dict[str, Any], ...]
58
+ date_attribute: str
59
+ analyzed_period: str
60
+ reference_period: str
61
+ filters: tuple[Any, ...]
62
+ filter_entries: tuple[dict[str, Any], ...]
63
+ summary: dict[str, float]
64
+ tolerance: float
65
+
66
+
67
+ @dataclass(frozen=True)
68
+ class KdaExpectation:
69
+ """The item's field checks. ``options`` is empty when the item does not opt in."""
70
+
71
+ options: tuple[KdaFieldOption, ...] = ()
72
+
73
+ @property
74
+ def check_fields(self) -> bool:
75
+ return bool(self.options)
76
+
77
+
78
+ @dataclass(frozen=True)
79
+ class KdaFieldResult:
80
+ """The fields of one run, checked against the option that matched most of them."""
81
+
82
+ checks: dict[str, bool]
83
+ option_index: int
84
+ expected: dict[str, Any]
85
+ actual: dict[str, Any]
86
+
87
+ @property
88
+ def passed(self) -> bool:
89
+ return all(self.checks.values())
90
+
91
+
92
+ def _to_float(value: Any) -> float | None:
93
+ """A finite number from an int, float or numeric string, else None. A bool is not a number."""
94
+ if isinstance(value, bool) or value is None:
95
+ return None
96
+ try:
97
+ number = float(str(value))
98
+ except ValueError:
99
+ return None
100
+ return number if math.isfinite(number) else None
101
+
102
+
103
+ def _measures(value: Any) -> tuple[dict[str, Any], ...]:
104
+ candidates = value if isinstance(value, list) else [value]
105
+ if not candidates:
106
+ raise ValueError("Measure must name at least one candidate")
107
+ for candidate in candidates:
108
+ if not isinstance(candidate, dict) or not isinstance(candidate.get("id"), str) or not candidate["id"]:
109
+ raise ValueError(f"Measure candidate needs a non-empty string id, got {candidate!r}")
110
+ if candidate.get("type") not in _MEASURE_TYPES:
111
+ raise ValueError(f"Measure candidate type must be one of {', '.join(_MEASURE_TYPES)}, got {candidate!r}")
112
+ aggregation = candidate.get("aggregation")
113
+ if aggregation is not None and str(aggregation).upper() not in _AGGREGATIONS:
114
+ raise ValueError(f"Measure aggregation must be one of {', '.join(_AGGREGATIONS)}, got {candidate!r}")
115
+ if unknown := set(candidate) - _MEASURE_KEYS:
116
+ raise ValueError(f"Measure candidate has unknown keys {sorted(unknown)}, got {candidate!r}")
117
+ return tuple(candidates)
118
+
119
+
120
+ def _text(key: str, value: Any, *, allow_int: bool = False) -> str:
121
+ # A year period may be an int ("Analyzed Period": 2024); a date attribute id never is, and a bool is neither.
122
+ allowed = (str, int) if allow_int else str
123
+ if isinstance(value, bool) or not isinstance(value, allowed) or not str(value).strip():
124
+ raise ValueError(f"{key} must be a non-empty string, got {value!r}")
125
+ return str(value).strip()
126
+
127
+
128
+ def _period_key(value: Any) -> tuple[int | str, ...]:
129
+ """A period by its parts, numbers as numbers: the tool reads ``2024-1`` and ``2024-01`` as one month."""
130
+ return tuple(int(part) if part.isdigit() else part for part in re.split(r"[-\s:]+", str(value).strip()))
131
+
132
+
133
+ def _check_attribute_filter(entry: dict[str, Any]) -> None:
134
+ using, state = entry.get("using"), entry.get("state")
135
+ if not isinstance(using, str) or not using.strip():
136
+ raise ValueError(f"attribute_filter needs a non-empty using, got {entry!r}")
137
+ if not isinstance(state, dict) or len(state) != 1 or next(iter(state)) not in _FILTER_STATES:
138
+ raise ValueError(f"attribute_filter state needs exactly one of include, exclude, got {entry!r}")
139
+ values = next(iter(state.values()))
140
+ if not isinstance(values, list) or not values or not all(isinstance(v, str) for v in values):
141
+ raise ValueError(f"attribute_filter {next(iter(state))} must be a non-empty list of strings, got {entry!r}")
142
+
143
+
144
+ def _filters(value: Any) -> tuple[Any, ...]:
145
+ if not isinstance(value, list):
146
+ raise ValueError(f"Filters must be a list, [] for none, got {value!r}")
147
+ for entry in value:
148
+ if not isinstance(entry, dict):
149
+ raise ValueError(f"Filters must hold objects, got {entry!r}")
150
+ if entry.get("type") == _DATE_FILTER:
151
+ raise ValueError("Filters must not hold a date_filter: date filters are not checked, the periods are")
152
+ if entry.get("type") == "attribute_filter":
153
+ _check_attribute_filter(entry)
154
+ return tuple(_filter_key(entry) for entry in value)
155
+
156
+
157
+ def _summary(value: Any) -> tuple[dict[str, float], float]:
158
+ if not isinstance(value, dict):
159
+ raise ValueError(f"Summary must be an object, got {value!r}")
160
+ if unknown := set(value) - _SUMMARY_KEYS:
161
+ raise ValueError(f"Summary has unknown keys {sorted(unknown)}")
162
+ numbers: dict[str, float] = {}
163
+ for key in _SUMMARY_VALUES:
164
+ if key in value:
165
+ number = _to_float(value[key])
166
+ if number is None:
167
+ raise ValueError(f"Summary {key} must be a number, got {value[key]!r}")
168
+ numbers[key] = number
169
+ if not numbers:
170
+ raise ValueError(f"Summary must state at least one of {', '.join(_SUMMARY_VALUES)}")
171
+ tolerance = _to_float(value.get("absolute_tolerance", _DEFAULT_TOLERANCE))
172
+ if tolerance is None or tolerance < 0:
173
+ raise ValueError(f"Summary absolute_tolerance must be a number >= 0, got {value.get('absolute_tolerance')!r}")
174
+ return numbers, tolerance
175
+
176
+
177
+ def _option(fields: Mapping[str, Any], label: str) -> KdaFieldOption:
178
+ if missing := [key for key in _FIELD_KEYS.values() if key not in fields]:
179
+ raise ValueError(f"{label} lacks {', '.join(missing)}: check_fields needs every field, Filters [] for none")
180
+ summary, tolerance = _summary(fields["Summary"])
181
+ return KdaFieldOption(
182
+ measures=_measures(fields["Measure"]),
183
+ date_attribute=_text("Date Attribute", fields["Date Attribute"]),
184
+ analyzed_period=_text("Analyzed Period", fields["Analyzed Period"], allow_int=True),
185
+ reference_period=_text("Reference Period", fields["Reference Period"], allow_int=True),
186
+ filters=_filters(fields["Filters"]),
187
+ filter_entries=tuple(fields["Filters"]),
188
+ summary=summary,
189
+ tolerance=tolerance,
190
+ )
191
+
192
+
193
+ def _reject_respelt_keys(expected: dict[str, Any]) -> None:
194
+ for key in expected:
195
+ canonical = re.sub(r"[\s-]+", "_", key.strip()).lower() if isinstance(key, str) else key
196
+ if canonical in _OPT_IN_KEYS and key != canonical:
197
+ raise ValueError(f"write {canonical!r}, not {key!r}")
198
+
199
+
200
+ def parse_kda_expectation(expected: Any) -> KdaExpectation:
201
+ """Read the item's field checks, raising ValueError on a malformed one before any request is sent."""
202
+ if isinstance(expected, dict):
203
+ _reject_respelt_keys(expected)
204
+ if not isinstance(expected, dict) or "check_fields" not in expected:
205
+ if isinstance(expected, dict) and "any_of" in expected:
206
+ raise ValueError("any_of is read only with check_fields: true")
207
+ return KdaExpectation()
208
+ flag = expected["check_fields"]
209
+ if not isinstance(flag, bool):
210
+ raise ValueError(f"check_fields must be true or false, got {flag!r}")
211
+ if not flag:
212
+ if "any_of" in expected:
213
+ raise ValueError("any_of is read only with check_fields: true")
214
+ return KdaExpectation()
215
+ if unknown := set(expected) - _ITEM_KEYS:
216
+ raise ValueError(f"expected_output has unknown keys {sorted(unknown)}")
217
+ base = {key: value for key, value in expected.items() if key in _OPTION_KEYS}
218
+ if "any_of" not in expected:
219
+ return KdaExpectation(options=(_option(base, "expected_output"),))
220
+ options = expected["any_of"]
221
+ if not isinstance(options, list) or len(options) < 2 or not all(isinstance(o, dict) and o for o in options):
222
+ raise ValueError(f"any_of must list at least two non-empty objects, got {options!r}")
223
+ parsed: list[KdaFieldOption] = []
224
+ for index, option in enumerate(options):
225
+ if unknown := set(option) - _OPTION_KEYS:
226
+ raise ValueError(
227
+ f"any_of[{index}] has keys {sorted(unknown)}; an option may state only {sorted(_OPTION_KEYS)}"
228
+ )
229
+ parsed.append(_option({**base, **option}, f"any_of[{index}]"))
230
+ return KdaExpectation(options=tuple(parsed))
231
+
232
+
233
+ def _bare_id(using: Any) -> Any:
234
+ if isinstance(using, str):
235
+ for prefix in _TYPE_PREFIXES:
236
+ if using.startswith(prefix):
237
+ return using[len(prefix) :]
238
+ return using
239
+
240
+
241
+ def _filter_key(entry: dict[str, Any]) -> Any:
242
+ """A comparable form of one filter: an attribute filter by its id and values, any other as its JSON."""
243
+ state = entry.get("state")
244
+ if (
245
+ entry.get("type") == "attribute_filter"
246
+ and isinstance(state, dict)
247
+ and set(state) <= set(_FILTER_STATES)
248
+ and all(isinstance(values, list) and all(isinstance(v, str) for v in values) for values in state.values())
249
+ ):
250
+ return (
251
+ "attribute_filter",
252
+ _bare_id(entry.get("using")),
253
+ tuple(sorted(state.get("include") or [])),
254
+ tuple(sorted(state.get("exclude") or [])),
255
+ )
256
+ return json.dumps(entry, sort_keys=True, default=str)
257
+
258
+
259
+ def _measure_matches(candidate: dict[str, Any], actual: Any) -> bool:
260
+ if not isinstance(actual, dict):
261
+ return False
262
+ if candidate["id"] != actual.get("id") or candidate["type"] != actual.get("type"):
263
+ return False
264
+ expected_aggregation = candidate.get("aggregation")
265
+ if expected_aggregation is None:
266
+ return True
267
+ return str(expected_aggregation).upper() == str(actual.get("aggregation") or "").upper()
268
+
269
+
270
+ def _actual_summary(execute_result: Any) -> dict | None:
271
+ if not isinstance(execute_result, dict) or execute_result.get("success") is not True:
272
+ return None
273
+ data = execute_result.get("data")
274
+ summary = data.get("summary") if isinstance(data, dict) else None
275
+ return summary if isinstance(summary, dict) else None
276
+
277
+
278
+ def _within(actual: float, expected: float, tolerance: float) -> bool:
279
+ # In decimal, so 100.01 against 100 is a difference of exactly 0.01, not 0.010000000000005116.
280
+ return abs(Decimal(repr(actual)) - Decimal(repr(expected))) <= Decimal(repr(tolerance))
281
+
282
+
283
+ def _summary_matches(option: KdaFieldOption, actual: dict | None) -> bool:
284
+ if actual is None:
285
+ return False
286
+ for key, expected in option.summary.items():
287
+ number = _to_float(actual.get(key))
288
+ if number is None or not _within(number, expected, option.tolerance):
289
+ return False
290
+ return True
291
+
292
+
293
+ def _non_date_filters(filters: Any) -> list[Any]:
294
+ entries = filters if isinstance(filters, list) else []
295
+ return [entry for entry in entries if not (isinstance(entry, dict) and entry.get("type") == _DATE_FILTER)]
296
+
297
+
298
+ def _actual_filters(create_args: dict) -> Any:
299
+ """The non-date filters the agent sent, or the malformed value itself so a failed check shows it."""
300
+ filters = create_args.get("filters", [])
301
+ return _non_date_filters(filters) if isinstance(filters, list) else filters
302
+
303
+
304
+ def _check_option(option: KdaFieldOption, create_args: dict, summary: dict | None) -> dict[str, bool]:
305
+ filters = create_args.get("filters", [])
306
+ # Omitted filters are no filters. Anything but a list, null included, is malformed: the tool takes a list.
307
+ filters_shaped = isinstance(filters, list)
308
+ actual_filters = sorted(
309
+ (_filter_key(f) if isinstance(f, dict) else repr(f) for f in _non_date_filters(filters)),
310
+ key=repr,
311
+ )
312
+ return {
313
+ "measure": any(_measure_matches(c, create_args.get("measure")) for c in option.measures),
314
+ "date_attribute": str(create_args.get("date_attribute_id") or "").strip() == option.date_attribute,
315
+ "analyzed_period": _period_key(create_args.get("analyzed_period") or "") == _period_key(option.analyzed_period),
316
+ "reference_period": _period_key(create_args.get("reference_period") or "")
317
+ == _period_key(option.reference_period),
318
+ "filters": filters_shaped and actual_filters == sorted(option.filters, key=repr),
319
+ "summary": _summary_matches(option, summary),
320
+ }
321
+
322
+
323
+ def _expected_view(option: KdaFieldOption) -> dict[str, Any]:
324
+ return {
325
+ "measure": list(option.measures) if len(option.measures) > 1 else option.measures[0],
326
+ "date_attribute": option.date_attribute,
327
+ "analyzed_period": option.analyzed_period,
328
+ "reference_period": option.reference_period,
329
+ "filters": list(option.filter_entries),
330
+ "summary": {**option.summary, "absolute_tolerance": option.tolerance},
331
+ }
332
+
333
+
334
+ def check_kda_fields(spec: KdaExpectation, create_args: Any, execute_result: Any) -> KdaFieldResult | None:
335
+ """The run's field checks against the option that matched most fields, the first one on a tie.
336
+
337
+ None when the item does not opt in or the run never called create: there was nothing to check, and
338
+ the completion checks already fail that run. Arguments that are not an object fail every field.
339
+ """
340
+ if not spec.check_fields or create_args is None:
341
+ return None
342
+ summary = _actual_summary(execute_result)
343
+ if not isinstance(create_args, dict):
344
+ return KdaFieldResult(
345
+ checks=dict.fromkeys(KDA_FIELDS, False),
346
+ option_index=0,
347
+ expected=_expected_view(spec.options[0]),
348
+ actual=dict.fromkeys(KDA_FIELDS) | {"summary": summary},
349
+ )
350
+ results = [_check_option(option, create_args, summary) for option in spec.options]
351
+ best = max(range(len(results)), key=lambda i: sum(results[i].values()))
352
+ actual = {
353
+ "measure": create_args.get("measure"),
354
+ "date_attribute": create_args.get("date_attribute_id"),
355
+ "analyzed_period": create_args.get("analyzed_period"),
356
+ "reference_period": create_args.get("reference_period"),
357
+ "filters": _actual_filters(create_args),
358
+ "summary": summary,
359
+ }
360
+ return KdaFieldResult(
361
+ checks=results[best],
362
+ option_index=best,
363
+ expected=_expected_view(spec.options[best]),
364
+ actual=actual,
365
+ )