a few updates

This commit is contained in:
Blaine Kasten
2026-03-19 13:37:21 -05:00
parent 077610184d
commit 591c02fb0e
4 changed files with 28 additions and 32 deletions

View File

@@ -36,7 +36,7 @@ class TogetherLLMService(OpenAILLMService):
self,
*,
api_key: str,
base_url: str = "https://api.together.xyz/v1",
base_url: str = "https://api.together.ai/v1",
model: Optional[str] = None,
settings: Optional[Settings] = None,
**kwargs,
@@ -45,8 +45,8 @@ class TogetherLLMService(OpenAILLMService):
Args:
api_key: The API key for accessing Together.ai's API.
base_url: The base URL for Together.ai API. Defaults to "https://api.together.xyz/v1".
model: The model identifier to use. Defaults to "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo".
base_url: The base URL for Together.ai API. Defaults to "https://api.together.ai/v1".
model: The model identifier to use.
.. deprecated:: 0.0.105
Use ``settings=TogetherLLMService.Settings(model=...)`` instead.
@@ -56,7 +56,7 @@ class TogetherLLMService(OpenAILLMService):
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = self.Settings(model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo")
default_settings = self.Settings(model=model)
# 2. Apply direct init arg overrides (deprecated)
if model is not None:

View File

@@ -296,7 +296,7 @@ class TogetherSTTService(WebsocketSTTService):
Args:
evt: The delta event from the server.
"""
delta = evt.get("transcript", "")
delta = evt.get("delta", "")
if delta.strip():
await self.push_frame(
InterimTranscriptionFrame(
@@ -321,6 +321,7 @@ class TogetherSTTService(WebsocketSTTService):
self._user_id,
time_now_iso8601(),
result=evt,
finalized=True,
)
)
await self._handle_transcription_trace(transcript, True, self._settings.language)

View File

@@ -225,20 +225,17 @@ class TogetherTTSService(WebsocketTTSService):
Args:
message: The message dict to serialize and send.
"""
try:
if not self._disconnecting and self._websocket:
await self._websocket.send(json.dumps(message))
except Exception as e:
if self._disconnecting or not self._websocket:
return
await self.push_error(
error_msg=f"Error sending message: {e}",
exception=e,
)
if not self._disconnecting:
await self.send_with_retry(json.dumps(message), self._report_error)
async def flush_audio(self):
"""Flush any pending audio and finalize the current context."""
logger.trace(f"{self}: flushing audio")
async def flush_audio(self, context_id: Optional[str] = None):
"""Flush any pending audio and finalize the current context.
Args:
context_id: Pipecat TTS context (unused for Together; required for
compatibility with :meth:`TTSService.on_turn_context_completed`).
"""
logger.trace(f"{self}: flushing audio (context_id={context_id})")
await self._ws_send({"type": "input_text_buffer.commit"})
# ------------------------------------------------------------------
@@ -252,7 +249,9 @@ class TogetherTTSService(WebsocketTTSService):
this method with automatic reconnection on connection errors.
"""
async for message in self._websocket:
if not isinstance(message, str):
if isinstance(message, bytes):
message = message.decode("utf-8")
elif not isinstance(message, str):
continue
try: