MCPcopy
hub / github.com/simstudioai/sim / start

Function start

apps/sim/providers/google/utils.ts:293–315  ·  view source on GitHub ↗
(controller)

Source from the content-addressed store, hash-verified

291
292 return new ReadableStream({
293 async start(controller) {
294 try {
295 for await (const chunk of stream) {
296 if (chunk.usageMetadata) {
297 usage = convertUsageMetadata(chunk.usageMetadata)
298 }
299
300 const text = chunk.text
301 if (text) {
302 fullContent += text
303 controller.enqueue(new TextEncoder().encode(text))
304 }
305 }
306
307 onComplete?.(fullContent, usage)
308 controller.close()
309 } catch (error) {
310 logger.error('Error reading Google Gemini stream', {
311 error: toError(error).message,
312 })
313 controller.error(error)
314 }
315 },
316 })
317}
318

Callers

nothing calls this directly

Calls 5

toErrorFunction · 0.90
convertUsageMetadataFunction · 0.85
errorMethod · 0.80
enqueueMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected