Merge pull request #889 from pipecat-ai/mb/openai-realtime-model

Add model parameter to OpenAI realtime service constructor, update de…
This commit is contained in:
Mark Backman
2024-12-19 08:08:52 -05:00
committed by GitHub
2 changed files with 10 additions and 3 deletions

View File

@@ -24,6 +24,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- `OpenAIRealtimeBetaLLMService` now takes a `model` parameter in the
constructor.
- Updated the default model for the `OpenAIRealtimeBetaLLMService`.
- Room expiration (`exp`) in `DailyRoomProperties` is now optional (`None`) by
default instead of automatically setting a 5-minute expiration time. You must
explicitly set expiration time if desired.

View File

@@ -72,15 +72,17 @@ class OpenAIRealtimeBetaLLMService(LLMService):
self,
*,
api_key: str,
base_url="wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-10-01",
model: str = "gpt-4o-realtime-preview-2024-12-17",
base_url: str = "wss://api.openai.com/v1/realtime",
session_properties: events.SessionProperties = events.SessionProperties(),
start_audio_paused: bool = False,
send_transcription_frames: bool = True,
**kwargs,
):
super().__init__(base_url=base_url, **kwargs)
full_url = f"{base_url}?model={model}"
super().__init__(base_url=full_url, **kwargs)
self.api_key = api_key
self.base_url = base_url
self.base_url = full_url
self._session_properties: events.SessionProperties = session_properties
self._audio_input_paused = start_audio_paused