Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task ConnectAsync(string conversationId)
_waveIn = new WaveInEvent
{
DeviceNumber = 0, // Default recording device
WaveFormat = new WaveFormat(24000, 16, 1), // 24000 Hz, 16-bit PCM, Mono
WaveFormat = new WaveFormat(16000, 16, 1), // 24000 Hz, 16-bit PCM, Mono
BufferMilliseconds = 100
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public async Task Connect(RealtimeHubConnection conn,

await AttachEvents(_client);

await _client.ConnectAsync();
await _client.ConnectAsync(false);
}

public async Task Disconnect()
Expand All @@ -96,7 +96,7 @@ public async Task AppenAudioBuffer(string message)
public async Task AppenAudioBuffer(ArraySegment<byte> data, int length)
{
var buffer = data.AsSpan(0, length).ToArray();
await _client.SendAudioAsync(buffer);
await _client.SendAudioAsync(buffer,"audio/pcm;rate=16000");
}

public async Task TriggerModelInference(string? instructions = null)
Expand Down Expand Up @@ -285,10 +285,14 @@ await HookEmitter.Emit<IContentGeneratingHook>(_services,
});
}

// if(request.Tools.Count == 0)
// request.Tools = null;
// config.MaxOutputTokens = null;

await _client.SendSetupAsync(new BidiGenerateContentSetup()
{
GenerationConfig = config,
Model = Model,
Model = Model.ToModelId(),
SystemInstruction = request.SystemInstruction,
Tools = request.Tools?.ToArray(),
});
Expand Down
7 changes: 5 additions & 2 deletions tests/BotSharp.Test.RealtimeVoice/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"Models": [
{
"Id": "gemini-2.0",
"Name": "gemini-2.0-flash-exp",
"Name": "gemini-2.0-flash-live-001",
"Version": "20240620",
"ApiKey": "",
"Type": "realtime",
Expand All @@ -48,8 +48,11 @@
},

"RealtimeModel": {
"Provider": "google-ai",
"Model": "gemini-2.0-flash-live-001",
"InputAudioFormat": "pcm16",
"OutputAudioFormat": "pcm16"
"OutputAudioFormat": "pcm16",
"InterruptResponse": false,
},

"PluginLoader": {
Expand Down
Loading