MCPcopy Index your code
hub / github.com/mudler/LocalAI / ModelAudioTransformStream

Function ModelAudioTransformStream

core/backend/audio_transform.go:138–154  ·  view source on GitHub ↗

ModelAudioTransformStream opens the bidirectional AudioTransformStream RPC and returns the underlying stream client. The caller is responsible for sending the initial Config message, subsequent Frame messages, and for calling CloseSend when input is done. The returned stream's Recv reports EOF when

(
	ctx context.Context,
	loader *model.ModelLoader,
	appConfig *config.ApplicationConfig,
	modelConfig config.ModelConfig,
)

Source from the content-addressed store, hash-verified

136// calling CloseSend when input is done. The returned stream's Recv reports
137// EOF when the backend has finished emitting frames.
138func ModelAudioTransformStream(
139 ctx context.Context,
140 loader *model.ModelLoader,
141 appConfig *config.ApplicationConfig,
142 modelConfig config.ModelConfig,
143) (grpc.AudioTransformStreamClient, error) {
144 mopts := ModelOptions(modelConfig, appConfig)
145 transformModel, err := loader.Load(mopts...)
146 if err != nil {
147 recordModelLoadFailure(appConfig, modelConfig.Name, modelConfig.Backend, err, nil)
148 return nil, err
149 }
150 if transformModel == nil {
151 return nil, fmt.Errorf("could not load audio-transform model %q", modelConfig.Model)
152 }
153 return transformModel.AudioTransformStream(ctx)
154}
155
156// persistAudioInput copies a transient input file (typically a multipart
157// upload that lives in an os.TempDir slated for cleanup) into the long-lived

Callers 1

Calls 4

ModelOptionsFunction · 0.85
recordModelLoadFailureFunction · 0.85
LoadMethod · 0.65
AudioTransformStreamMethod · 0.65

Tested by

no test coverage detected