mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
Merge 26f9ff4c6d into cd63c7e5a7
This commit is contained in:
commit
401ab34bf3
5 changed files with 3002 additions and 0 deletions
|
|
@ -200,5 +200,14 @@
|
|||
"temperature_max": 1.99
|
||||
},
|
||||
"supported_endpoints": ["/v1/chat/completions"]
|
||||
},
|
||||
"ofox": {
|
||||
"base_url": "https://api.ofox.ai/v1",
|
||||
"api_key_env": "OFOX_API_KEY",
|
||||
"api_base_env": "OFOX_API_BASE",
|
||||
"param_mappings": {
|
||||
"max_completion_tokens": "max_tokens"
|
||||
},
|
||||
"supported_endpoints": ["/v1/chat/completions", "/v1/responses"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -2989,6 +2989,23 @@
|
|||
"rerank": false,
|
||||
"a2a": false
|
||||
}
|
||||
},
|
||||
"ofox": {
|
||||
"display_name": "Ofox (`ofox`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/ofox",
|
||||
"endpoints": {
|
||||
"chat_completions": true,
|
||||
"messages": false,
|
||||
"responses": true,
|
||||
"embeddings": false,
|
||||
"image_generations": false,
|
||||
"audio_transcriptions": false,
|
||||
"audio_speech": false,
|
||||
"moderations": false,
|
||||
"batches": false,
|
||||
"rerank": false,
|
||||
"a2a": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"endpoints": {
|
||||
|
|
|
|||
56
tests/test_litellm/llms/openai_like/test_ofox_provider.py
Normal file
56
tests/test_litellm/llms/openai_like/test_ofox_provider.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
"""
|
||||
Unit tests for the Ofox OpenAI-like provider.
|
||||
"""
|
||||
|
||||
from litellm.llms.openai_like.dynamic_config import create_config_class
|
||||
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
|
||||
|
||||
OFOX_BASE_URL = "https://api.ofox.ai/v1"
|
||||
|
||||
|
||||
def _get_config():
|
||||
provider = JSONProviderRegistry.get("ofox")
|
||||
assert provider is not None
|
||||
config_class = create_config_class(provider)
|
||||
return config_class()
|
||||
|
||||
|
||||
def test_ofox_provider_registered():
|
||||
provider = JSONProviderRegistry.get("ofox")
|
||||
assert provider is not None
|
||||
assert provider.base_url == OFOX_BASE_URL
|
||||
assert provider.api_key_env == "OFOX_API_KEY"
|
||||
assert provider.api_base_env == "OFOX_API_BASE"
|
||||
|
||||
|
||||
def test_ofox_resolves_env_api_key(monkeypatch):
|
||||
config = _get_config()
|
||||
monkeypatch.setenv("OFOX_API_KEY", "test-key")
|
||||
api_base, api_key = config._get_openai_compatible_provider_info(None, None)
|
||||
assert api_base == OFOX_BASE_URL
|
||||
assert api_key == "test-key"
|
||||
|
||||
|
||||
def test_ofox_maps_max_completion_tokens():
|
||||
config = _get_config()
|
||||
params = config.map_openai_params(
|
||||
non_default_params={"max_completion_tokens": 256},
|
||||
optional_params={},
|
||||
model="ofox/openai/gpt-5.5",
|
||||
drop_params=False,
|
||||
)
|
||||
assert params.get("max_tokens") == 256
|
||||
assert "max_completion_tokens" not in params
|
||||
|
||||
|
||||
def test_ofox_complete_url_appends_endpoint():
|
||||
config = _get_config()
|
||||
url = config.get_complete_url(
|
||||
api_base=OFOX_BASE_URL,
|
||||
api_key="test-key",
|
||||
model="ofox/openai/gpt-5.5",
|
||||
optional_params={},
|
||||
litellm_params={},
|
||||
stream=False,
|
||||
)
|
||||
assert url == f"{OFOX_BASE_URL}/chat/completions"
|
||||
Loading…
Add table
Reference in a new issue