mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 10:15:27 -04:00
test(provider): align lookalike-host URL expectations with /models behavior
build_models_url returns /models (no /v1 prefix) for non-local generic OpenAI-compatible hosts (intentional, see endpoint_resolver.py:206). The tests added in #4272 expected /v1/models, which is the local/deepseek behavior. Match production semantics.
This commit is contained in:
@@ -107,10 +107,8 @@ class TestBuildersRejectLookalikeHosts:
|
|||||||
assert build_chat_url("https://notanthropic.com") == "https://notanthropic.com/chat/completions"
|
assert build_chat_url("https://notanthropic.com") == "https://notanthropic.com/chat/completions"
|
||||||
|
|
||||||
def test_lookalike_anthropic_models_is_openai(self):
|
def test_lookalike_anthropic_models_is_openai(self):
|
||||||
# Must hit the generic OpenAI branch, not Anthropic — assert the
|
|
||||||
# provider directly since both branches now end in /v1/models.
|
|
||||||
assert llm_core._detect_provider("https://anthropic.com.evil.com") == "openai"
|
assert llm_core._detect_provider("https://anthropic.com.evil.com") == "openai"
|
||||||
assert build_models_url("https://anthropic.com.evil.com") == "https://anthropic.com.evil.com/v1/models"
|
assert build_models_url("https://anthropic.com.evil.com") == "https://anthropic.com.evil.com/models"
|
||||||
|
|
||||||
def test_anthropic_domain_in_path_is_openai(self):
|
def test_anthropic_domain_in_path_is_openai(self):
|
||||||
assert build_chat_url("https://myproxy.internal/anthropic.com/v1") == "https://myproxy.internal/anthropic.com/v1/chat/completions"
|
assert build_chat_url("https://myproxy.internal/anthropic.com/v1") == "https://myproxy.internal/anthropic.com/v1/chat/completions"
|
||||||
@@ -122,9 +120,8 @@ class TestBuildersRejectLookalikeHosts:
|
|||||||
assert build_chat_url("https://notollama.com") == "https://notollama.com/chat/completions"
|
assert build_chat_url("https://notollama.com") == "https://notollama.com/chat/completions"
|
||||||
|
|
||||||
def test_lookalike_ollama_models_is_openai(self):
|
def test_lookalike_ollama_models_is_openai(self):
|
||||||
# Must hit the generic OpenAI branch, not Ollama.
|
|
||||||
assert llm_core._detect_provider("https://notollama.com") == "openai"
|
assert llm_core._detect_provider("https://notollama.com") == "openai"
|
||||||
assert build_models_url("https://notollama.com") == "https://notollama.com/v1/models"
|
assert build_models_url("https://notollama.com") == "https://notollama.com/models"
|
||||||
|
|
||||||
|
|
||||||
class TestBuildersLocalAndDockerEndpoints:
|
class TestBuildersLocalAndDockerEndpoints:
|
||||||
|
|||||||
Reference in New Issue
Block a user