Merge pull request #3943 from pipecat-ai/pk/llm-settings-updates
Minor findings from auditing LLM settings
This commit is contained in:
@@ -76,21 +76,21 @@ class AnthropicThinkingConfig(BaseModel):
|
||||
type: Type of thinking mode (currently only "enabled" or "disabled").
|
||||
budget_tokens: Maximum number of tokens for thinking.
|
||||
With today's models, the minimum is 1024.
|
||||
Only allowed if type is "enabled".
|
||||
Currently required when type is "enabled", not allowed when "disabled".
|
||||
"""
|
||||
|
||||
# Why `| str` here? To not break compatibility in case Anthropic adds
|
||||
# more types in the future.
|
||||
type: Literal["enabled", "disabled"] | str
|
||||
|
||||
# Why not enforce minimnum of 1024 here? To not break compatibility in
|
||||
# case Anthropic changes this requirement in the future.
|
||||
budget_tokens: int
|
||||
# No client-side validation on budget_tokens — we let the server
|
||||
# enforce the rules so we stay forward-compatible if they change.
|
||||
budget_tokens: Optional[int] = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class AnthropicLLMSettings(LLMSettings):
|
||||
"""Settings for Anthropic LLM services.
|
||||
"""Settings for AnthropicLLMService.
|
||||
|
||||
Parameters:
|
||||
enable_prompt_caching: Whether to enable prompt caching.
|
||||
|
||||
@@ -72,7 +72,7 @@ except ModuleNotFoundError as e:
|
||||
|
||||
@dataclass
|
||||
class AWSBedrockLLMSettings(LLMSettings):
|
||||
"""Settings for AWS Bedrock LLM services.
|
||||
"""Settings for AWSBedrockLLMService.
|
||||
|
||||
Parameters:
|
||||
stop_sequences: List of strings that stop generation.
|
||||
|
||||
@@ -227,7 +227,7 @@ class AudioConfig(BaseModel):
|
||||
|
||||
@dataclass
|
||||
class AWSNovaSonicLLMSettings(LLMSettings):
|
||||
"""Settings for AWS Nova Sonic LLM service.
|
||||
"""Settings for AWSNovaSonicLLMService.
|
||||
|
||||
Parameters:
|
||||
voice: Voice identifier for speech synthesis.
|
||||
|
||||
@@ -19,7 +19,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class AzureLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Azure OpenAI LLM service."""
|
||||
"""Settings for AzureLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -64,6 +64,8 @@ class AzureLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", AzureLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -22,7 +22,7 @@ except ModuleNotFoundError as e:
|
||||
|
||||
@dataclass
|
||||
class AzureRealtimeLLMSettings(OpenAIRealtimeLLMSettings):
|
||||
"""Settings for Azure Realtime LLM service."""
|
||||
"""Settings for AzureRealtimeLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class CerebrasLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Cerebras LLM service."""
|
||||
"""Settings for CerebrasLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -64,6 +64,8 @@ class CerebrasLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", CerebrasLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -19,7 +19,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class DeepSeekLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for DeepSeek LLM service."""
|
||||
"""Settings for DeepSeekLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -64,6 +64,8 @@ class DeepSeekLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", DeepSeekLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -19,7 +19,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class FireworksLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Fireworks LLM service."""
|
||||
"""Settings for FireworksLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -64,6 +64,8 @@ class FireworksLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", FireworksLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -607,7 +607,7 @@ class InputParams(BaseModel):
|
||||
|
||||
@dataclass
|
||||
class GeminiLiveLLMSettings(LLMSettings):
|
||||
"""Settings for GeminiLiveLLMService and GeminiLiveVertexLLMService.
|
||||
"""Settings for GeminiLiveLLMService.
|
||||
|
||||
Parameters:
|
||||
voice: TTS voice identifier (e.g. ``"Charon"``).
|
||||
|
||||
@@ -44,7 +44,7 @@ except ModuleNotFoundError as e:
|
||||
|
||||
@dataclass
|
||||
class GeminiLiveVertexLLMSettings(GeminiLiveLLMSettings):
|
||||
"""Settings for Gemini Live Vertex LLM service."""
|
||||
"""Settings for GeminiLiveVertexLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
@@ -714,7 +714,7 @@ class GoogleThinkingConfig(BaseModel):
|
||||
|
||||
@dataclass
|
||||
class GoogleLLMSettings(LLMSettings):
|
||||
"""Settings for Google LLM services.
|
||||
"""Settings for GoogleLLMService.
|
||||
|
||||
Parameters:
|
||||
thinking: Thinking configuration.
|
||||
|
||||
@@ -35,7 +35,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class GoogleOpenAILLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Google OpenAI-compatible LLM service."""
|
||||
"""Settings for GoogleLLMOpenAIBetaService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -102,6 +102,8 @@ class GoogleLLMOpenAIBetaService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", GoogleOpenAILLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -42,7 +42,7 @@ except ModuleNotFoundError as e:
|
||||
|
||||
@dataclass
|
||||
class GoogleVertexLLMSettings(GoogleLLMSettings):
|
||||
"""Settings for Google Vertex LLM service."""
|
||||
"""Settings for GoogleVertexLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class GrokContextAggregatorPair:
|
||||
|
||||
@dataclass
|
||||
class GrokLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Grok LLM service."""
|
||||
"""Settings for GrokLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -119,6 +119,8 @@ class GrokLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", GrokLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -94,7 +94,7 @@ class CurrentAudioResponse:
|
||||
|
||||
@dataclass
|
||||
class GrokRealtimeLLMSettings(LLMSettings):
|
||||
"""Settings for Grok Realtime LLM services.
|
||||
"""Settings for GrokRealtimeLLMService.
|
||||
|
||||
Parameters:
|
||||
session_properties: Grok Realtime session properties (voice, audio config,
|
||||
|
||||
@@ -18,7 +18,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class GroqLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Groq LLM service."""
|
||||
"""Settings for GroqLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -63,6 +63,8 @@ class GroqLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", GroqLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -21,7 +21,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class MistralLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Mistral LLM service."""
|
||||
"""Settings for MistralLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -66,6 +66,8 @@ class MistralLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", MistralLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -23,7 +23,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class NvidiaLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for NVIDIA LLM service."""
|
||||
"""Settings for NvidiaLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -70,6 +70,8 @@ class NvidiaLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", NvidiaLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -18,7 +18,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class OllamaLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Ollama LLM service."""
|
||||
"""Settings for OLLamaLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -62,6 +62,8 @@ class OLLamaLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", OllamaLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -49,7 +49,7 @@ from pipecat.utils.tracing.service_decorators import traced_llm
|
||||
|
||||
@dataclass
|
||||
class OpenAILLMSettings(LLMSettings):
|
||||
"""Settings for OpenAI-compatible LLM services.
|
||||
"""Settings for BaseOpenAILLMService.
|
||||
|
||||
Parameters:
|
||||
max_completion_tokens: Maximum completion tokens to generate.
|
||||
|
||||
@@ -100,7 +100,7 @@ class CurrentAudioResponse:
|
||||
|
||||
@dataclass
|
||||
class OpenAIRealtimeLLMSettings(LLMSettings):
|
||||
"""Settings for OpenAI Realtime LLM services.
|
||||
"""Settings for OpenAIRealtimeLLMService.
|
||||
|
||||
Parameters:
|
||||
session_properties: OpenAI Realtime session properties (modalities,
|
||||
|
||||
@@ -25,7 +25,7 @@ except ModuleNotFoundError as e:
|
||||
|
||||
@dataclass
|
||||
class AzureRealtimeBetaLLMSettings(OpenAIRealtimeBetaLLMSettings):
|
||||
"""Settings for Azure Realtime Beta LLM service."""
|
||||
"""Settings for AzureRealtimeBetaLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class CurrentAudioResponse:
|
||||
|
||||
@dataclass
|
||||
class OpenAIRealtimeBetaLLMSettings(LLMSettings):
|
||||
"""Settings for OpenAI Realtime Beta LLM services."""
|
||||
"""Settings for OpenAIRealtimeBetaLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ except ModuleNotFoundError as e:
|
||||
|
||||
@dataclass
|
||||
class OpenPipeLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for OpenPipe LLM service."""
|
||||
"""Settings for OpenPipeLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -82,6 +82,8 @@ class OpenPipeLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", OpenPipeLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -22,7 +22,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class OpenRouterLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for OpenRouter LLM service."""
|
||||
"""Settings for OpenRouterLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -68,6 +68,8 @@ class OpenRouterLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", OpenRouterLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -25,7 +25,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class PerplexityLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Perplexity LLM service."""
|
||||
"""Settings for PerplexityLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -71,6 +71,8 @@ class PerplexityLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", PerplexityLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -18,7 +18,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class QwenLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Qwen LLM service."""
|
||||
"""Settings for QwenLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -63,6 +63,8 @@ class QwenLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", QwenLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -30,7 +30,7 @@ from pipecat.utils.tracing.service_decorators import traced_llm
|
||||
|
||||
@dataclass
|
||||
class SambaNovaLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for SambaNova LLM service."""
|
||||
"""Settings for SambaNovaLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -75,6 +75,8 @@ class SambaNovaLLMService(OpenAILLMService): # type: ignore
|
||||
_warn_deprecated_param("model", SambaNovaLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
@@ -18,7 +18,7 @@ from pipecat.services.settings import _warn_deprecated_param
|
||||
|
||||
@dataclass
|
||||
class TogetherLLMSettings(OpenAILLMSettings):
|
||||
"""Settings for Together LLM service."""
|
||||
"""Settings for TogetherLLMService."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -63,6 +63,8 @@ class TogetherLLMService(OpenAILLMService):
|
||||
_warn_deprecated_param("model", TogetherLLMSettings, "model")
|
||||
default_settings.model = model
|
||||
|
||||
# 3. (No step 3, as there's no params object to apply)
|
||||
|
||||
# 4. Apply settings delta (canonical API, always wins)
|
||||
if settings is not None:
|
||||
default_settings.apply_update(settings)
|
||||
|
||||
Reference in New Issue
Block a user