diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-09 14:14:38 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-09 14:14:38 +0200 |
| commit | 67e1badee2e087bc673f252a5463c55e4ff4f9b1 (patch) | |
| tree | d9b465ca46be65abe2a1970303d4199c4235e80a /test_llamachat.py | |
| parent | 7246d07dda18c07278cc9df122071f523f697be3 (diff) | |
| download | llamachat-67e1badee2e087bc673f252a5463c55e4ff4f9b1.tar.gz llamachat-67e1badee2e087bc673f252a5463c55e4ff4f9b1.zip | |
fix: stop a partial [providers.local] from deleting the local provider
The synthesis guard tested key membership, so a [providers.local] that set
only an api_key claimed the slot, blocked the bare base_url from filling
it, then failed the URL check and vanished. Losing the local provider is
the one outcome this feature cannot have. The guard now tests the URL and
merges, so the table adds detail to the local provider rather than
replacing it.
A filter given as a bare string was iterated character-wise, turning
filter = "qwen" into four needles that match almost every model id. Both
failures were silent, which is what made them worth fixing now.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'test_llamachat.py')
| -rwxr-xr-x | test_llamachat.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test_llamachat.py b/test_llamachat.py index 6a5c0e6..09d6203 100755 --- a/test_llamachat.py +++ b/test_llamachat.py @@ -958,6 +958,26 @@ def test_provider_parsing(): # Unset numbers stay None so "unknown" is distinguishable from zero. assert parsed["local"].ctx_size is None assert parsed["local"].price_in is None + + # A [providers.local] that omits base_url inherits the bare one rather + # than shadowing the local provider out of existence. + partial = providers.parse( + { + "base_url": "http://localhost:8181", + "providers": {"local": {"api_key": "env:SOME_VAR"}}, + } + ) + assert set(partial) == {"local"} + assert partial["local"].base_url == "http://localhost:8181" + # The explicit entry's own fields survive the merge. + assert partial["local"].api_key == "env:SOME_VAR" + + # A filter given as a bare string is one needle, not four. + stringy = providers.parse( + {"providers": {"p": {"base_url": "http://x.example.org", + "filter": "qwen"}}} + ) + assert stringy["p"].filter == ["qwen"] print("ok provider config parsing") |
