mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(responses): add models to TypedDict and fix test state corruption
- Add 'models' field to ResponsesAPIOptionalRequestParams TypedDict so the Perplexity fallback chain param is not silently filtered out by get_requested_response_api_optional_param(). Verified with curl that Perplexity's models param works (tries models in order until one succeeds). - Fix test_python_class_takes_priority_over_json: save and restore the original JSONProviderRegistry entry instead of deleting it, preventing state corruption for subsequent tests.
This commit is contained in:
parent
23e4f00eb3
commit
e223b29d31
2 changed files with 7 additions and 1 deletions
|
|
@ -1155,6 +1155,8 @@ class ResponsesAPIOptionalRequestParams(TypedDict, total=False):
|
|||
] # Number of partial images to generate (1-3) for streaming image generation
|
||||
context_management: Optional[List[ContextManagementEntry]]
|
||||
"""Context management configuration. E.g. [{\"type\": \"compaction\", \"compact_threshold\": 200000}] for server-side compaction (minimum 1000)."""
|
||||
models: Optional[List[str]]
|
||||
"""Model fallback chain (e.g. Perplexity). Models are tried in order until one succeeds."""
|
||||
|
||||
|
||||
class ResponsesAPIRequestParams(ResponsesAPIOptionalRequestParams, total=False):
|
||||
|
|
|
|||
|
|
@ -325,6 +325,7 @@ class TestProviderConfigManagerResponsesAPI:
|
|||
"supported_endpoints": ["/v1/responses"],
|
||||
},
|
||||
)
|
||||
original = JSONProviderRegistry._providers.get("perplexity")
|
||||
JSONProviderRegistry._providers["perplexity"] = test_config
|
||||
try:
|
||||
config = ProviderConfigManager.get_provider_responses_api_config(
|
||||
|
|
@ -334,4 +335,7 @@ class TestProviderConfigManagerResponsesAPI:
|
|||
# Should be the Python class, not the JSON-generated one
|
||||
assert isinstance(config, PerplexityResponsesConfig)
|
||||
finally:
|
||||
del JSONProviderRegistry._providers["perplexity"]
|
||||
if original is not None:
|
||||
JSONProviderRegistry._providers["perplexity"] = original
|
||||
else:
|
||||
del JSONProviderRegistry._providers["perplexity"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue