Description
In gov_rag.py (around line 16), the GovernmentRAG class initialization defines a hardcoded, invalid dummy path:
/path/ianvs/dataset/gov_rag
as the default value for the base_path parameter.
This is an antipattern that leads to unintuitive errors. If a user or script accidentally omits the base_path parameter during object instantiation, the code quietly falls back to this non-existent path. This causes FileNotFoundError or similar runtime crashes deeper in the execution flow that are difficult and confusing to debug for new users.
Expected Behavior
Hardcoded dummy absolute paths should not be used as default parameters.
If base_path is a strictly required parameter for the class to function, it should either:
- have no default value at all, or
- default to
None and immediately throw a clear ValueError upon initialization, for example:
ValueError("The 'base_path' parameter must be provided.")
Steps to Reproduce
- Import the
GovernmentRAG class from gov_rag.py.
- Instantiate the class but omit the
base_path parameter:
- Attempt to run inference or evaluation.
- Observe the unintuitive crash caused by the code attempting to resolve the dummy path
/path/ianvs/....
Proposed Solution
Modify gov_rag.py to change the method signature.
Option 1: Remove default and enforce at signature level
def __init__(self, base_path, ...):
# No default; caller must provide base_path
Option 2: Use None with explicit validation
def __init__(self, base_path=None, ...):
if base_path is None:
raise ValueError("The 'base_path' parameter must be provided.")
The second option is often preferred when you want to keep the parameter order but still enforce that it is explicitly supplied.
Let me know if you would like me to go ahead and make these code changes on your newly created fix/gov-rag-invalid-default-path branch!
Description
In
gov_rag.py(around line 16), theGovernmentRAGclass initialization defines a hardcoded, invalid dummy path:as the default value for the
base_pathparameter.This is an antipattern that leads to unintuitive errors. If a user or script accidentally omits the
base_pathparameter during object instantiation, the code quietly falls back to this non-existent path. This causesFileNotFoundErroror similar runtime crashes deeper in the execution flow that are difficult and confusing to debug for new users.Expected Behavior
Hardcoded dummy absolute paths should not be used as default parameters.
If
base_pathis a strictly required parameter for the class to function, it should either:Noneand immediately throw a clearValueErrorupon initialization, for example:Steps to Reproduce
GovernmentRAGclass fromgov_rag.py.base_pathparameter:/path/ianvs/....Proposed Solution
Modify
gov_rag.pyto change the method signature.Option 1: Remove default and enforce at signature level
Option 2: Use
Nonewith explicit validationThe second option is often preferred when you want to keep the parameter order but still enforce that it is explicitly supplied.
Let me know if you would like me to go ahead and make these code changes on your newly created
fix/gov-rag-invalid-default-pathbranch!