Skip to content

Feature/rag evaluation - #1243

Draft
kbakande wants to merge 19 commits into
devfrom
feature/rag-evaluation
Draft

Feature/rag evaluation#1243
kbakande wants to merge 19 commits into
devfrom
feature/rag-evaluation

Conversation

@kbakande

@kbakande kbakande commented Aug 6, 2026

Copy link
Copy Markdown

Context

Assist does not have an existing RAG evaluation pipeline. This change produce a basic framework that is extensible to accomodate further ideas

What

It creates a pipeline that leverage Assist production instances to evaluate the retrieval quality of the application. It will iterate over a number of pdfs in corpus, exract, chunk, embed and index them in a test index within open search. It then iterates ove QA in corpus, to send the question to Assist retriever instance and compute metrics based on retrieved chunks and the corresponding answers in QA.

Have you written unit tests?

  • Yes
  • [ x] No (add why you have not) not yet

Are there any specific instructions on how to test this change?

  • [ ]x Yes (if so provide more detail)
  • No

Instructions are available in the README

Relevant links

try:
s3.delete_object(Bucket=env.bucket_name, Key=key)
except Exception:
pass

@datadog-uktrade datadog-uktrade Bot Aug 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 High: Code Quality Violation

silent exception (...read more)

Using the pass statement in an exception block ignores the exception. Exceptions should never be ignored. Instead, the user must add code to notify an exception occurred and attempt to handle it or recover from it.

The exception to this rule is the use of StopIteration or StopAsyncIteration when implementing a custom iterator (as those errors are used to acknowledge the end of a successful iteration).

Helpful? 👍/👎View in Datadog  Leave us feedback  Documentation
🚩 Report as false positive. Flags the rule for review to improve detection accuracy.

# HTML
# ------------------------------------------------------------------

def _build_html(self, agg: AggregateScores, meta: dict) -> str:

@datadog-uktrade datadog-uktrade Bot Aug 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 High: Code Quality Violation

function exceeds 200 lines (...read more)

This rule stipulates that functions in Python should not exceed 200 lines of code. The primary reason for this rule is to promote readability and maintainability of the code. When functions are concise and focused, they are easier to understand, test, and debug.

Long functions often indicate that a single function is doing too much. Adhering to the Single Responsibility Principle (SRP) can help avoid this. SRP states that a function should have only one reason to change. If a function is doing more than one thing, it can usually be split into several smaller, more specific functions.

In practice, to adhere to this rule, you can often break up long functions into smaller helper functions. If a piece of code within a function is independent and can be isolated, it is a good candidate to be moved into a separate function. This also increases code reusability. For instance, if a function process_data() is too long, you can identify independent tasks within it - such as clean_data(), transform_data(), and save_data() - and create separate functions for them. This makes the code easier to reason about and test, and promotes good coding practices.

Helpful? 👍/👎View in Datadog  Leave us feedback  Documentation
🚩 Report as false positive. Flags the rule for review to improve detection accuracy.

@datadog-uktrade

datadog-uktrade Bot commented Aug 6, 2026

Copy link
Copy Markdown

Code Quality  Code Vulnerabilities  IaC  Library Vulnerabilities  Secrets

⚠️ Warnings

🛠️ 2 Code quality issues detected

High: python-code-style/max-function-lines Functions must be less than 200 lines View rule
redbox/tests/evaluation/metrics/report.py:197
High: python-best-practices/no-silent-exception Do not ignore Exception with a pass statement View rule
redbox/tests/evaluation/run_eval.py:200

ℹ️ Info

No other issues found (see more)

🛡️ No new code vulnerabilities
📚 No new vulnerable libraries detected
🧱 No new Infrastructure as Code (IaC) issues
🔑 No new secrets detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ebedfe0 | Docs | Datadog PR Page | Give us feedback!

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage

@codecov-commenter

codecov-commenter commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.53%. Comparing base (2aa7d2b) to head (ebedfe0).

Files with missing lines Patch % Lines
redbox/redbox/retriever/retrievers.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1243      +/-   ##
==========================================
- Coverage   85.54%   85.53%   -0.02%     
==========================================
  Files         231      231              
  Lines       10406    10409       +3     
==========================================
+ Hits         8902     8903       +1     
- Misses       1504     1506       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage

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.

2 participants