Skip to content

AICaller not initialized properly with api_key, api_base, and missing max_tokens argument in parse_args_full_repo #318

@cuso4huang

Description

@cuso4huang

When running the main_full_repo entry point in the Qodo project, I encountered the following issues:

Arguments not passed to AICaller:
Although the main_full_repo function accepts arguments like --api_key and --api_base, they are not actually passed when initializing the AICaller. This results in the settings being ignored.
I found the origin one is:

ai_caller = AICaller(model=args.model)

To fix this, I modified the initialization like this:

ai_caller = AICaller(model=args.model, api_base=args.api_base, max_tokens=8192)

This allows the api_base to be correctly passed to the caller.

max_run_time attribute error:
The AICaller requires a max_tokens argument, but this parameter is not present in the parse_args_full_repo function. Also, running the project results in the following error:

Error running CoverAgent for test file '/home/cuso4/qodo-cover/templated_tests/python_fastapi/tests/test_app.py': 'Namespace' object has no attribute 'max_run_time'

This is due to --max-run-time not being defined in the argument parser.

To resolve this, we need to add the following argument:

parser.add_argument(
    "--max-run-time",
    type=int,
    default=300,
    help="Maximum time (in seconds) allowed for test execution. Overrides the value in configuration.toml if provided. Defaults to 300 seconds.",
)

I plan to submit a PR shortly to address these issues. Hope this helps improve the project!

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions