Skip to content

Invalid dummy path used as default parameter in gov_rag.py #389

@ARYANPATEL-BIT

Description

@ARYANPATEL-BIT

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

  1. Import the GovernmentRAG class from gov_rag.py.
  2. Instantiate the class but omit the base_path parameter:
    rag = GovernmentRAG()
  3. Attempt to run inference or evaluation.
  4. 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!

Metadata

Metadata

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions