diff --git a/CHANGELOG.md b/CHANGELOG.md index 0edd55d07..75bb875da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ... ``` +- Added a `service_tier` `InputParam` to the `BaseOpenAILLMService`. This + parameter can influence the latency of the response. For example `"priority"` + will result in faster completions, but in exchange for a higher price. + ## [0.0.89] - 2025-10-07 ### Fixed @@ -36,8 +40,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `HumeTTSService` for text-to-speech synthesis using Hume AI's expressive voice models. Provides high-quality, emotionally expressive speech synthesis with support for various voice models. Includes example in - `examples/foundational/07ad-interruptible-hume.py`. Use with `uv pip install - pipecat-ai[hume]`. + `examples/foundational/07ad-interruptible-hume.py`. Use with: + `uv pip install pipecat-ai[hume]`. ### Changed diff --git a/src/pipecat/services/openai/base_llm.py b/src/pipecat/services/openai/base_llm.py index 5c48f86e9..d020e1106 100644 --- a/src/pipecat/services/openai/base_llm.py +++ b/src/pipecat/services/openai/base_llm.py @@ -66,6 +66,7 @@ class BaseOpenAILLMService(LLMService): top_p: Top-p (nucleus) sampling parameter (0.0 to 1.0). max_tokens: Maximum tokens in response (deprecated, use max_completion_tokens). max_completion_tokens: Maximum completion tokens to generate. + service_tier: Service tier to use (e.g., "auto", "flex", "priority"). extra: Additional model-specific parameters. """ @@ -83,6 +84,7 @@ class BaseOpenAILLMService(LLMService): top_p: Optional[float] = Field(default_factory=lambda: NOT_GIVEN, ge=0.0, le=1.0) max_tokens: Optional[int] = Field(default_factory=lambda: NOT_GIVEN, ge=1) max_completion_tokens: Optional[int] = Field(default_factory=lambda: NOT_GIVEN, ge=1) + service_tier: Optional[str] = Field(default_factory=lambda: NOT_GIVEN) extra: Optional[Dict[str, Any]] = Field(default_factory=dict) def __init__( @@ -125,6 +127,7 @@ class BaseOpenAILLMService(LLMService): "top_p": params.top_p, "max_tokens": params.max_tokens, "max_completion_tokens": params.max_completion_tokens, + "service_tier": params.service_tier, "extra": params.extra if isinstance(params.extra, dict) else {}, } self._retry_timeout_secs = retry_timeout_secs @@ -236,6 +239,7 @@ class BaseOpenAILLMService(LLMService): "top_p": self._settings["top_p"], "max_tokens": self._settings["max_tokens"], "max_completion_tokens": self._settings["max_completion_tokens"], + "service_tier": self._settings["service_tier"], } # Messages, tools, tool_choice