Skip to content

Commit a16ea88

Browse files
Add output settings
1 parent a30b173 commit a16ea88

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

fishjam/integrations/gemini.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from typing import Optional, Union
1313

1414
from fishjam import AgentOutputOptions
15+
from fishjam.agent import OutgoingAudioTrackOptions
16+
from fishjam.events import TrackEncoding
1517
from fishjam.version import get_version
1618

1719

@@ -79,7 +81,7 @@ def create_client(
7981
def GEMINI_INPUT_AUDIO_SETTINGS(self) -> AgentOutputOptions:
8082
"""Audio configuration required for Gemini input.
8183
82-
Gemini requires PCM16 audio at 16,000 Hz for correct processing.
84+
Gemini consumes PCM16 audio at 16,000 Hz.
8385
8486
Returns:
8587
AgentOutputOptions: Agent options compatible with the Gemini Live API.
@@ -89,6 +91,21 @@ def GEMINI_INPUT_AUDIO_SETTINGS(self) -> AgentOutputOptions:
8991
audio_sample_rate=16_000,
9092
)
9193

94+
@property
95+
def GEMINI_OUTPUT_AUDIO_SETTINGS(self) -> OutgoingAudioTrackOptions:
96+
"""Audio configuration for an agent's output track.
97+
98+
Gemini produces PCM16 audio at 24,000 Hz.
99+
100+
Returns:
101+
OutgoingAudioTrackOptions: Track options compatible with the Gemini Live API
102+
"""
103+
return OutgoingAudioTrackOptions(
104+
encoding=TrackEncoding.TRACK_ENCODING_PCM16,
105+
sample_rate=24_000,
106+
channels=1,
107+
)
108+
92109
@property
93110
def GEMINI_AUDIO_MIME_TYPE(self) -> str:
94111
"""The mime type for Gemini audio input."""

0 commit comments

Comments
 (0)