mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix(cerebras): strengthen request parameter types
This commit is contained in:
parent
10e69816a7
commit
c74f8bddf3
2 changed files with 10 additions and 6 deletions
|
|
@ -6,6 +6,10 @@ this is OpenAI compatible - no translation needed / occurs
|
|||
|
||||
from typing import Final
|
||||
|
||||
from openai.types.chat.chat_completion_prediction_content_param import (
|
||||
ChatCompletionPredictionContentParam,
|
||||
)
|
||||
|
||||
from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
|
||||
from litellm.utils import supports_reasoning
|
||||
|
||||
|
|
@ -32,10 +36,10 @@ class CerebrasConfig(OpenAIGPTConfig):
|
|||
top_logprobs: int | None = None
|
||||
frequency_penalty: float | None = None
|
||||
presence_penalty: float | None = None
|
||||
logit_bias: dict | None = None
|
||||
logit_bias: dict[str, float] | None = None
|
||||
service_tier: str | None = None
|
||||
prompt_cache_key: str | None = None
|
||||
prediction: dict | None = None
|
||||
prediction: ChatCompletionPredictionContentParam | None = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -56,10 +60,10 @@ class CerebrasConfig(OpenAIGPTConfig):
|
|||
top_logprobs: int | None = None,
|
||||
frequency_penalty: float | None = None,
|
||||
presence_penalty: float | None = None,
|
||||
logit_bias: dict | None = None,
|
||||
logit_bias: dict[str, float] | None = None,
|
||||
service_tier: str | None = None,
|
||||
prompt_cache_key: str | None = None,
|
||||
prediction: dict | None = None,
|
||||
prediction: ChatCompletionPredictionContentParam | None = None,
|
||||
) -> None:
|
||||
locals_: Final = locals().copy()
|
||||
for key, value in locals_.items():
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from litellm.llms.cerebras.chat import CerebrasConfig
|
|||
("prediction", {"type": "content", "content": "expected"}),
|
||||
],
|
||||
)
|
||||
def test_cerebras_preserves_supported_parameters(parameter, value):
|
||||
def test_cerebras_preserves_supported_parameters(parameter: str, value: object) -> None:
|
||||
config = CerebrasConfig()
|
||||
|
||||
mapped = config.map_openai_params(
|
||||
|
|
@ -32,7 +32,7 @@ def test_cerebras_preserves_supported_parameters(parameter, value):
|
|||
assert mapped == {parameter: value}
|
||||
|
||||
|
||||
def test_cerebras_does_not_alias_max_completion_tokens():
|
||||
def test_cerebras_does_not_alias_max_completion_tokens() -> None:
|
||||
config = CerebrasConfig()
|
||||
|
||||
mapped = config.map_openai_params(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue