MCPcopy
hub / github.com/mudler/LocalAI / record

Method record

core/backend/transcript_live.go:163–195  ·  view source on GitHub ↗
(closeErr error)

Source from the content-addressed store, hash-verified

161}
162
163func (ts *liveTraceState) record(closeErr error) {
164 if ts == nil || !ts.appConfig.EnableTracing {
165 return
166 }
167 ts.mu.Lock()
168 data := map[string]any{
169 "source": "live_stream",
170 "language": ts.language,
171 "result_text": ts.finalText,
172 "eou_events": ts.eouEvents,
173 "eob_events": ts.eobEvents,
174 "delta_events": ts.deltaEvents,
175 }
176 if snippet := trace.AudioSnippetFromPCM(ts.pcm, liveSampleRate, ts.fedSamples*2, ts.appConfig.TracingMaxBodyBytes); snippet != nil {
177 maps.Copy(data, snippet)
178 }
179 summary := "live -> " + ts.finalText
180 ts.mu.Unlock()
181
182 bt := trace.BackendTrace{
183 Timestamp: ts.started,
184 Duration: time.Since(ts.started),
185 Type: trace.BackendTraceTranscription,
186 ModelName: ts.modelName,
187 Backend: ts.backend,
188 Summary: trace.TruncateString(summary, 200),
189 Data: data,
190 }
191 if closeErr != nil {
192 bt.Error = closeErr.Error()
193 }
194 trace.RecordBackendTrace(bt)
195}
196
197// ModelTranscriptionLive loads the transcription backend, opens the
198// bidirectional AudioTranscriptionLive RPC, sends the session config, and

Callers 2

CloseMethod · 0.45

Calls 6

AudioSnippetFromPCMFunction · 0.92
TruncateStringFunction · 0.92
RecordBackendTraceFunction · 0.92
LockMethod · 0.65
UnlockMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected