Skip to content

fix: resolve positional config defaults without duplicate arguments - #170

Open
林SO (Linxiushen) wants to merge 1 commit into
microsoft:mainfrom
Linxiushen:fix/config-positional-defaults
Open

林SO (Linxiushen) wants to merge 1 commit into
microsoft:mainfrom
Linxiushen:fix/config-positional-defaults

Conversation

@Linxiushen

Copy link
Copy Markdown

Passing None positionally to a method decorated with config_defaults raises TypeError: ... got multiple values for argument .... For example, both LLMCacheBase().set_api_cache(False, None) and OllamaClient(None, None) fail before the configured defaults can be used. The decorator adds a keyword argument while retaining the original positional argument.

Update the already-bound arguments and invoke the function using their positional and keyword views. This preserves positional-only parameters, variadic arguments, explicit overrides, and configuration changes between calls.

Validation uses actual cache objects and the Ollama constructor without network/model calls, plus parameter-binding controls:

  • Baseline: 5 failed / 3 passed for the new regression tests.
  • python -m pytest tests/unit/test_config_defaults.py tests/unit/test_api_cache.py::TestLLMCacheBase -q --tb=short -o addopts='': 14 passed (8 new regressions and 6 existing cache tests; Python 3.11, Windows).
  • Two existing warnings concern the pytest timeout_exit option and a third-party Pydantic class configuration.

The full LLM-dependent core suite was not run.

This branch has not been deployed

No deployments
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.

1 participant