-
Notifications
You must be signed in to change notification settings - Fork 48
feat(legal): add citation_exists requirement and real-data tests for case validation #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…case validation Implements a new requirement that checks if a case name exists in the cases_metadata database using actual JSON files. Adds parameterized pytest tests that validate case detection against real data.
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation of the requirement should be in mellea/stdlib/reqlib/legal.py.
| # create mock context | ||
| ctx = MockContext(case_name) | ||
| # path to metadata folder | ||
| db_folder = "/Users/anooshkapendyal/Desktop/mellea/mellea/test/stdlib_basics/legal/cases_metadata" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be relative.
|
|
||
| return name.strip() | ||
|
|
||
| def citation_exists(ctx: Context, folder_path: str) -> ValidationResult: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should always operate over strings.
So here, instead of folder_path, pass in a list of the actual contents of that folder, whatever those are. In this case, the metadata json files.
If these were inteded as LLM inputs, then you'd want to pass them in as CBlocks rather than strs.
The type signature of this function should probably be:
def citation_exists(ctx: Context, folder_path: list[dict]) -> ValidationResult: ...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you find that the case metadata is too big to pass in directly, then you could instead use Generator[...] instead of list[...]
| """ | ||
| Checks if the output case name exists in the provided case metadata database. | ||
| """ | ||
| def __init__(self, folder_path: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be case_metadata instead of folder_path.
Implements a new requirement that checks if a case name exists in the cases_metadata database using actual JSON files. Adds parameterized pytest tests that validate case detection against real data.