mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-23 21:25:33 -04:00
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:
@@ -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
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user