Skip to content

Commit b78e5db

Browse files
committed
add temperature config
1 parent 46c469b commit b78e5db

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/components/realtime-chat/realtime-chat.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export function RealtimeChat({
5656
const [deployment, setDeployment] = useState("");
5757
const [useVAD, setUseVAD] = useState(true);
5858
const [voice, setVoice] = useState<Voice>("alloy");
59+
const [temperature, setTemperature] = useState(0.9);
5960

6061
const clientRef = useRef<RTClient | null>(null);
6162
const audioHandlerRef = useRef<AudioHandler | null>(null);
@@ -84,7 +85,7 @@ export function RealtimeChat({
8485
input_audio_transcription: { model: "whisper-1" },
8586
turn_detection: turnDetection,
8687
tools: [],
87-
temperature: 0.9,
88+
temperature,
8889
modalities,
8990
});
9091
startResponseListener();
@@ -282,6 +283,14 @@ export function RealtimeChat({
282283
[],
283284
);
284285

286+
// update session params
287+
useEffect(() => {
288+
clientRef.current?.configure({ voice });
289+
}, [voice]);
290+
useEffect(() => {
291+
clientRef.current?.configure({ temperature });
292+
}, [temperature]);
293+
285294
const handleClose = async () => {
286295
onClose?.();
287296
if (isRecording) {

0 commit comments

Comments
 (0)