fix(models): query v1 models for llama-server endpoints (#3380)

* fix(models): query v1 models for llama-server endpoints

* test(models): accept owner kwargs in llama-server regression
This commit is contained in:
Ocean Bennett
2026-06-08 19:09:02 -04:00
committed by GitHub
parent f7ae85590b
commit e7c1d75884
5 changed files with 66 additions and 4 deletions
+1 -1
View File
@@ -184,7 +184,7 @@ def build_chat_url(base: str) -> str:
def build_models_url(base: str) -> Optional[str]:
"""Return the provider-specific model-list endpoint URL for a base."""
base = resolve_url(base)
base = normalize_base(resolve_url(base))
provider = _detect_provider(base)
if provider == "anthropic":
return _anthropic_api_root(base) + "/v1/models"
+3 -1
View File
@@ -1042,7 +1042,9 @@ def list_model_ids(
if provider == "ollama":
models_url = _ollama_api_root(base_chat_url) + "/tags"
else:
models_url = base_chat_url.replace("/chat/completions", "/models")
from src.endpoint_resolver import build_models_url
models_url = build_models_url(base_chat_url)
r = httpx.get(models_url, headers=h, timeout=timeout)
r.raise_for_status()
data = r.json()
+3 -1
View File
@@ -297,7 +297,9 @@ def _query_context_length(endpoint_url: str, model: str) -> int:
logger.info(f"Using known context window for {model}: {known}")
return known or DEFAULT_CONTEXT
models_url = endpoint_url.replace("/chat/completions", "/models")
from src.endpoint_resolver import build_models_url
models_url = build_models_url(endpoint_url)
try:
r = httpx.get(models_url, timeout=REQUEST_TIMEOUT)
if r.is_success: