Skip to content

Conversation

@arin-deloatch
Copy link
Contributor

@arin-deloatch arin-deloatch commented Jan 15, 2026

Description

Add all configuration information to the JSON and TXT file.
Add metric level metadata to CSV file.

Type of change

  • Refactor
  • [☑️] New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Unit tests improvement

Tools used to create PR

Assisted-by: Claude
Generated by: Claude-4.5-sonnet

Related Tickets & Documents

Related Issue: RSPEED-2121
Closes: LEADS-182

Checklist before requesting a review

  • [☑️] I have performed a self-review of my code.
  • [☑️] PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

test_generator.py and test_evaluator.py were updated to support new additions to the codebase.

Output Examples

leads-182-json-example.json
leads-182-metrics-metadata-example.csv
leads-182-txt-example.txt

Summary by CodeRabbit

  • New Features

    • CSV output now includes per-row metrics metadata for richer evaluation details (applies to successful and error rows).
    • Summary reports (JSON and text) now include a configurable "Configuration" section; default summary sections include llm, embedding, and api.
  • Documentation

    • Configuration docs updated to show the new CSV column and summary section options.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

Walkthrough

Adds a new CSV column metrics_metadata (carried on EvaluationResult), extracts metric metadata during evaluation, and makes output summaries include configurable summary_config_sections serialized into JSON/text.

Changes

Cohort / File(s) Summary
Config & Constants
config/system.yaml, src/lightspeed_evaluation/core/constants.py
Added metrics_metadata to CSV output columns and added summary_config_sections to output config defaults.
Data & System Models
src/lightspeed_evaluation/core/models/data.py, src/lightspeed_evaluation/core/models/system.py
EvaluationResult gains metrics_metadata: Optional[str]. OutputConfig gains summary_config_sections: list[str] (default includes llm, embedding, api).
Output Generation
src/lightspeed_evaluation/core/output/generator.py
Added helpers to select/serialize/config-format sections (_get_included_config_sections, _convert_config_to_dict, _format_config_section, _write_config_params, _build_config_dict) and included configuration in JSON/text summaries.
Evaluation Pipeline
src/lightspeed_evaluation/pipeline/evaluation/evaluator.py
Added _extract_metadata_for_csv and populate metrics_metadata on both success and error EvaluationResults (filters out threshold and metric_identifier).
Tests
tests/unit/core/output/test_generator.py, tests/unit/pipeline/evaluation/test_evaluator.py
Updated mocks to provide iterable model_fields.keys() and stubbed get_metric_metadata to avoid iteration errors in new code paths.
Docs
docs/configuration.md
Documented metrics_metadata in output CSV columns and metrics section.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Client as Client
participant Evaluator as MetricsEvaluator
participant MM as MetricManager
participant Result as EvaluationResult
participant Output as OutputHandler
participant CSV as CSV Writer

Client->>Evaluator: submit EvaluationRequest
Evaluator->>MM: get_metric_metadata(metric_identifier, level, context)
MM-->>Evaluator: metadata dict
Evaluator->>Result: create EvaluationResult(..., metrics_metadata=JSON)
Evaluator-->>Client: return EvaluationResult
Client->>Output: request write summary / csv
Output->>Result: read metrics_metadata
Output->>CSV: write row including metrics_metadata

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • asamal4
  • VladimirKadlec
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding evaluation config data to reports (JSON and TXT outputs) and metrics metadata to CSV output.
Docstring Coverage ✅ Passed Docstring coverage is 95.24% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@VladimirKadlec VladimirKadlec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thank you. Please add this to the documentation.
Other than that LGTM.

Copy link
Collaborator

@asamal4 asamal4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.. LGTM. one nit..

FYI.. Also we will have to refactor metadata mapping to simplify the logic (to remove additional logic in evaluator.py). But not part of this story or PR.

if self.system_config is not None and hasattr(self.system_config, "output"):
if hasattr(self.system_config.output, "summary_config_sections"):
return self.system_config.output.summary_config_sections
# Default sections if not configured (see system.py:220)
Copy link
Collaborator

@asamal4 asamal4 Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove code line number, that may get change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact remove complete comment itself and use a constant; that will be self-explanatory.

arin-deloatch and others added 6 commits January 16, 2026 08:16
Mock system_config and metric_manager now properly support iteration
operations to prevent TypeError when production code iterates over
model_fields.keys() or metadata.items().

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
"result",
"score",
"threshold",
"metrics_metadata",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename the column name

Suggested change
"metrics_metadata",
"metric_metadata",

Co-authored-by: Asutosh Samal <asamal@redhat.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/lightspeed_evaluation/core/models/system.py`:
- Around line 219-222: Add the missing DEFAULT_STORED_CONFIGS constant to
src/lightspeed_evaluation/core/constants.py (define DEFAULT_STORED_CONFIGS =
["llm", "embedding", "api"], e.g., placed after SUPPORTED_OUTPUT_TYPES) and then
import DEFAULT_STORED_CONFIGS into
src/lightspeed_evaluation/core/models/system.py so the Field default for
summary_config_sections uses that constant; ensure the import statement includes
DEFAULT_STORED_CONFIGS and no other changes to the Field definition in the
System model.

Comment on lines +219 to +222
summary_config_sections: list[str] = Field(
default=DEFAULT_STORED_CONFIGS,
description="Configuration sections to include in summary reports",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for DEFAULT_STORED_CONFIGS definition in the constants module
rg -n "DEFAULT_STORED_CONFIGS" --type py

Repository: lightspeed-core/lightspeed-evaluation

Length of output: 172


🏁 Script executed:

#!/bin/bash
# Check the import block in system.py
sed -n '8,37p' src/lightspeed_evaluation/core/models/system.py

echo "---"

# Check what constants are defined in the constants module
rg -n "^DEFAULT_" src/lightspeed_evaluation/core/constants.py | head -30

Repository: lightspeed-core/lightspeed-evaluation

Length of output: 1954


🏁 Script executed:

#!/bin/bash
# Search specifically for DEFAULT_STORED_CONFIGS in the constants module
rg -n "DEFAULT_STORED_CONFIGS" src/lightspeed_evaluation/core/constants.py

echo "---"

# Also check if it might be defined with a different name
rg -n "STORED_CONFIGS|stored.*config" src/lightspeed_evaluation/core/constants.py -i

Repository: lightspeed-core/lightspeed-evaluation

Length of output: 84


🏁 Script executed:

#!/bin/bash
# Read the actual lines 219-222 with context
sed -n '210,230p' src/lightspeed_evaluation/core/models/system.py

echo "---"

# Check the class definition to understand context better
sed -n '200,240p' src/lightspeed_evaluation/core/models/system.py

Repository: lightspeed-core/lightspeed-evaluation

Length of output: 2315


🏁 Script executed:

#!/bin/bash
# Search for any config-related constants in the entire codebase
rg -n "config.*sections|stored.*config" src/lightspeed_evaluation/core/constants.py -i

echo "---"

# Check if there's a SUPPORTED_* constant that might be appropriate
rg -n "SUPPORTED_" src/lightspeed_evaluation/core/constants.py

Repository: lightspeed-core/lightspeed-evaluation

Length of output: 411


🏁 Script executed:

#!/bin/bash
# Check if DEFAULT_STORED_CONFIGS might be defined elsewhere in the codebase
rg -rn "DEFAULT_STORED_CONFIGS\s*=" src/lightspeed_evaluation/

echo "---"

# Let's also check the entire constants file length to see how much we might have missed
wc -l src/lightspeed_evaluation/core/constants.py

echo "---"

# Search the entire constants file for any mention
cat src/lightspeed_evaluation/core/constants.py | grep -i "stored\|config"

Repository: lightspeed-core/lightspeed-evaluation

Length of output: 136


🏁 Script executed:

#!/bin/bash
# Let's read the entire constants file to see what's available
cat src/lightspeed_evaluation/core/constants.py

echo "---"

# Also check if there are any comments or documentation about config sections
rg -n "config.*section|summary.*config" src/lightspeed_evaluation/ -i -A 2 -B 2

Repository: lightspeed-core/lightspeed-evaluation

Length of output: 7764


Define DEFAULT_STORED_CONFIGS constant before importing it.

The constant DEFAULT_STORED_CONFIGS is used as the default value at line 220 but does not exist in lightspeed_evaluation.core.constants. The correct default should be ["llm", "embedding", "api"] (as documented in src/lightspeed_evaluation/core/output/generator.py:472-473).

Add the constant definition to src/lightspeed_evaluation/core/constants.py, then import it in system.py:

🔧 Proposed fix: Define and import `DEFAULT_STORED_CONFIGS`
  1. Add to src/lightspeed_evaluation/core/constants.py (around line 77, after SUPPORTED_OUTPUT_TYPES):
 SUPPORTED_OUTPUT_TYPES = ["csv", "json", "txt"]
+DEFAULT_STORED_CONFIGS = ["llm", "embedding", "api"]
 SUPPORTED_CSV_COLUMNS = [
  1. Add to import statement in src/lightspeed_evaluation/core/models/system.py (lines 8-37):
 from lightspeed_evaluation.core.constants import (
     DEFAULT_API_BASE,
     DEFAULT_API_CACHE_DIR,
     DEFAULT_API_TIMEOUT,
     DEFAULT_API_VERSION,
     DEFAULT_BASE_FILENAME,
     DEFAULT_EMBEDDING_CACHE_DIR,
     DEFAULT_EMBEDDING_MODEL,
     DEFAULT_EMBEDDING_PROVIDER,
     DEFAULT_ENDPOINT_TYPE,
     DEFAULT_LLM_CACHE_DIR,
     DEFAULT_LLM_MAX_TOKENS,
     DEFAULT_LLM_MODEL,
     DEFAULT_LLM_PROVIDER,
     DEFAULT_SSL_VERIFY,
     DEFAULT_SSL_CERT_FILE,
     DEFAULT_LLM_RETRIES,
     DEFAULT_LLM_TEMPERATURE,
     DEFAULT_LOG_FORMAT,
     DEFAULT_LOG_PACKAGE_LEVEL,
     DEFAULT_LOG_SHOW_TIMESTAMPS,
     DEFAULT_LOG_SOURCE_LEVEL,
     DEFAULT_OUTPUT_DIR,
+    DEFAULT_STORED_CONFIGS,
     DEFAULT_VISUALIZATION_DPI,
     DEFAULT_VISUALIZATION_FIGSIZE,
     SUPPORTED_CSV_COLUMNS,
     SUPPORTED_ENDPOINT_TYPES,
     SUPPORTED_GRAPH_TYPES,
     SUPPORTED_OUTPUT_TYPES,
 )
🧰 Tools
🪛 GitHub Actions: Pyright

[error] 220-220: pyright: 'DEFAULT_STORED_CONFIGS' is not defined. (reportUndefinedVariable). Command failed: make pyright

🪛 GitHub Actions: Python linter

[error] 220-220: pylint: Undefined variable 'DEFAULT_STORED_CONFIGS'.

🪛 GitHub Actions: Ruff

[error] 220-220: F821 Undefined name 'DEFAULT_STORED_CONFIGS' (ruff: Undefined name).

🪛 GitHub Actions: Type checks

[error] 220-220: Mypy error: Name 'DEFAULT_STORED_CONFIGS' is not defined. [name-defined]

🤖 Prompt for AI Agents
In `@src/lightspeed_evaluation/core/models/system.py` around lines 219 - 222, Add
the missing DEFAULT_STORED_CONFIGS constant to
src/lightspeed_evaluation/core/constants.py (define DEFAULT_STORED_CONFIGS =
["llm", "embedding", "api"], e.g., placed after SUPPORTED_OUTPUT_TYPES) and then
import DEFAULT_STORED_CONFIGS into
src/lightspeed_evaluation/core/models/system.py so the Field default for
summary_config_sections uses that constant; ensure the import statement includes
DEFAULT_STORED_CONFIGS and no other changes to the Field definition in the
System model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants