diff --git a/src/helpers/FixOpenApiSpec/Program.cs b/src/helpers/FixOpenApiSpec/Program.cs
index b841ca79..4162bae7 100644
--- a/src/helpers/FixOpenApiSpec/Program.cs
+++ b/src/helpers/FixOpenApiSpec/Program.cs
@@ -6,6 +6,7 @@
var path = args[0];
var text = await File.ReadAllTextAsync(path);
+var extendedText = await File.ReadAllTextAsync(path.Replace(".yaml", ".extended.yaml"));
text = text.Replace("description: *run_temperature_description", "description: empty");
text = text.Replace("description: &run_temperature_description ", "description: ");
@@ -17,6 +18,12 @@
text = text.Replace("response: &moderation_example |", "response: |");
var openApiDocument = new OpenApiStringReader().Read(text, out var diagnostics);
+var extendedOpenApiDocument = new OpenApiStringReader().Read(extendedText, out var extendedDiagnostics);
+foreach (var schema in extendedOpenApiDocument.Components.Schemas)
+{
+ openApiDocument.Components.Schemas[schema.Key] = schema.Value;
+}
+
openApiDocument.Components.Schemas["ParallelToolCalls"]!.Default = null;
openApiDocument.Components.Schemas["ParallelToolCalls"]!.Nullable = true;
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeAudioFormat.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeAudioFormat.g.cs
new file mode 100644
index 00000000..89f0e407
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeAudioFormat.g.cs
@@ -0,0 +1,49 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeAudioFormatJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeAudioFormat Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeAudioFormatExtensions.ToEnum(stringValue) ?? default;
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeAudioFormat)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeAudioFormat value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ writer.WriteStringValue(global::OpenAI.RealtimeAudioFormatExtensions.ToValueString(value));
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeAudioFormatNullable.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeAudioFormatNullable.g.cs
new file mode 100644
index 00000000..f518b862
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeAudioFormatNullable.g.cs
@@ -0,0 +1,56 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeAudioFormatNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeAudioFormat? Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeAudioFormatExtensions.ToEnum(stringValue);
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeAudioFormat)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeAudioFormat? value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ if (value == null)
+ {
+ writer.WriteNullValue();
+ }
+ else
+ {
+ writer.WriteStringValue(global::OpenAI.RealtimeAudioFormatExtensions.ToValueString(value.Value));
+ }
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseMaxOutputTokens.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseMaxOutputTokens.g.cs
new file mode 100644
index 00000000..956b17f9
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseMaxOutputTokens.g.cs
@@ -0,0 +1,49 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeResponseCreateResponseMaxOutputTokensJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokens Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokensExtensions.ToEnum(stringValue) ?? default;
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokens)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokens value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ writer.WriteStringValue(global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokensExtensions.ToValueString(value));
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseMaxOutputTokensNullable.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseMaxOutputTokensNullable.g.cs
new file mode 100644
index 00000000..e7013d29
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseMaxOutputTokensNullable.g.cs
@@ -0,0 +1,56 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeResponseCreateResponseMaxOutputTokensNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokens? Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokensExtensions.ToEnum(stringValue);
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokens)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokens? value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ if (value == null)
+ {
+ writer.WriteNullValue();
+ }
+ else
+ {
+ writer.WriteStringValue(global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokensExtensions.ToValueString(value.Value));
+ }
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseModalitie.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseModalitie.g.cs
new file mode 100644
index 00000000..0a825da3
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseModalitie.g.cs
@@ -0,0 +1,49 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeResponseCreateResponseModalitieJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeResponseCreateResponseModalitie Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeResponseCreateResponseModalitieExtensions.ToEnum(stringValue) ?? default;
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeResponseCreateResponseModalitie)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeResponseCreateResponseModalitie value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ writer.WriteStringValue(global::OpenAI.RealtimeResponseCreateResponseModalitieExtensions.ToValueString(value));
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseModalitieNullable.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseModalitieNullable.g.cs
new file mode 100644
index 00000000..ea4a6235
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseModalitieNullable.g.cs
@@ -0,0 +1,56 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeResponseCreateResponseModalitieNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeResponseCreateResponseModalitie? Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeResponseCreateResponseModalitieExtensions.ToEnum(stringValue);
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeResponseCreateResponseModalitie)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeResponseCreateResponseModalitie? value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ if (value == null)
+ {
+ writer.WriteNullValue();
+ }
+ else
+ {
+ writer.WriteStringValue(global::OpenAI.RealtimeResponseCreateResponseModalitieExtensions.ToValueString(value.Value));
+ }
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseVoice.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseVoice.g.cs
new file mode 100644
index 00000000..1cfe5c25
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseVoice.g.cs
@@ -0,0 +1,49 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeResponseCreateResponseVoiceJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeResponseCreateResponseVoice Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeResponseCreateResponseVoiceExtensions.ToEnum(stringValue) ?? default;
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeResponseCreateResponseVoice)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeResponseCreateResponseVoice value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ writer.WriteStringValue(global::OpenAI.RealtimeResponseCreateResponseVoiceExtensions.ToValueString(value));
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseVoiceNullable.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseVoiceNullable.g.cs
new file mode 100644
index 00000000..7c947cca
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateResponseVoiceNullable.g.cs
@@ -0,0 +1,56 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeResponseCreateResponseVoiceNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeResponseCreateResponseVoice? Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeResponseCreateResponseVoiceExtensions.ToEnum(stringValue);
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeResponseCreateResponseVoice)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeResponseCreateResponseVoice? value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ if (value == null)
+ {
+ writer.WriteNullValue();
+ }
+ else
+ {
+ writer.WriteStringValue(global::OpenAI.RealtimeResponseCreateResponseVoiceExtensions.ToValueString(value.Value));
+ }
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateType.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateType.g.cs
new file mode 100644
index 00000000..063eeb03
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateType.g.cs
@@ -0,0 +1,49 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeResponseCreateTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeResponseCreateType Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeResponseCreateTypeExtensions.ToEnum(stringValue) ?? default;
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeResponseCreateType)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeResponseCreateType value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ writer.WriteStringValue(global::OpenAI.RealtimeResponseCreateTypeExtensions.ToValueString(value));
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateTypeNullable.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateTypeNullable.g.cs
new file mode 100644
index 00000000..4c62e7e2
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeResponseCreateTypeNullable.g.cs
@@ -0,0 +1,56 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeResponseCreateTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeResponseCreateType? Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeResponseCreateTypeExtensions.ToEnum(stringValue);
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeResponseCreateType)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeResponseCreateType? value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ if (value == null)
+ {
+ writer.WriteNullValue();
+ }
+ else
+ {
+ writer.WriteStringValue(global::OpenAI.RealtimeResponseCreateTypeExtensions.ToValueString(value.Value));
+ }
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeServerEventType.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeServerEventType.g.cs
new file mode 100644
index 00000000..976e8dbc
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeServerEventType.g.cs
@@ -0,0 +1,49 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeServerEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeServerEventType Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeServerEventTypeExtensions.ToEnum(stringValue) ?? default;
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeServerEventType)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeServerEventType value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ writer.WriteStringValue(global::OpenAI.RealtimeServerEventTypeExtensions.ToValueString(value));
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonConverters.RealtimeServerEventTypeNullable.g.cs b/src/libs/OpenAI/Generated/JsonConverters.RealtimeServerEventTypeNullable.g.cs
new file mode 100644
index 00000000..b0ff62f4
--- /dev/null
+++ b/src/libs/OpenAI/Generated/JsonConverters.RealtimeServerEventTypeNullable.g.cs
@@ -0,0 +1,56 @@
+#nullable enable
+
+namespace OpenAI.JsonConverters
+{
+ ///
+ public sealed class RealtimeServerEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
+ {
+ ///
+ public override global::OpenAI.RealtimeServerEventType? Read(
+ ref global::System.Text.Json.Utf8JsonReader reader,
+ global::System.Type typeToConvert,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case global::System.Text.Json.JsonTokenType.String:
+ {
+ var stringValue = reader.GetString();
+ if (stringValue != null)
+ {
+ return global::OpenAI.RealtimeServerEventTypeExtensions.ToEnum(stringValue);
+ }
+
+ break;
+ }
+ case global::System.Text.Json.JsonTokenType.Number:
+ {
+ var numValue = reader.GetInt32();
+ return (global::OpenAI.RealtimeServerEventType)numValue;
+ }
+ default:
+ throw new global::System.ArgumentOutOfRangeException(nameof(reader));
+ }
+
+ return default;
+ }
+
+ ///
+ public override void Write(
+ global::System.Text.Json.Utf8JsonWriter writer,
+ global::OpenAI.RealtimeServerEventType? value,
+ global::System.Text.Json.JsonSerializerOptions options)
+ {
+ writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
+
+ if (value == null)
+ {
+ writer.WriteNullValue();
+ }
+ else
+ {
+ writer.WriteStringValue(global::OpenAI.RealtimeServerEventTypeExtensions.ToValueString(value.Value));
+ }
+ }
+ }
+}
diff --git a/src/libs/OpenAI/Generated/JsonSerializerContext.g.cs b/src/libs/OpenAI/Generated/JsonSerializerContext.g.cs
index d24f9cd8..46712c26 100644
--- a/src/libs/OpenAI/Generated/JsonSerializerContext.g.cs
+++ b/src/libs/OpenAI/Generated/JsonSerializerContext.g.cs
@@ -511,6 +511,18 @@ namespace OpenAI
typeof(global::OpenAI.JsonConverters.ProjectApiKeyListResponseObjectNullableJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectApiKeyDeleteResponseObjectJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectApiKeyDeleteResponseObjectNullableJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeServerEventTypeJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeServerEventTypeNullableJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeAudioFormatJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeAudioFormatNullableJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateTypeJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateTypeNullableJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateResponseModalitieJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateResponseModalitieNullableJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateResponseVoiceJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateResponseVoiceNullableJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateResponseMaxOutputTokensJsonConverter),
+ typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateResponseMaxOutputTokensNullableJsonConverter),
typeof(global::OpenAI.JsonConverters.CreateBatchRequestEndpointJsonConverter),
typeof(global::OpenAI.JsonConverters.CreateBatchRequestEndpointNullableJsonConverter),
typeof(global::OpenAI.JsonConverters.CreateBatchRequestCompletionWindowJsonConverter),
diff --git a/src/libs/OpenAI/Generated/JsonSerializerContextTypes.g.cs b/src/libs/OpenAI/Generated/JsonSerializerContextTypes.g.cs
index 034685bc..ff4ccf9e 100644
--- a/src/libs/OpenAI/Generated/JsonSerializerContextTypes.g.cs
+++ b/src/libs/OpenAI/Generated/JsonSerializerContextTypes.g.cs
@@ -3054,94 +3054,138 @@ public sealed partial class JsonSerializerContextTypes
///
///
///
- public global::OpenAI.CreateBatchRequest? Type759 { get; set; }
+ public global::OpenAI.RealtimeServerEvent? Type759 { get; set; }
///
///
///
- public global::OpenAI.CreateBatchRequestEndpoint? Type760 { get; set; }
+ public global::OpenAI.RealtimeServerEventType? Type760 { get; set; }
///
///
///
- public global::OpenAI.CreateBatchRequestCompletionWindow? Type761 { get; set; }
+ public global::OpenAI.RealtimeAudioFormat? Type761 { get; set; }
///
///
///
- public global::System.Collections.Generic.Dictionary? Type762 { get; set; }
+ public global::OpenAI.RealtimeResponseCreate? Type762 { get; set; }
///
///
///
- public global::OpenAI.ListAssistantsOrder? Type763 { get; set; }
+ public global::OpenAI.RealtimeResponseCreateType? Type763 { get; set; }
///
///
///
- public global::OpenAI.ListMessagesOrder? Type764 { get; set; }
+ public global::OpenAI.RealtimeResponseCreateResponse? Type764 { get; set; }
///
///
///
- public global::OpenAI.ListRunsOrder? Type765 { get; set; }
+ public global::System.Collections.Generic.IList? Type765 { get; set; }
///
///
///
- public global::System.Collections.Generic.IList? Type766 { get; set; }
+ public global::OpenAI.RealtimeResponseCreateResponseModalitie? Type766 { get; set; }
///
///
///
- public global::OpenAI.CreateRunIncludeItem? Type767 { get; set; }
+ public global::OpenAI.RealtimeResponseCreateResponseVoice? Type767 { get; set; }
///
///
///
- public global::OpenAI.ListRunStepsOrder? Type768 { get; set; }
+ public global::OpenAI.OneOf? Type768 { get; set; }
///
///
///
- public global::System.Collections.Generic.IList? Type769 { get; set; }
+ public global::OpenAI.RealtimeResponseCreateResponseMaxOutputTokens? Type769 { get; set; }
///
///
///
- public global::OpenAI.ListRunStepsIncludeItem? Type770 { get; set; }
+ public global::OpenAI.CreateBatchRequest? Type770 { get; set; }
///
///
///
- public global::System.Collections.Generic.IList? Type771 { get; set; }
+ public global::OpenAI.CreateBatchRequestEndpoint? Type771 { get; set; }
///
///
///
- public global::OpenAI.GetRunStepIncludeItem? Type772 { get; set; }
+ public global::OpenAI.CreateBatchRequestCompletionWindow? Type772 { get; set; }
///
///
///
- public global::OpenAI.ListVectorStoresOrder? Type773 { get; set; }
+ public global::System.Collections.Generic.Dictionary? Type773 { get; set; }
///
///
///
- public global::OpenAI.ListVectorStoreFilesOrder? Type774 { get; set; }
+ public global::OpenAI.ListAssistantsOrder? Type774 { get; set; }
///
///
///
- public global::OpenAI.ListVectorStoreFilesFilter? Type775 { get; set; }
+ public global::OpenAI.ListMessagesOrder? Type775 { get; set; }
///
///
///
- public global::OpenAI.ListFilesInVectorStoreBatchOrder? Type776 { get; set; }
+ public global::OpenAI.ListRunsOrder? Type776 { get; set; }
///
///
///
- public global::OpenAI.ListFilesInVectorStoreBatchFilter? Type777 { get; set; }
+ public global::System.Collections.Generic.IList? Type777 { get; set; }
///
///
///
- public global::OpenAI.ListAuditLogsEffectiveAt? Type778 { get; set; }
+ public global::OpenAI.CreateRunIncludeItem? Type778 { get; set; }
///
///
///
- public global::System.Collections.Generic.IList? Type779 { get; set; }
+ public global::OpenAI.ListRunStepsOrder? Type779 { get; set; }
///
///
///
- public global::OpenAI.OneOf? Type780 { get; set; }
+ public global::System.Collections.Generic.IList? Type780 { get; set; }
///
///
///
- public global::OpenAI.OneOf? Type781 { get; set; }
+ public global::OpenAI.ListRunStepsIncludeItem? Type781 { get; set; }
+ ///
+ ///
+ ///
+ public global::System.Collections.Generic.IList? Type782 { get; set; }
+ ///
+ ///
+ ///
+ public global::OpenAI.GetRunStepIncludeItem? Type783 { get; set; }
+ ///
+ ///
+ ///
+ public global::OpenAI.ListVectorStoresOrder? Type784 { get; set; }
+ ///
+ ///
+ ///
+ public global::OpenAI.ListVectorStoreFilesOrder? Type785 { get; set; }
+ ///
+ ///
+ ///
+ public global::OpenAI.ListVectorStoreFilesFilter? Type786 { get; set; }
+ ///
+ ///
+ ///
+ public global::OpenAI.ListFilesInVectorStoreBatchOrder? Type787 { get; set; }
+ ///
+ ///
+ ///
+ public global::OpenAI.ListFilesInVectorStoreBatchFilter? Type788 { get; set; }
+ ///
+ ///
+ ///
+ public global::OpenAI.ListAuditLogsEffectiveAt? Type789 { get; set; }
+ ///
+ ///
+ ///
+ public global::System.Collections.Generic.IList? Type790 { get; set; }
+ ///
+ ///
+ ///
+ public global::OpenAI.OneOf? Type791 { get; set; }
+ ///
+ ///
+ ///
+ public global::OpenAI.OneOf? Type792 { get; set; }
}
}
\ No newline at end of file
diff --git a/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeAudioFormat.g.cs b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeAudioFormat.g.cs
new file mode 100644
index 00000000..a8fe6863
--- /dev/null
+++ b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeAudioFormat.g.cs
@@ -0,0 +1,57 @@
+
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ ///
+ ///
+ public enum RealtimeAudioFormat
+ {
+ ///
+ ///
+ ///
+ Pcm16,
+ ///
+ ///
+ ///
+ G711Ulaw,
+ ///
+ ///
+ ///
+ G711Alaw,
+ }
+
+ ///
+ /// Enum extensions to do fast conversions without the reflection.
+ ///
+ public static class RealtimeAudioFormatExtensions
+ {
+ ///
+ /// Converts an enum to a string.
+ ///
+ public static string ToValueString(this RealtimeAudioFormat value)
+ {
+ return value switch
+ {
+ RealtimeAudioFormat.Pcm16 => "pcm16",
+ RealtimeAudioFormat.G711Ulaw => "g711_ulaw",
+ RealtimeAudioFormat.G711Alaw => "g711_alaw",
+ _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
+ };
+ }
+ ///
+ /// Converts an string to a enum.
+ ///
+ public static RealtimeAudioFormat? ToEnum(string value)
+ {
+ return value switch
+ {
+ "pcm16" => RealtimeAudioFormat.Pcm16,
+ "g711_ulaw" => RealtimeAudioFormat.G711Ulaw,
+ "g711_alaw" => RealtimeAudioFormat.G711Alaw,
+ _ => null,
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreate.g.cs b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreate.g.cs
new file mode 100644
index 00000000..b3da2260
--- /dev/null
+++ b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreate.g.cs
@@ -0,0 +1,36 @@
+
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ ///
+ ///
+ public sealed partial class RealtimeResponseCreate
+ {
+ ///
+ /// Optional client-generated ID used to identify this event.
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("event_id")]
+ public string? EventId { get; set; }
+
+ ///
+ /// The event type, must be 'response.create'.
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("type")]
+ [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateTypeJsonConverter))]
+ public global::OpenAI.RealtimeResponseCreateType? Type { get; set; }
+
+ ///
+ ///
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("response")]
+ public global::OpenAI.RealtimeResponseCreateResponse? Response { get; set; }
+
+ ///
+ /// Additional properties that are not explicitly defined in the schema
+ ///
+ [global::System.Text.Json.Serialization.JsonExtensionData]
+ public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary();
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponse.g.cs b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponse.g.cs
new file mode 100644
index 00000000..6b1887e0
--- /dev/null
+++ b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponse.g.cs
@@ -0,0 +1,58 @@
+
+#pragma warning disable CS0618 // Type or member is obsolete
+
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ ///
+ ///
+ public sealed partial class RealtimeResponseCreateResponse
+ {
+ ///
+ /// The modalities for the response.
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("modalities")]
+ public global::System.Collections.Generic.IList? Modalities { get; set; }
+
+ ///
+ /// Instructions for the model.
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("instructions")]
+ public string? Instructions { get; set; }
+
+ ///
+ /// The voice the model uses to respond.
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("voice")]
+ [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenAI.JsonConverters.RealtimeResponseCreateResponseVoiceJsonConverter))]
+ public global::OpenAI.RealtimeResponseCreateResponseVoice? Voice { get; set; }
+
+ ///
+ ///
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("output_audio_format")]
+ [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenAI.JsonConverters.RealtimeAudioFormatJsonConverter))]
+ public global::OpenAI.RealtimeAudioFormat? OutputAudioFormat { get; set; }
+
+ ///
+ /// Sampling temperature.
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("temperature")]
+ public double? Temperature { get; set; }
+
+ ///
+ /// Maximum number of output tokens, or "inf" for unlimited. Defaults to "inf".
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("max_output_tokens")]
+ [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenAI.JsonConverters.OneOfJsonConverterFactory2))]
+ public global::OpenAI.OneOf? MaxOutputTokens { get; set; }
+
+ ///
+ /// Additional properties that are not explicitly defined in the schema
+ ///
+ [global::System.Text.Json.Serialization.JsonExtensionData]
+ public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary();
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponseMaxOutputTokens.g.cs b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponseMaxOutputTokens.g.cs
new file mode 100644
index 00000000..38d9aee0
--- /dev/null
+++ b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponseMaxOutputTokens.g.cs
@@ -0,0 +1,45 @@
+
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ ///
+ ///
+ public enum RealtimeResponseCreateResponseMaxOutputTokens
+ {
+ ///
+ ///
+ ///
+ Inf,
+ }
+
+ ///
+ /// Enum extensions to do fast conversions without the reflection.
+ ///
+ public static class RealtimeResponseCreateResponseMaxOutputTokensExtensions
+ {
+ ///
+ /// Converts an enum to a string.
+ ///
+ public static string ToValueString(this RealtimeResponseCreateResponseMaxOutputTokens value)
+ {
+ return value switch
+ {
+ RealtimeResponseCreateResponseMaxOutputTokens.Inf => "inf",
+ _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
+ };
+ }
+ ///
+ /// Converts an string to a enum.
+ ///
+ public static RealtimeResponseCreateResponseMaxOutputTokens? ToEnum(string value)
+ {
+ return value switch
+ {
+ "inf" => RealtimeResponseCreateResponseMaxOutputTokens.Inf,
+ _ => null,
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponseModalitie.g.cs b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponseModalitie.g.cs
new file mode 100644
index 00000000..465e888a
--- /dev/null
+++ b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponseModalitie.g.cs
@@ -0,0 +1,51 @@
+
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ ///
+ ///
+ public enum RealtimeResponseCreateResponseModalitie
+ {
+ ///
+ ///
+ ///
+ Text,
+ ///
+ ///
+ ///
+ Audio,
+ }
+
+ ///
+ /// Enum extensions to do fast conversions without the reflection.
+ ///
+ public static class RealtimeResponseCreateResponseModalitieExtensions
+ {
+ ///
+ /// Converts an enum to a string.
+ ///
+ public static string ToValueString(this RealtimeResponseCreateResponseModalitie value)
+ {
+ return value switch
+ {
+ RealtimeResponseCreateResponseModalitie.Text => "text",
+ RealtimeResponseCreateResponseModalitie.Audio => "audio",
+ _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
+ };
+ }
+ ///
+ /// Converts an string to a enum.
+ ///
+ public static RealtimeResponseCreateResponseModalitie? ToEnum(string value)
+ {
+ return value switch
+ {
+ "text" => RealtimeResponseCreateResponseModalitie.Text,
+ "audio" => RealtimeResponseCreateResponseModalitie.Audio,
+ _ => null,
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponseVoice.g.cs b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponseVoice.g.cs
new file mode 100644
index 00000000..2314eb35
--- /dev/null
+++ b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateResponseVoice.g.cs
@@ -0,0 +1,57 @@
+
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ /// The voice the model uses to respond.
+ ///
+ public enum RealtimeResponseCreateResponseVoice
+ {
+ ///
+ ///
+ ///
+ Alloy,
+ ///
+ ///
+ ///
+ Echo,
+ ///
+ ///
+ ///
+ Shimmer,
+ }
+
+ ///
+ /// Enum extensions to do fast conversions without the reflection.
+ ///
+ public static class RealtimeResponseCreateResponseVoiceExtensions
+ {
+ ///
+ /// Converts an enum to a string.
+ ///
+ public static string ToValueString(this RealtimeResponseCreateResponseVoice value)
+ {
+ return value switch
+ {
+ RealtimeResponseCreateResponseVoice.Alloy => "alloy",
+ RealtimeResponseCreateResponseVoice.Echo => "echo",
+ RealtimeResponseCreateResponseVoice.Shimmer => "shimmer",
+ _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
+ };
+ }
+ ///
+ /// Converts an string to a enum.
+ ///
+ public static RealtimeResponseCreateResponseVoice? ToEnum(string value)
+ {
+ return value switch
+ {
+ "alloy" => RealtimeResponseCreateResponseVoice.Alloy,
+ "echo" => RealtimeResponseCreateResponseVoice.Echo,
+ "shimmer" => RealtimeResponseCreateResponseVoice.Shimmer,
+ _ => null,
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateType.g.cs b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateType.g.cs
new file mode 100644
index 00000000..4ce28963
--- /dev/null
+++ b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeResponseCreateType.g.cs
@@ -0,0 +1,45 @@
+
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ /// The event type, must be 'response.create'.
+ ///
+ public enum RealtimeResponseCreateType
+ {
+ ///
+ ///
+ ///
+ ResponseCreate,
+ }
+
+ ///
+ /// Enum extensions to do fast conversions without the reflection.
+ ///
+ public static class RealtimeResponseCreateTypeExtensions
+ {
+ ///
+ /// Converts an enum to a string.
+ ///
+ public static string ToValueString(this RealtimeResponseCreateType value)
+ {
+ return value switch
+ {
+ RealtimeResponseCreateType.ResponseCreate => "response.create",
+ _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
+ };
+ }
+ ///
+ /// Converts an string to a enum.
+ ///
+ public static RealtimeResponseCreateType? ToEnum(string value)
+ {
+ return value switch
+ {
+ "response.create" => RealtimeResponseCreateType.ResponseCreate,
+ _ => null,
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeServerEvent.g.cs b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeServerEvent.g.cs
new file mode 100644
index 00000000..8747ac31
--- /dev/null
+++ b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeServerEvent.g.cs
@@ -0,0 +1,32 @@
+
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ ///
+ ///
+ public sealed partial class RealtimeServerEvent
+ {
+ ///
+ ///
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("event_id")]
+ [global::System.Text.Json.Serialization.JsonRequired]
+ public required string EventId { get; set; }
+
+ ///
+ ///
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("type")]
+ [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenAI.JsonConverters.RealtimeServerEventTypeJsonConverter))]
+ [global::System.Text.Json.Serialization.JsonRequired]
+ public required global::OpenAI.RealtimeServerEventType Type { get; set; }
+
+ ///
+ /// Additional properties that are not explicitly defined in the schema
+ ///
+ [global::System.Text.Json.Serialization.JsonExtensionData]
+ public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary();
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeServerEventType.g.cs b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeServerEventType.g.cs
new file mode 100644
index 00000000..0d8dc45e
--- /dev/null
+++ b/src/libs/OpenAI/Generated/OpenAI.Models.RealtimeServerEventType.g.cs
@@ -0,0 +1,207 @@
+
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ ///
+ ///
+ public enum RealtimeServerEventType
+ {
+ ///
+ ///
+ ///
+ Error,
+ ///
+ ///
+ ///
+ SessionCreated,
+ ///
+ ///
+ ///
+ SessionUpdated,
+ ///
+ ///
+ ///
+ ConversationCreated,
+ ///
+ ///
+ ///
+ InputAudioBufferCommitted,
+ ///
+ ///
+ ///
+ InputAudioBufferCleared,
+ ///
+ ///
+ ///
+ InputAudioBufferSpeechStarted,
+ ///
+ ///
+ ///
+ InputAudioBufferSpeechStopped,
+ ///
+ ///
+ ///
+ ConversationItemCreated,
+ ///
+ ///
+ ///
+ ConversationItemInputAudioTranscriptionCompleted,
+ ///
+ ///
+ ///
+ ConversationItemInputAudioTranscriptionFailed,
+ ///
+ ///
+ ///
+ ConversationItemTruncated,
+ ///
+ ///
+ ///
+ ConversationItemDeleted,
+ ///
+ ///
+ ///
+ ResponseCreated,
+ ///
+ ///
+ ///
+ ResponseDone,
+ ///
+ ///
+ ///
+ ResponseOutputItemAdded,
+ ///
+ ///
+ ///
+ ResponseOutputItemDone,
+ ///
+ ///
+ ///
+ ResponseContentPartAdded,
+ ///
+ ///
+ ///
+ ResponseContentPartDone,
+ ///
+ ///
+ ///
+ ResponseTextDelta,
+ ///
+ ///
+ ///
+ ResponseTextDone,
+ ///
+ ///
+ ///
+ ResponseAudioTranscriptDelta,
+ ///
+ ///
+ ///
+ ResponseAudioTranscriptDone,
+ ///
+ ///
+ ///
+ ResponseAudioDelta,
+ ///
+ ///
+ ///
+ ResponseAudioDone,
+ ///
+ ///
+ ///
+ ResponseFunctionCallArgumentsDelta,
+ ///
+ ///
+ ///
+ ResponseFunctionCallArgumentsDone,
+ ///
+ ///
+ ///
+ RateLimitsUpdated,
+ }
+
+ ///
+ /// Enum extensions to do fast conversions without the reflection.
+ ///
+ public static class RealtimeServerEventTypeExtensions
+ {
+ ///
+ /// Converts an enum to a string.
+ ///
+ public static string ToValueString(this RealtimeServerEventType value)
+ {
+ return value switch
+ {
+ RealtimeServerEventType.Error => "error",
+ RealtimeServerEventType.SessionCreated => "session.created",
+ RealtimeServerEventType.SessionUpdated => "session.updated",
+ RealtimeServerEventType.ConversationCreated => "conversation.created",
+ RealtimeServerEventType.InputAudioBufferCommitted => "input_audio_buffer.committed",
+ RealtimeServerEventType.InputAudioBufferCleared => "input_audio_buffer.cleared",
+ RealtimeServerEventType.InputAudioBufferSpeechStarted => "input_audio_buffer.speech_started",
+ RealtimeServerEventType.InputAudioBufferSpeechStopped => "input_audio_buffer.speech_stopped",
+ RealtimeServerEventType.ConversationItemCreated => "conversation.item.created",
+ RealtimeServerEventType.ConversationItemInputAudioTranscriptionCompleted => "conversation.item.input_audio_transcription.completed",
+ RealtimeServerEventType.ConversationItemInputAudioTranscriptionFailed => "conversation.item.input_audio_transcription.failed",
+ RealtimeServerEventType.ConversationItemTruncated => "conversation.item.truncated",
+ RealtimeServerEventType.ConversationItemDeleted => "conversation.item.deleted",
+ RealtimeServerEventType.ResponseCreated => "response.created",
+ RealtimeServerEventType.ResponseDone => "response.done",
+ RealtimeServerEventType.ResponseOutputItemAdded => "response.output_item.added",
+ RealtimeServerEventType.ResponseOutputItemDone => "response.output_item.done",
+ RealtimeServerEventType.ResponseContentPartAdded => "response.content_part.added",
+ RealtimeServerEventType.ResponseContentPartDone => "response.content_part.done",
+ RealtimeServerEventType.ResponseTextDelta => "response.text.delta",
+ RealtimeServerEventType.ResponseTextDone => "response.text.done",
+ RealtimeServerEventType.ResponseAudioTranscriptDelta => "response.audio_transcript.delta",
+ RealtimeServerEventType.ResponseAudioTranscriptDone => "response.audio_transcript.done",
+ RealtimeServerEventType.ResponseAudioDelta => "response.audio.delta",
+ RealtimeServerEventType.ResponseAudioDone => "response.audio.done",
+ RealtimeServerEventType.ResponseFunctionCallArgumentsDelta => "response.function_call_arguments.delta",
+ RealtimeServerEventType.ResponseFunctionCallArgumentsDone => "response.function_call_arguments.done",
+ RealtimeServerEventType.RateLimitsUpdated => "rate_limits.updated",
+ _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
+ };
+ }
+ ///
+ /// Converts an string to a enum.
+ ///
+ public static RealtimeServerEventType? ToEnum(string value)
+ {
+ return value switch
+ {
+ "error" => RealtimeServerEventType.Error,
+ "session.created" => RealtimeServerEventType.SessionCreated,
+ "session.updated" => RealtimeServerEventType.SessionUpdated,
+ "conversation.created" => RealtimeServerEventType.ConversationCreated,
+ "input_audio_buffer.committed" => RealtimeServerEventType.InputAudioBufferCommitted,
+ "input_audio_buffer.cleared" => RealtimeServerEventType.InputAudioBufferCleared,
+ "input_audio_buffer.speech_started" => RealtimeServerEventType.InputAudioBufferSpeechStarted,
+ "input_audio_buffer.speech_stopped" => RealtimeServerEventType.InputAudioBufferSpeechStopped,
+ "conversation.item.created" => RealtimeServerEventType.ConversationItemCreated,
+ "conversation.item.input_audio_transcription.completed" => RealtimeServerEventType.ConversationItemInputAudioTranscriptionCompleted,
+ "conversation.item.input_audio_transcription.failed" => RealtimeServerEventType.ConversationItemInputAudioTranscriptionFailed,
+ "conversation.item.truncated" => RealtimeServerEventType.ConversationItemTruncated,
+ "conversation.item.deleted" => RealtimeServerEventType.ConversationItemDeleted,
+ "response.created" => RealtimeServerEventType.ResponseCreated,
+ "response.done" => RealtimeServerEventType.ResponseDone,
+ "response.output_item.added" => RealtimeServerEventType.ResponseOutputItemAdded,
+ "response.output_item.done" => RealtimeServerEventType.ResponseOutputItemDone,
+ "response.content_part.added" => RealtimeServerEventType.ResponseContentPartAdded,
+ "response.content_part.done" => RealtimeServerEventType.ResponseContentPartDone,
+ "response.text.delta" => RealtimeServerEventType.ResponseTextDelta,
+ "response.text.done" => RealtimeServerEventType.ResponseTextDone,
+ "response.audio_transcript.delta" => RealtimeServerEventType.ResponseAudioTranscriptDelta,
+ "response.audio_transcript.done" => RealtimeServerEventType.ResponseAudioTranscriptDone,
+ "response.audio.delta" => RealtimeServerEventType.ResponseAudioDelta,
+ "response.audio.done" => RealtimeServerEventType.ResponseAudioDone,
+ "response.function_call_arguments.delta" => RealtimeServerEventType.ResponseFunctionCallArgumentsDelta,
+ "response.function_call_arguments.done" => RealtimeServerEventType.ResponseFunctionCallArgumentsDone,
+ "rate_limits.updated" => RealtimeServerEventType.RateLimitsUpdated,
+ _ => null,
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/JsonSerializerContextTypes.AdditionalTypes.cs b/src/libs/OpenAI/JsonSerializerContextTypes.AdditionalTypes.cs
index b4974d12..29b28df1 100644
--- a/src/libs/OpenAI/JsonSerializerContextTypes.AdditionalTypes.cs
+++ b/src/libs/OpenAI/JsonSerializerContextTypes.AdditionalTypes.cs
@@ -11,4 +11,9 @@ public sealed partial class JsonSerializerContextTypes
///
///
public CreateChatCompletionStreamResponse? CreateChatCompletionStreamResponse { get; set; }
+
+ ///
+ ///
+ ///
+ public CSharpToJsonSchema.OpenApiSchema? OpenApiSchema { get; set; }
}
\ No newline at end of file
diff --git a/src/libs/OpenAI/RealtimeConversationClient.Generated.cs b/src/libs/OpenAI/RealtimeConversationClient.Generated.cs
new file mode 100755
index 00000000..5f7460cb
--- /dev/null
+++ b/src/libs/OpenAI/RealtimeConversationClient.Generated.cs
@@ -0,0 +1,128 @@
+#nullable enable
+
+namespace OpenAI
+{
+ ///
+ ///
+ ///
+ public sealed partial class RealtimeConversationClient : global::System.IDisposable
+ {
+ ///
+ ///
+ ///
+ public const string BaseUrl = "wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-10-01";
+
+ private readonly global::System.Net.WebSockets.ClientWebSocket _clientWebSocket;
+
+ ///
+ ///
+ ///
+ public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::OpenAI.SourceGenerationContext.Default;
+
+ ///
+ ///
+ ///
+ public bool IsConnected => _clientWebSocket.State == global::System.Net.WebSockets.WebSocketState.Open;
+
+ ///
+ /// Creates a new instance of the AssistantsClient.
+ /// If no clientWebSocket is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from AsyncAPI spec will be used.
+ ///
+ ///
+ public RealtimeConversationClient(
+ global::System.Net.WebSockets.ClientWebSocket? clientWebSocket = null)
+ {
+ _clientWebSocket = clientWebSocket ?? new global::System.Net.WebSockets.ClientWebSocket();
+
+ Initialized(_clientWebSocket);
+ }
+
+ ///
+ /// Authorize using bearer authentication.
+ ///
+ ///
+ public void AuthorizeUsingBearer(
+ string apiKey)
+ {
+ apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey));
+
+ _clientWebSocket.Options.SetRequestHeader("Authorization", $"Bearer {apiKey}");
+ }
+
+ ///
+ public RealtimeConversationClient(
+ string apiKey,
+ global::System.Net.WebSockets.ClientWebSocket? clientWebSocket = null) : this(clientWebSocket)
+ {
+ Authorizing(_clientWebSocket, ref apiKey);
+
+ AuthorizeUsingBearer(apiKey);
+
+ Authorized(_clientWebSocket);
+ }
+
+ partial void Authorizing(
+ global::System.Net.WebSockets.ClientWebSocket client,
+ ref string apiKey);
+ partial void Authorized(
+ global::System.Net.WebSockets.ClientWebSocket client);
+
+ ///
+ public void Dispose()
+ {
+ _clientWebSocket.Dispose();
+ }
+
+ partial void Initialized(
+ global::System.Net.WebSockets.ClientWebSocket client);
+ partial void PrepareArguments(
+ global::System.Net.WebSockets.ClientWebSocket client);
+ partial void PrepareRequest(
+ global::System.Net.WebSockets.ClientWebSocket client,
+ global::System.Net.Http.HttpRequestMessage request);
+ partial void ProcessResponse(
+ global::System.Net.WebSockets.ClientWebSocket client,
+ global::System.Net.Http.HttpResponseMessage response);
+ partial void ProcessResponseContent(
+ global::System.Net.WebSockets.ClientWebSocket client,
+ global::System.Net.Http.HttpResponseMessage response,
+ ref string content);
+
+ ///
+ public async Task ConnectAsync(
+ global::System.Uri? uri = null,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ uri ??= new Uri(BaseUrl);
+
+ await _clientWebSocket.ConnectAsync(uri, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ public async Task SendAsync(
+ global::System.ArraySegment bytes,
+ global::System.Net.WebSockets.WebSocketMessageType messageType,
+ bool endOfMessage,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ await _clientWebSocket.SendAsync(
+ bytes,
+ messageType,
+ endOfMessage,
+ cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ public async Task SendAsync(
+ string text,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ await _clientWebSocket.SendAsync(
+ buffer: new global::System.ArraySegment(global::System.Text.Encoding.UTF8.GetBytes(text)),
+ messageType: global::System.Net.WebSockets.WebSocketMessageType.Text,
+ endOfMessage: true,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+ }
+}
diff --git a/src/libs/OpenAI/RealtimeConversationClient.cs b/src/libs/OpenAI/RealtimeConversationClient.cs
new file mode 100755
index 00000000..d4ce7471
--- /dev/null
+++ b/src/libs/OpenAI/RealtimeConversationClient.cs
@@ -0,0 +1,89 @@
+using System.Net.WebSockets;
+using System.Runtime.CompilerServices;
+
+namespace OpenAI;
+
+public partial class RealtimeConversationClient
+{
+ partial void Authorized(
+ global::System.Net.WebSockets.ClientWebSocket client)
+ {
+ client.Options.SetRequestHeader("OpenAI-Beta", "realtime=v1");
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task CreateResponseAsync(RealtimeResponseCreate request, CancellationToken cancellationToken = default)
+ {
+ if (!IsConnected)
+ {
+ await ConnectAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+
+ var json = global::System.Text.Json.JsonSerializer.Serialize(
+ request,
+ typeof(global::OpenAI.RealtimeResponseCreate),
+ JsonSerializerContext);
+
+ await _clientWebSocket.SendAsync(
+ buffer: new ArraySegment(global::System.Text.Encoding.UTF8.GetBytes(json)),
+ messageType: WebSocketMessageType.Text,
+ endOfMessage: true,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async IAsyncEnumerable ReceiveUpdatesAsync(
+ [EnumeratorCancellation] CancellationToken cancellationToken = default)
+ {
+ if (!IsConnected)
+ {
+ await ConnectAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+
+ var buffer = new byte[1024 * 1024]; // 1MB buffer size
+ var arraySegment = new ArraySegment(buffer);
+
+ while (_clientWebSocket.State == WebSocketState.Open)
+ {
+ WebSocketReceiveResult result;
+
+ try
+ {
+ result = await _clientWebSocket.ReceiveAsync(arraySegment, cancellationToken).ConfigureAwait(false);
+ }
+ catch (WebSocketException wex)
+ {
+ Console.WriteLine($"WebSocket error: {wex.Message}");
+ yield break;
+ }
+
+ if (result.MessageType == WebSocketMessageType.Text)
+ {
+ string receivedMessage = global::System.Text.Encoding.UTF8.GetString(buffer, 0, result.Count);
+ var @event = global::System.Text.Json.JsonSerializer.Deserialize(
+ receivedMessage,
+ typeof(global::OpenAI.RealtimeServerEvent),
+ JsonSerializerContext) as global::OpenAI.RealtimeServerEvent ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{receivedMessage}\" ");
+
+ yield return @event;
+ }
+ else if (result.MessageType == WebSocketMessageType.Close)
+ {
+ await _clientWebSocket.CloseAsync(
+ closeStatus: WebSocketCloseStatus.NormalClosure,
+ statusDescription: "Closing",
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+ yield break;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/OpenAI/asyncapi.yml b/src/libs/OpenAI/asyncapi.yml
new file mode 100644
index 00000000..6d37d714
--- /dev/null
+++ b/src/libs/OpenAI/asyncapi.yml
@@ -0,0 +1,20 @@
+asyncapi: '3.0.0'
+info:
+ title: an AsyncAPI document for OpenAI
+ version: '1.0.0'
+
+servers:
+ production:
+ host: api.openai.com
+ pathname: v1/realtime?model=gpt-4o-realtime-preview-2024-10-01
+ protocol: wss
+ description: Slack's server in Socket Mode for real-time communication
+ security:
+ - $ref: '#/components/securitySchemes/bearer'
+
+components:
+ securitySchemes:
+ bearerAuth:
+ type: http
+ scheme: bearer
+ bearerFormat: JWT
diff --git a/src/libs/OpenAI/openapi.extended.yaml b/src/libs/OpenAI/openapi.extended.yaml
new file mode 100644
index 00000000..68dd4238
--- /dev/null
+++ b/src/libs/OpenAI/openapi.extended.yaml
@@ -0,0 +1,132 @@
+openapi: 3.0.1
+info:
+ title: OpenAI API
+ description: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
+ termsOfService: https://openai.com/policies/terms-of-use
+ contact:
+ name: OpenAI Support
+ url: https://help.openai.com/
+ license:
+ name: MIT
+ url: https://github.com/openai/openai-openapi/blob/master/LICENSE
+ version: '2.3.0'
+servers:
+ - url: https://api.openai.com/v1
+paths:
+ /chat/completions:
+ post:
+ tags:
+ - Chat
+ summary: Creates a model response for the given chat conversation.
+ operationId: createChatCompletion
+ responses:
+ '200':
+ description: OK
+components:
+ schemas:
+ RealtimeServerEvent:
+ type: object
+ properties:
+ event_id:
+ type: string
+ type:
+ $ref: '#/components/schemas/RealtimeServerEventType'
+ required:
+ - type
+ - event_id
+ RealtimeServerEventType:
+ type: string
+ enum:
+ - error
+ - session.created
+ - session.updated
+ - conversation.created
+ - input_audio_buffer.committed
+ - input_audio_buffer.cleared
+ - input_audio_buffer.speech_started
+ - input_audio_buffer.speech_stopped
+ - conversation.item.created
+ - conversation.item.input_audio_transcription.completed
+ - conversation.item.input_audio_transcription.failed
+ - conversation.item.truncated
+ - conversation.item.deleted
+ - response.created
+ - response.done
+ - response.output_item.added
+ - response.output_item.done
+ - response.content_part.added
+ - response.content_part.done
+ - response.text.delta
+ - response.text.done
+ - response.audio_transcript.delta
+ - response.audio_transcript.done
+ - response.audio.delta
+ - response.audio.done
+ - response.function_call_arguments.delta
+ - response.function_call_arguments.done
+ - rate_limits.updated
+ RealtimeAudioFormat:
+ type: string
+ enum:
+ - pcm16
+ - g711_ulaw
+ - g711_alaw
+ RealtimeResponseCreate:
+ type: object
+ properties:
+ event_id:
+ type: string
+ description: Optional client-generated ID used to identify this event.
+ type:
+ type: string
+ enum:
+ - response.create
+ description: The event type, must be 'response.create'.
+ response:
+ type: object
+ properties:
+ modalities:
+ type: array
+ items:
+ type: string
+ enum:
+ - text
+ - audio
+ description: The modalities for the response.
+ instructions:
+ type: string
+ description: Instructions for the model.
+ voice:
+ type: string
+ enum: [alloy, echo, shimmer]
+ description: The voice the model uses to respond.
+ output_audio_format:
+ $ref: '#/components/schemas/RealtimeAudioFormat'
+# tools:
+# type: array
+# items:
+# type: object
+# properties:
+# type:
+# type: string
+# description: The type of the tool.
+# name:
+# type: string
+# description: The name of the function.
+# description:
+# type: string
+# description: The description of the function.
+# parameters:
+# type: object
+# tool_choice:
+# type: string
+# description: How the model chooses tools.
+ temperature:
+ type: number
+ description: Sampling temperature.
+ max_output_tokens:
+ oneOf:
+ - type: integer
+ - type: string
+ enum: ["inf"]
+ description: Maximum number of output tokens, or "inf" for unlimited. Defaults to "inf".
\ No newline at end of file
diff --git a/src/libs/OpenAI/openapi.yaml b/src/libs/OpenAI/openapi.yaml
index 1640b51b..4e03e333 100644
--- a/src/libs/OpenAI/openapi.yaml
+++ b/src/libs/OpenAI/openapi.yaml
@@ -11027,6 +11027,97 @@ components:
type: string
deleted:
type: boolean
+ RealtimeServerEvent:
+ required:
+ - type
+ - event_id
+ type: object
+ properties:
+ event_id:
+ type: string
+ type:
+ $ref: '#/components/schemas/RealtimeServerEventType'
+ RealtimeServerEventType:
+ enum:
+ - error
+ - session.created
+ - session.updated
+ - conversation.created
+ - input_audio_buffer.committed
+ - input_audio_buffer.cleared
+ - input_audio_buffer.speech_started
+ - input_audio_buffer.speech_stopped
+ - conversation.item.created
+ - conversation.item.input_audio_transcription.completed
+ - conversation.item.input_audio_transcription.failed
+ - conversation.item.truncated
+ - conversation.item.deleted
+ - response.created
+ - response.done
+ - response.output_item.added
+ - response.output_item.done
+ - response.content_part.added
+ - response.content_part.done
+ - response.text.delta
+ - response.text.done
+ - response.audio_transcript.delta
+ - response.audio_transcript.done
+ - response.audio.delta
+ - response.audio.done
+ - response.function_call_arguments.delta
+ - response.function_call_arguments.done
+ - rate_limits.updated
+ type: string
+ RealtimeAudioFormat:
+ enum:
+ - pcm16
+ - g711_ulaw
+ - g711_alaw
+ type: string
+ RealtimeResponseCreate:
+ type: object
+ properties:
+ event_id:
+ type: string
+ description: Optional client-generated ID used to identify this event.
+ type:
+ enum:
+ - response.create
+ type: string
+ description: 'The event type, must be ''response.create''.'
+ response:
+ type: object
+ properties:
+ modalities:
+ type: array
+ items:
+ enum:
+ - text
+ - audio
+ type: string
+ description: The modalities for the response.
+ instructions:
+ type: string
+ description: Instructions for the model.
+ voice:
+ enum:
+ - alloy
+ - echo
+ - shimmer
+ type: string
+ description: The voice the model uses to respond.
+ output_audio_format:
+ $ref: '#/components/schemas/RealtimeAudioFormat'
+ temperature:
+ type: number
+ description: Sampling temperature.
+ max_output_tokens:
+ oneOf:
+ - type: integer
+ - enum:
+ - inf
+ type: string
+ description: 'Maximum number of output tokens, or "inf" for unlimited. Defaults to "inf".'
securitySchemes:
ApiKeyAuth:
type: http
diff --git a/src/tests/OpenAI.IntegrationTests/Tests.Helpers.cs b/src/tests/OpenAI.IntegrationTests/Tests.Helpers.cs
index 6ecd1e3c..d873e02d 100755
--- a/src/tests/OpenAI.IntegrationTests/Tests.Helpers.cs
+++ b/src/tests/OpenAI.IntegrationTests/Tests.Helpers.cs
@@ -9,8 +9,18 @@ private static OpenAiApi GetAuthorizedApi()
Environment.GetEnvironmentVariable("OPENAI_API_KEY") ??
throw new AssertInconclusiveException("OPENAI_API_KEY environment variable is not found.");
- var client = new OpenAiApi();
- client.AuthorizeUsingBearer(apiKey);
+ var client = new OpenAiApi(apiKey);
+
+ return client;
+ }
+
+ private static RealtimeConversationClient GetAuthenticatedRealtimeClient()
+ {
+ var apiKey =
+ Environment.GetEnvironmentVariable("OPENAI_API_KEY") ??
+ throw new AssertInconclusiveException("OPENAI_API_KEY environment variable is not found.");
+
+ var client = new RealtimeConversationClient(apiKey);
return client;
}
diff --git a/src/tests/OpenAI.IntegrationTests/Tests.Realtime.cs b/src/tests/OpenAI.IntegrationTests/Tests.Realtime.cs
new file mode 100755
index 00000000..826e5d00
--- /dev/null
+++ b/src/tests/OpenAI.IntegrationTests/Tests.Realtime.cs
@@ -0,0 +1,28 @@
+namespace OpenAI.IntegrationTests;
+
+public partial class Tests
+{
+ [TestMethod]
+ public async Task Realtime()
+ {
+ using var realtimeConversationClient = GetAuthenticatedRealtimeClient();
+ using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(15));
+ var cancellationToken = cancellationTokenSource.Token;
+
+ // await realtimeConversationClient.SendAsync("Hello, WebSocket!");
+ await realtimeConversationClient.CreateResponseAsync(new RealtimeResponseCreate
+ {
+ Type = RealtimeResponseCreateType.ResponseCreate,
+ Response = new RealtimeResponseCreateResponse
+ {
+ Modalities = [RealtimeResponseCreateResponseModalitie.Text],
+ Instructions = "Please assist the user.",
+ }
+ }, cancellationToken);
+
+ await foreach (RealtimeServerEvent receivedMessage in realtimeConversationClient.ReceiveUpdatesAsync(cancellationToken))
+ {
+ Console.WriteLine(value: "Message received. Type:" + receivedMessage.Type);
+ }
+ }
+}