(
language?: string,
voiceName?: string,
systemInstruction?: string,
options?: { affectiveDialog?: boolean }
)
| 430 | |
| 431 | /** Wire-format setup frame for Gemini Live BidiGenerateContent (hub proxy + web client). */ |
| 432 | export function buildGeminiLiveSetupMessage( |
| 433 | language?: string, |
| 434 | voiceName?: string, |
| 435 | systemInstruction?: string, |
| 436 | options?: { affectiveDialog?: boolean } |
| 437 | ): { setup: Record<string, unknown> } { |
| 438 | const liveConfig = buildGeminiLiveConfig(language, voiceName, systemInstruction) |
| 439 | const resolvedVoice = resolveGeminiLiveVoice(voiceName) |
| 440 | return { |
| 441 | setup: { |
| 442 | model: `models/${liveConfig.model}`, |
| 443 | generationConfig: { |
| 444 | responseModalities: ['AUDIO'], |
| 445 | ...(options?.affectiveDialog ? { enableAffectiveDialog: true } : {}), |
| 446 | speechConfig: { |
| 447 | voiceConfig: { |
| 448 | prebuiltVoiceConfig: { voiceName: resolvedVoice } |
| 449 | } |
| 450 | } |
| 451 | }, |
| 452 | systemInstruction: { |
| 453 | parts: [{ text: liveConfig.systemInstruction }] |
| 454 | }, |
| 455 | tools: liveConfig.tools.map((t) => ({ |
| 456 | functionDeclarations: t.functionDeclarations.map((fd) => ({ |
| 457 | name: fd.name, |
| 458 | description: fd.description, |
| 459 | parameters: fd.parameters |
| 460 | })) |
| 461 | })) |
| 462 | } |
| 463 | } |
| 464 | } |
no test coverage detected