emitSoundDetection (openai/realtime_sound_detection.go)

LocalAI · core/http/endpoints/openai/realtime_sound_detection.go · go · MIT
voice, tag:knn-classified

Emits sound detection events for a committed utterance in OpenAI realtime endpoint.

// Source: https://github.com/mudler/LocalAI | License: MIT | Copyright 2023-2025 Ettore Di Giacinto (mudler@localai.io)
// Provided via justclaw.it.com; keep this notice with the code.
package openai

import (
	"context"

	"github.com/mudler/LocalAI/core/http/endpoints/openai/types"
)

// defaultSoundDetectionTopK is the number of scored tags requested per
// committed utterance when the session does not pin its own top_k.
const defaultSoundDetectionTopK = 5

// emitSoundDetection classifies a committed utterance into sound-event tags and
// emits a conversation.item.sound_detection event for it. It mirrors
// emitTranscription's unary path: it calls the session's sound-event
// classifier, maps the scored tags onto the server event, and sends it over
// the transport. Sound detection is 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key