Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More spec updates: London Dev Day (new voices for chat and realtime audio output) #315

Open
wants to merge 2 commits into
base: user/travisw/chat-audio-updates
Choose a base branch
from
Open
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
13 changes: 10 additions & 3 deletions .dotnet/api/OpenAI.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,11 +1628,13 @@ public class ChatResponseFormat : IJsonModel<ChatResponseFormat>, IPersistableMo
private readonly int _dummyPrimitive;
public ChatResponseVoice(string value);
public static ChatResponseVoice Alloy { get; }
public static ChatResponseVoice Ash { get; }
public static ChatResponseVoice Ballad { get; }
public static ChatResponseVoice Coral { get; }
public static ChatResponseVoice Echo { get; }
public static ChatResponseVoice Fable { get; }
public static ChatResponseVoice Nova { get; }
public static ChatResponseVoice Onyx { get; }
public static ChatResponseVoice Sage { get; }
public static ChatResponseVoice Shimmer { get; }
public static ChatResponseVoice Verse { get; }
public readonly bool Equals(ChatResponseVoice other);
[EditorBrowsable(EditorBrowsableState.Never)]
public override readonly bool Equals(object obj);
Expand Down Expand Up @@ -2962,8 +2964,13 @@ public enum ConversationUpdateKind {
private readonly int _dummyPrimitive;
public ConversationVoice(string value);
public static ConversationVoice Alloy { get; }
public static ConversationVoice Ash { get; }
public static ConversationVoice Ballad { get; }
public static ConversationVoice Coral { get; }
public static ConversationVoice Echo { get; }
public static ConversationVoice Sage { get; }
public static ConversationVoice Shimmer { get; }
public static ConversationVoice Verse { get; }
public readonly bool Equals(ConversationVoice other);
[EditorBrowsable(EditorBrowsableState.Never)]
public override readonly bool Equals(object obj);
Expand Down
4 changes: 2 additions & 2 deletions .dotnet/src/Custom/Audio/Internal/GeneratorStubs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ internal readonly partial struct InternalCreateSpeechRequestModel { }
[CodeGenModel("CreateTranscriptionRequestModel")]
internal readonly partial struct InternalCreateTranscriptionRequestModel { }

[CodeGenModel("CreateTranscriptionRequestTimestampGranularity")]
internal readonly partial struct InternalCreateTranscriptionRequestTimestampGranularity { }
[CodeGenModel("CreateTranscriptionRequestTimestampGranularities")]
internal readonly partial struct InternalCreateTranscriptionRequestTimestampGranularities { }

[CodeGenModel("CreateTranscriptionResponseJson")]
internal partial class InternalCreateTranscriptionResponseJson { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ void IJsonModel<AudioTranscriptionOptions>.Write(Utf8JsonWriter writer, ModelRea
writer.WritePropertyName("temperature"u8);
writer.WriteNumberValue(Temperature.Value);
}
if (SerializedAdditionalRawData?.ContainsKey("timestamp_granularities") != true && Optional.IsCollectionDefined(InternalTimestampGranularities))
if (SerializedAdditionalRawData?.ContainsKey("timestamp_granularities[]") != true && Optional.IsCollectionDefined(InternalTimestampGranularities))
{
writer.WritePropertyName("timestamp_granularities"u8);
writer.WritePropertyName("timestamp_granularities[]"u8);
writer.WriteStartArray();
foreach (var item in InternalTimestampGranularities)
{
Expand Down Expand Up @@ -172,7 +172,7 @@ internal static AudioTranscriptionOptions DeserializeAudioTranscriptionOptions(J
temperature = property.Value.GetSingle();
continue;
}
if (property.NameEquals("timestamp_granularities"u8))
if (property.NameEquals("timestamp_granularities[]"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
Expand Down Expand Up @@ -251,7 +251,7 @@ internal virtual MultipartFormDataBinaryContent ToMultipartBinaryBody()
{
foreach (BinaryData item in InternalTimestampGranularities)
{
content.Add(item, "timestamp_granularities", "timestamp_granularities");
content.Add(item, "timestamp_granularities[]", "timestamp_granularities[]");
}
}
return content;
Expand Down
16 changes: 10 additions & 6 deletions .dotnet/src/Generated/Models/ChatResponseVoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@ public ChatResponseVoice(string value)
}

private const string AlloyValue = "alloy";
private const string AshValue = "ash";
private const string BalladValue = "ballad";
private const string CoralValue = "coral";
private const string EchoValue = "echo";
private const string FableValue = "fable";
private const string OnyxValue = "onyx";
private const string NovaValue = "nova";
private const string SageValue = "sage";
private const string ShimmerValue = "shimmer";
private const string VerseValue = "verse";

public static ChatResponseVoice Alloy { get; } = new ChatResponseVoice(AlloyValue);
public static ChatResponseVoice Ash { get; } = new ChatResponseVoice(AshValue);
public static ChatResponseVoice Ballad { get; } = new ChatResponseVoice(BalladValue);
public static ChatResponseVoice Coral { get; } = new ChatResponseVoice(CoralValue);
public static ChatResponseVoice Echo { get; } = new ChatResponseVoice(EchoValue);
public static ChatResponseVoice Fable { get; } = new ChatResponseVoice(FableValue);
public static ChatResponseVoice Onyx { get; } = new ChatResponseVoice(OnyxValue);
public static ChatResponseVoice Nova { get; } = new ChatResponseVoice(NovaValue);
public static ChatResponseVoice Sage { get; } = new ChatResponseVoice(SageValue);
public static ChatResponseVoice Shimmer { get; } = new ChatResponseVoice(ShimmerValue);
public static ChatResponseVoice Verse { get; } = new ChatResponseVoice(VerseValue);
public static bool operator ==(ChatResponseVoice left, ChatResponseVoice right) => left.Equals(right);
public static bool operator !=(ChatResponseVoice left, ChatResponseVoice right) => !left.Equals(right);
public static implicit operator ChatResponseVoice(string value) => new ChatResponseVoice(value);
Expand Down
14 changes: 12 additions & 2 deletions .dotnet/src/Generated/Models/ConversationVoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ public ConversationVoice(string value)
}

private const string AlloyValue = "alloy";
private const string ShimmerValue = "shimmer";
private const string AshValue = "ash";
private const string BalladValue = "ballad";
private const string CoralValue = "coral";
private const string EchoValue = "echo";
private const string SageValue = "sage";
private const string ShimmerValue = "shimmer";
private const string VerseValue = "verse";

public static ConversationVoice Alloy { get; } = new ConversationVoice(AlloyValue);
public static ConversationVoice Shimmer { get; } = new ConversationVoice(ShimmerValue);
public static ConversationVoice Ash { get; } = new ConversationVoice(AshValue);
public static ConversationVoice Ballad { get; } = new ConversationVoice(BalladValue);
public static ConversationVoice Coral { get; } = new ConversationVoice(CoralValue);
public static ConversationVoice Echo { get; } = new ConversationVoice(EchoValue);
public static ConversationVoice Sage { get; } = new ConversationVoice(SageValue);
public static ConversationVoice Shimmer { get; } = new ConversationVoice(ShimmerValue);
public static ConversationVoice Verse { get; } = new ConversationVoice(VerseValue);
public static bool operator ==(ConversationVoice left, ConversationVoice right) => left.Equals(right);
public static bool operator !=(ConversationVoice left, ConversationVoice right) => !left.Equals(right);
public static implicit operator ConversationVoice(string value) => new ConversationVoice(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void IJsonModel<InternalCreateChatCompletionResponseChoiceLogprobs>.Write(Utf8Js
}

writer.WriteStartObject();
if (SerializedAdditionalRawData?.ContainsKey("content") != true)
if (SerializedAdditionalRawData?.ContainsKey("content") != true && true)
{
if (Content != null && Optional.IsCollectionDefined(Content))
{
Expand All @@ -38,7 +38,7 @@ void IJsonModel<InternalCreateChatCompletionResponseChoiceLogprobs>.Write(Utf8Js
writer.WriteNull("content");
}
}
if (SerializedAdditionalRawData?.ContainsKey("refusal") != true)
if (SerializedAdditionalRawData?.ContainsKey("refusal") != true && true)
{
if (Refusal != null && Optional.IsCollectionDefined(Refusal))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

using System;
using System.Collections.Generic;
using System.Linq;

namespace OpenAI.Chat
{
internal partial class InternalCreateChatCompletionResponseChoiceLogprobs
{
internal IDictionary<string, BinaryData> SerializedAdditionalRawData { get; set; }
internal InternalCreateChatCompletionResponseChoiceLogprobs(IEnumerable<ChatTokenLogProbabilityDetails> content, IEnumerable<ChatTokenLogProbabilityDetails> refusal)
internal InternalCreateChatCompletionResponseChoiceLogprobs()
{
Content = content?.ToList();
Refusal = refusal?.ToList();
Content = new ChangeTrackingList<ChatTokenLogProbabilityDetails>();
Refusal = new ChangeTrackingList<ChatTokenLogProbabilityDetails>();
}

internal InternalCreateChatCompletionResponseChoiceLogprobs(IReadOnlyList<ChatTokenLogProbabilityDetails> content, IReadOnlyList<ChatTokenLogProbabilityDetails> refusal, IDictionary<string, BinaryData> serializedAdditionalRawData)
Expand All @@ -24,10 +23,6 @@ internal InternalCreateChatCompletionResponseChoiceLogprobs(IReadOnlyList<ChatTo
SerializedAdditionalRawData = serializedAdditionalRawData;
}

internal InternalCreateChatCompletionResponseChoiceLogprobs()
{
}

public IReadOnlyList<ChatTokenLogProbabilityDetails> Content { get; }
public IReadOnlyList<ChatTokenLogProbabilityDetails> Refusal { get; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void IJsonModel<InternalCreateChatCompletionStreamResponseChoiceLogprobs>.Write(
}

writer.WriteStartObject();
if (SerializedAdditionalRawData?.ContainsKey("content") != true)
if (SerializedAdditionalRawData?.ContainsKey("content") != true && true)
{
if (Content != null && Optional.IsCollectionDefined(Content))
{
Expand All @@ -38,7 +38,7 @@ void IJsonModel<InternalCreateChatCompletionStreamResponseChoiceLogprobs>.Write(
writer.WriteNull("content");
}
}
if (SerializedAdditionalRawData?.ContainsKey("refusal") != true)
if (SerializedAdditionalRawData?.ContainsKey("refusal") != true && true)
{
if (Refusal != null && Optional.IsCollectionDefined(Refusal))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

using System;
using System.Collections.Generic;
using System.Linq;

namespace OpenAI.Chat
{
internal partial class InternalCreateChatCompletionStreamResponseChoiceLogprobs
{
internal IDictionary<string, BinaryData> SerializedAdditionalRawData { get; set; }
internal InternalCreateChatCompletionStreamResponseChoiceLogprobs(IEnumerable<ChatTokenLogProbabilityDetails> content, IEnumerable<ChatTokenLogProbabilityDetails> refusal)
internal InternalCreateChatCompletionStreamResponseChoiceLogprobs()
{
Content = content?.ToList();
Refusal = refusal?.ToList();
Content = new ChangeTrackingList<ChatTokenLogProbabilityDetails>();
Refusal = new ChangeTrackingList<ChatTokenLogProbabilityDetails>();
}

internal InternalCreateChatCompletionStreamResponseChoiceLogprobs(IReadOnlyList<ChatTokenLogProbabilityDetails> content, IReadOnlyList<ChatTokenLogProbabilityDetails> refusal, IDictionary<string, BinaryData> serializedAdditionalRawData)
Expand All @@ -24,10 +23,6 @@ internal InternalCreateChatCompletionStreamResponseChoiceLogprobs(IReadOnlyList<
SerializedAdditionalRawData = serializedAdditionalRawData;
}

internal InternalCreateChatCompletionStreamResponseChoiceLogprobs()
{
}

public IReadOnlyList<ChatTokenLogProbabilityDetails> Content { get; }
public IReadOnlyList<ChatTokenLogProbabilityDetails> Refusal { get; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@

namespace OpenAI.Audio
{
internal readonly partial struct InternalCreateTranscriptionRequestTimestampGranularity : IEquatable<InternalCreateTranscriptionRequestTimestampGranularity>
internal readonly partial struct InternalCreateTranscriptionRequestTimestampGranularities : IEquatable<InternalCreateTranscriptionRequestTimestampGranularities>
{
private readonly string _value;

public InternalCreateTranscriptionRequestTimestampGranularity(string value)
public InternalCreateTranscriptionRequestTimestampGranularities(string value)
{
_value = value ?? throw new ArgumentNullException(nameof(value));
}

private const string WordValue = "word";
private const string SegmentValue = "segment";

public static InternalCreateTranscriptionRequestTimestampGranularity Word { get; } = new InternalCreateTranscriptionRequestTimestampGranularity(WordValue);
public static InternalCreateTranscriptionRequestTimestampGranularity Segment { get; } = new InternalCreateTranscriptionRequestTimestampGranularity(SegmentValue);
public static bool operator ==(InternalCreateTranscriptionRequestTimestampGranularity left, InternalCreateTranscriptionRequestTimestampGranularity right) => left.Equals(right);
public static bool operator !=(InternalCreateTranscriptionRequestTimestampGranularity left, InternalCreateTranscriptionRequestTimestampGranularity right) => !left.Equals(right);
public static implicit operator InternalCreateTranscriptionRequestTimestampGranularity(string value) => new InternalCreateTranscriptionRequestTimestampGranularity(value);
public static InternalCreateTranscriptionRequestTimestampGranularities Word { get; } = new InternalCreateTranscriptionRequestTimestampGranularities(WordValue);
public static InternalCreateTranscriptionRequestTimestampGranularities Segment { get; } = new InternalCreateTranscriptionRequestTimestampGranularities(SegmentValue);
public static bool operator ==(InternalCreateTranscriptionRequestTimestampGranularities left, InternalCreateTranscriptionRequestTimestampGranularities right) => left.Equals(right);
public static bool operator !=(InternalCreateTranscriptionRequestTimestampGranularities left, InternalCreateTranscriptionRequestTimestampGranularities right) => !left.Equals(right);
public static implicit operator InternalCreateTranscriptionRequestTimestampGranularities(string value) => new InternalCreateTranscriptionRequestTimestampGranularities(value);

[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj) => obj is InternalCreateTranscriptionRequestTimestampGranularity other && Equals(other);
public bool Equals(InternalCreateTranscriptionRequestTimestampGranularity other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
public override bool Equals(object obj) => obj is InternalCreateTranscriptionRequestTimestampGranularities other && Equals(other);
public bool Equals(InternalCreateTranscriptionRequestTimestampGranularities other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void IJsonModel<InternalRunObjectRequiredActionSubmitToolOutputs>.Write(Utf8Json
}

writer.WriteStartObject();
if (SerializedAdditionalRawData?.ContainsKey("tool_calls") != true)
if (SerializedAdditionalRawData?.ContainsKey("tool_calls") != true && true)
{
writer.WritePropertyName("tool_calls"u8);
writer.WriteStartArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@

using System;
using System.Collections.Generic;
using System.Linq;

namespace OpenAI.Assistants
{
internal partial class InternalRunObjectRequiredActionSubmitToolOutputs
{
internal IDictionary<string, BinaryData> SerializedAdditionalRawData { get; set; }
internal InternalRunObjectRequiredActionSubmitToolOutputs(IEnumerable<InternalRequiredFunctionToolCall> toolCalls)
internal InternalRunObjectRequiredActionSubmitToolOutputs()
{
Argument.AssertNotNull(toolCalls, nameof(toolCalls));

ToolCalls = toolCalls.ToList();
ToolCalls = new ChangeTrackingList<InternalRequiredFunctionToolCall>();
}

internal InternalRunObjectRequiredActionSubmitToolOutputs(IReadOnlyList<InternalRequiredFunctionToolCall> toolCalls, IDictionary<string, BinaryData> serializedAdditionalRawData)
Expand All @@ -24,10 +21,6 @@ internal InternalRunObjectRequiredActionSubmitToolOutputs(IReadOnlyList<Internal
SerializedAdditionalRawData = serializedAdditionalRawData;
}

internal InternalRunObjectRequiredActionSubmitToolOutputs()
{
}

public IReadOnlyList<InternalRequiredFunctionToolCall> ToolCalls { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void IJsonModel<InternalRunStepDeltaStepDetailsToolCallsCodeObjectCodeInterprete
writer.WritePropertyName("input"u8);
writer.WriteStringValue(Input);
}
if (SerializedAdditionalRawData?.ContainsKey("outputs") != true && Optional.IsCollectionDefined(Outputs))
if (SerializedAdditionalRawData?.ContainsKey("outputs") != true && true && Optional.IsCollectionDefined(Outputs))
{
writer.WritePropertyName("outputs"u8);
writer.WriteStartArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void IJsonModel<InternalRunStepDetailsToolCallsCodeObjectCodeInterpreter>.Write(
writer.WritePropertyName("input"u8);
writer.WriteStringValue(Input);
}
if (SerializedAdditionalRawData?.ContainsKey("outputs") != true)
if (SerializedAdditionalRawData?.ContainsKey("outputs") != true && true)
{
writer.WritePropertyName("outputs"u8);
writer.WriteStartArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@

using System;
using System.Collections.Generic;
using System.Linq;

namespace OpenAI.Assistants
{
internal partial class InternalRunStepDetailsToolCallsCodeObjectCodeInterpreter
{
internal IDictionary<string, BinaryData> SerializedAdditionalRawData { get; set; }
internal InternalRunStepDetailsToolCallsCodeObjectCodeInterpreter(string input, IEnumerable<RunStepCodeInterpreterOutput> outputs)
internal InternalRunStepDetailsToolCallsCodeObjectCodeInterpreter(string input)
{
Argument.AssertNotNull(input, nameof(input));
Argument.AssertNotNull(outputs, nameof(outputs));

Input = input;
Outputs = outputs.ToList();
Outputs = new ChangeTrackingList<RunStepCodeInterpreterOutput>();
}

internal InternalRunStepDetailsToolCallsCodeObjectCodeInterpreter(string input, IReadOnlyList<RunStepCodeInterpreterOutput> outputs, IDictionary<string, BinaryData> serializedAdditionalRawData)
Expand Down
Loading