Add service_tier to BaseOpenAILLMService
This commit is contained in:
@@ -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
|
## [0.0.89] - 2025-10-07
|
||||||
|
|
||||||
### Fixed
|
### 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
|
- Added `HumeTTSService` for text-to-speech synthesis using Hume AI's expressive
|
||||||
voice models. Provides high-quality, emotionally expressive speech synthesis
|
voice models. Provides high-quality, emotionally expressive speech synthesis
|
||||||
with support for various voice models. Includes example in
|
with support for various voice models. Includes example in
|
||||||
`examples/foundational/07ad-interruptible-hume.py`. Use with `uv pip install
|
`examples/foundational/07ad-interruptible-hume.py`. Use with:
|
||||||
pipecat-ai[hume]`.
|
`uv pip install pipecat-ai[hume]`.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class BaseOpenAILLMService(LLMService):
|
|||||||
top_p: Top-p (nucleus) sampling parameter (0.0 to 1.0).
|
top_p: Top-p (nucleus) sampling parameter (0.0 to 1.0).
|
||||||
max_tokens: Maximum tokens in response (deprecated, use max_completion_tokens).
|
max_tokens: Maximum tokens in response (deprecated, use max_completion_tokens).
|
||||||
max_completion_tokens: Maximum completion tokens to generate.
|
max_completion_tokens: Maximum completion tokens to generate.
|
||||||
|
service_tier: Service tier to use (e.g., "auto", "flex", "priority").
|
||||||
extra: Additional model-specific parameters.
|
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)
|
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_tokens: Optional[int] = Field(default_factory=lambda: NOT_GIVEN, ge=1)
|
||||||
max_completion_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)
|
extra: Optional[Dict[str, Any]] = Field(default_factory=dict)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -125,6 +127,7 @@ class BaseOpenAILLMService(LLMService):
|
|||||||
"top_p": params.top_p,
|
"top_p": params.top_p,
|
||||||
"max_tokens": params.max_tokens,
|
"max_tokens": params.max_tokens,
|
||||||
"max_completion_tokens": params.max_completion_tokens,
|
"max_completion_tokens": params.max_completion_tokens,
|
||||||
|
"service_tier": params.service_tier,
|
||||||
"extra": params.extra if isinstance(params.extra, dict) else {},
|
"extra": params.extra if isinstance(params.extra, dict) else {},
|
||||||
}
|
}
|
||||||
self._retry_timeout_secs = retry_timeout_secs
|
self._retry_timeout_secs = retry_timeout_secs
|
||||||
@@ -236,6 +239,7 @@ class BaseOpenAILLMService(LLMService):
|
|||||||
"top_p": self._settings["top_p"],
|
"top_p": self._settings["top_p"],
|
||||||
"max_tokens": self._settings["max_tokens"],
|
"max_tokens": self._settings["max_tokens"],
|
||||||
"max_completion_tokens": self._settings["max_completion_tokens"],
|
"max_completion_tokens": self._settings["max_completion_tokens"],
|
||||||
|
"service_tier": self._settings["service_tier"],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Messages, tools, tool_choice
|
# Messages, tools, tool_choice
|
||||||
|
|||||||
Reference in New Issue
Block a user