Skip to content

Commit 31d6594

Browse files
authored
Realtime GA (#928)
1 parent 6c230f1 commit 31d6594

File tree

222 files changed

+36098
-21153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+36098
-21153
lines changed

.github/copilot-instructions.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copilot Instructions
2+
3+
## TypeSpec Code Generation
4+
5+
When making changes to TypeSpec files (`.tsp` files), you must regenerate the code by running the following script:
6+
7+
```powershell
8+
./scripts/Invoke-CodeGen.ps1
9+
```
10+
11+
This ensures that any modifications to the TypeSpec definitions are properly reflected in the generated code.
12+
13+
14+
When making Changes to TypeSpec files (`.tsp` files), Do not use type unions and instead use discriminators to ensure that we don't use binary data types when the generation occurs.

Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@
105105
<SignAssembly>false</SignAssembly>
106106
<IsPackable>false</IsPackable>
107107

108+
<!-- SourceLink is not needed for test/example projects -->
109+
<EnableSourceLink>false</EnableSourceLink>
110+
108111
<!--
109112
Reset the base ignores and reset to ignore XML doc comments
110113
on test types and members and experimental APIs.

api/OpenAI.net10.0.cs

Lines changed: 185 additions & 15 deletions
Large diffs are not rendered by default.

api/OpenAI.net8.0.cs

Lines changed: 185 additions & 15 deletions
Large diffs are not rendered by default.

api/OpenAI.netstandard2.0.cs

Lines changed: 172 additions & 15 deletions
Large diffs are not rendered by default.

examples/Realtime/Example01_AudioFromFileWithToolsAsync.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,21 @@ public async Task Example01_AudioFromFileWithToolsAsync()
3030
+ "Prefer to call tools whenever applicable.",
3131
Voice = ConversationVoice.Alloy,
3232
Tools = { CreateSampleWeatherTool() },
33-
InputAudioFormat = RealtimeAudioFormat.Pcm16,
34-
OutputAudioFormat = RealtimeAudioFormat.Pcm16,
35-
// Input transcription options must be provided to enable transcribed feedback for input audio
36-
InputTranscriptionOptions = new()
33+
Audio = new RealtimeSessionAudioConfiguration()
3734
{
38-
Model = "whisper-1",
35+
Input = new RealtimeSessionAudioInputConfiguration()
36+
{
37+
Format = RealtimeAudioFormat.Pcm16,
38+
// Input transcription options must be provided to enable transcribed feedback for input audio
39+
Transcription = new InputTranscriptionOptions()
40+
{
41+
Model = "whisper-1",
42+
},
43+
},
44+
Output = new RealtimeSessionAudioOutputConfiguration()
45+
{
46+
Format = RealtimeAudioFormat.Pcm16,
47+
},
3948
},
4049
};
4150

@@ -95,7 +104,7 @@ await session.AddItemAsync(
95104
{
96105
if (!outputAudioStreamsById.TryGetValue(deltaUpdate.ItemId, out Stream value))
97106
{
98-
string filename = $"output_{sessionOptions.OutputAudioFormat}_{deltaUpdate.ItemId}.raw";
107+
string filename = $"output_{sessionOptions.Audio?.Output?.Format}_{deltaUpdate.ItemId}.raw";
99108
value = File.OpenWrite(filename);
100109
outputAudioStreamsById[deltaUpdate.ItemId] = value;
101110
}

0 commit comments

Comments
 (0)