Skip to content

Set mock test parameter to save resources - #49

Merged
davidedm26 merged 49 commits into
mainfrom
develop
Mar 4, 2026
Merged

Set mock test parameter to save resources#49
davidedm26 merged 49 commits into
mainfrom
develop

Conversation

@davidedm26

Copy link
Copy Markdown
Owner

No description provided.

davidedm26 and others added 30 commits February 25, 2026 16:55
- Introduce `SubRequirementReport` model in `RequirementReport` to expose article-level audit details.
- Update `evaluate_requirement` to populate sub-requirement results.
- Improve `get_sub_prompt` for stricter and more structured evaluation.
- Improve `get_aggregate_prompt` to generate a summary that explicitly mentions sub-requirement coverage.
- Optimize `_query_qdrant_for_requirement` to use cleaned query text (removing law names) for better retrieval precision.

Co-authored-by: davidedm26 <[email protected]>
- Ensure `Auditor_Notes` in `RequirementReport` is always a string by serializing dict/list outputs from LLM.
- Introduce `SubRequirementReport` model to expose granular audit details.
- Update `evaluate_requirement` to populate `SubRequirements` list.
- Enhance `_query_qdrant_for_requirement` to accept `embedding_model` for re-embedding cleaned queries.
- Refine prompt templates for better structured output.

Co-authored-by: davidedm26 <[email protected]>
- Extract `RetrievalEngine` to `backend/core/retrieval.py` for query cleaning and embedding.
- Extract `EvaluationEngine` to `backend/core/evaluation.py` for prompt management and LLM interaction.
- Update `rag_engine.py` to orchestrate these components.
- Fix Pydantic `ValidationError` by ensuring `Auditor_Notes` is always a string.
- Update `evaluate_rag.py` to use the new modular structure.

Co-authored-by: davidedm26 <[email protected]>
- Explicitly formulate `ragas_question` in `EvaluationEngine` to include regulatory content, improving Answer Relevancy.
- Combine LLM `rationale` and `auditor_notes` as the `answer` for RAGAS evaluation, improving Groundedness and Faithfulness.
- Update `_get_sub_prompt` to force the LLM to use direct quotes from document chunks, grounding its reasoning in the text.

Co-authored-by: davidedm26 <[email protected]>
- Add `main_req_name` to `_get_sub_prompt` for better LLM context.
- Soften prompt instructions to encourage referencing specific text parts rather than strict verbatim quotes, reducing false negatives ("no evidence").
- Simplify `ragas_question` to avoid duplicating the regulatory text already present in the context, improving Answer Relevancy scoring.
- Ensure all caller sites in `rag_engine.py` and `evaluate_rag.py` pass the new arguments correctly.

Co-authored-by: davidedm26 <[email protected]>
- Explicitly pass `auditor_notes` in `sub_results` dict within `rag_engine.py`.
- Update `EvaluationEngine._get_aggregate_prompt` to read the concise `auditor_notes` instead of the verbose `answer` (which includes the full rationale).

Co-authored-by: davidedm26 <[email protected]>
- Remove the verbose `Context` array from the `RequirementReport` Pydantic model to prevent massive JSON bloat in the final output. The structured `SubRequirements` list is retained.
- Update `EvaluationEngine._get_sub_prompt` to include the `source` (e.g., EU AI Act, ISO 42001) alongside the reference, providing the LLM with explicit knowledge of the regulatory framework being evaluated.
- Update `evaluate_rag.py` and `rag_engine.py` to pass the `source` argument.

Co-authored-by: davidedm26 <[email protected]>
- Update `evaluate_single_case` to read data from `SubRequirements` instead of the legacy, removed `Context` field.
- Reconstruct `ragas_question` and `combined_answer` dynamically from the Pydantic properties (`Rationale`, `Auditor_Notes`, `Reference`, `Source`).

Co-authored-by: davidedm26 <[email protected]>
This reverts commit 9ef2c43.
This reverts commit e15d94c.
davidedm26 and others added 17 commits March 2, 2026 11:40
- Removed train-of-thought comments from `backend/rag_engine.py`
- Removed first-person and conversational notes from `evaluation/case_evaluation.py`, `frontend/app.py`, `vectorize_data.py`, and `evaluate_rag.py`
- Reformatted excessively long single-line comments into standard professional docstrings and block comments
- Removed "AI engine" phrasing from frontend UI notes to sound more professional

Co-authored-by: davidedm26 <[email protected]>
Updates the backend API endpoints to properly expose `SubRequirements` by including `SubRequirementReportAPI` in the lightweight response model `RequirementReportAPI`. Modifies the frontend `Audit_Compliance.py` logic to parse the `sub_requirements` and renders them interactively using an `st.expander` toggle list under each top-level requirement to improve granular visibility of regulatory analysis.

Co-authored-by: davidedm26 <[email protected]>
@dagshub

dagshub Bot commented Mar 4, 2026

Copy link
Copy Markdown

@davidedm26
davidedm26 merged commit 2b2941c into main Mar 4, 2026
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