diff --git a/src/libs/Cohere/Generated/Cohere.Models.StreamedChatResponseV2.g.cs b/src/libs/Cohere/Generated/Cohere.Models.StreamedChatResponseV2.g.cs index 1c8dc98..72277d8 100644 --- a/src/libs/Cohere/Generated/Cohere.Models.StreamedChatResponseV2.g.cs +++ b/src/libs/Cohere/Generated/Cohere.Models.StreamedChatResponseV2.g.cs @@ -324,6 +324,41 @@ public StreamedChatResponseV2(global::Cohere.ChatMessageEndEvent? value) MessageEndEvent = value; } + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Cohere.ChatDebugEvent? DebugEvent { get; init; } +#else + public global::Cohere.ChatDebugEvent? DebugEvent { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(DebugEvent))] +#endif + public bool IsDebugEvent => DebugEvent != null; + + /// + /// + /// + public static implicit operator StreamedChatResponseV2(global::Cohere.ChatDebugEvent value) => new StreamedChatResponseV2(value); + + /// + /// + /// + public static implicit operator global::Cohere.ChatDebugEvent?(StreamedChatResponseV2 @this) => @this.DebugEvent; + + /// + /// + /// + public StreamedChatResponseV2(global::Cohere.ChatDebugEvent? value) + { + DebugEvent = value; + } + /// /// /// @@ -336,7 +371,8 @@ public StreamedChatResponseV2( global::Cohere.ChatToolCallStartEvent? toolCallStartEvent, global::Cohere.ChatToolCallDeltaEvent? toolCallDeltaEvent, global::Cohere.ChatToolCallEndEvent? toolCallEndEvent, - global::Cohere.ChatMessageEndEvent? messageEndEvent + global::Cohere.ChatMessageEndEvent? messageEndEvent, + global::Cohere.ChatDebugEvent? debugEvent ) { MessageStartEvent = messageStartEvent; @@ -348,12 +384,14 @@ public StreamedChatResponseV2( ToolCallDeltaEvent = toolCallDeltaEvent; ToolCallEndEvent = toolCallEndEvent; MessageEndEvent = messageEndEvent; + DebugEvent = debugEvent; } /// /// /// public object? Object => + DebugEvent as object ?? MessageEndEvent as object ?? ToolCallEndEvent as object ?? ToolCallDeltaEvent as object ?? @@ -370,7 +408,7 @@ MessageStartEvent as object /// public bool Validate() { - return IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent || !IsMessageStartEvent && IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent || !IsMessageStartEvent && !IsContentStartEvent && IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && IsToolCallEndEvent && !IsMessageEndEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && IsMessageEndEvent; + return IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent && !IsDebugEvent || !IsMessageStartEvent && IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent && !IsDebugEvent || !IsMessageStartEvent && !IsContentStartEvent && IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent && !IsDebugEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent && !IsDebugEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent && !IsDebugEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent && !IsDebugEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent && !IsDebugEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && IsToolCallEndEvent && !IsMessageEndEvent && !IsDebugEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && IsMessageEndEvent && !IsDebugEvent || !IsMessageStartEvent && !IsContentStartEvent && !IsContentDeltaEvent && !IsContentEndEvent && !IsToolPlanDeltaEvent && !IsToolCallStartEvent && !IsToolCallDeltaEvent && !IsToolCallEndEvent && !IsMessageEndEvent && IsDebugEvent; } /// @@ -386,6 +424,7 @@ public bool Validate() global::System.Func? toolCallDeltaEvent = null, global::System.Func? toolCallEndEvent = null, global::System.Func? messageEndEvent = null, + global::System.Func? debugEvent = null, bool validate = true) { if (validate) @@ -429,6 +468,10 @@ public bool Validate() { return messageEndEvent(MessageEndEvent!); } + else if (IsDebugEvent && debugEvent != null) + { + return debugEvent(DebugEvent!); + } return default(TResult); } @@ -446,6 +489,7 @@ public void Match( global::System.Action? toolCallDeltaEvent = null, global::System.Action? toolCallEndEvent = null, global::System.Action? messageEndEvent = null, + global::System.Action? debugEvent = null, bool validate = true) { if (validate) @@ -489,6 +533,10 @@ public void Match( { messageEndEvent?.Invoke(MessageEndEvent!); } + else if (IsDebugEvent) + { + debugEvent?.Invoke(DebugEvent!); + } } /// @@ -516,6 +564,8 @@ public override int GetHashCode() typeof(global::Cohere.ChatToolCallEndEvent), MessageEndEvent, typeof(global::Cohere.ChatMessageEndEvent), + DebugEvent, + typeof(global::Cohere.ChatDebugEvent), }; const int offset = unchecked((int)2166136261); const int prime = 16777619; @@ -540,7 +590,8 @@ public bool Equals(StreamedChatResponseV2 other) global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolCallStartEvent, other.ToolCallStartEvent) && global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolCallDeltaEvent, other.ToolCallDeltaEvent) && global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolCallEndEvent, other.ToolCallEndEvent) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageEndEvent, other.MessageEndEvent) + global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageEndEvent, other.MessageEndEvent) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(DebugEvent, other.DebugEvent) ; } diff --git a/src/libs/Cohere/Generated/JsonConverters.StreamedChatResponseV2.g.cs b/src/libs/Cohere/Generated/JsonConverters.StreamedChatResponseV2.g.cs index 6779681..11c9122 100644 --- a/src/libs/Cohere/Generated/JsonConverters.StreamedChatResponseV2.g.cs +++ b/src/libs/Cohere/Generated/JsonConverters.StreamedChatResponseV2.g.cs @@ -124,6 +124,18 @@ public class StreamedChatResponseV2JsonConverter : global::System.Text.Json.Seri { } + readerCopy = reader; + global::Cohere.ChatDebugEvent? debugEvent = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Cohere.ChatDebugEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Cohere.ChatDebugEvent).Name}"); + debugEvent = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + var result = new global::Cohere.StreamedChatResponseV2( messageStartEvent, contentStartEvent, @@ -133,7 +145,8 @@ public class StreamedChatResponseV2JsonConverter : global::System.Text.Json.Seri toolCallStartEvent, toolCallDeltaEvent, toolCallEndEvent, - messageEndEvent + messageEndEvent, + debugEvent ); if (messageStartEvent != null) @@ -190,6 +203,12 @@ public class StreamedChatResponseV2JsonConverter : global::System.Text.Json.Seri throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Cohere.ChatMessageEndEvent).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } + else if (debugEvent != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Cohere.ChatDebugEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Cohere.ChatDebugEvent).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } return result; } @@ -257,6 +276,12 @@ public override void Write( throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Cohere.ChatMessageEndEvent).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageEndEvent, typeInfo); } + else if (value.IsDebugEvent) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Cohere.ChatDebugEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Cohere.ChatDebugEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.DebugEvent, typeInfo); + } } } } \ No newline at end of file diff --git a/src/libs/Cohere/openapi.yaml b/src/libs/Cohere/openapi.yaml index a7b818c..ba7ed3d 100644 --- a/src/libs/Cohere/openapi.yaml +++ b/src/libs/Cohere/openapi.yaml @@ -902,6 +902,8 @@ paths: - $ref: '#/components/schemas/ChatToolCallDeltaEvent' - $ref: '#/components/schemas/ChatToolCallEndEvent' - $ref: '#/components/schemas/ChatMessageEndEvent' + - $ref: '#/components/schemas/ChatDebugEvent' + debug: '#/components/schemas/ChatDebugEvent' x-fern-examples: - code-samples: - sdk: typescript @@ -12599,6 +12601,7 @@ components: - $ref: '#/components/schemas/ChatToolCallDeltaEvent' - $ref: '#/components/schemas/ChatToolCallEndEvent' - $ref: '#/components/schemas/ChatMessageEndEvent' + - $ref: '#/components/schemas/ChatDebugEvent' description: StreamedChatResponse is returned in streaming mode (specified with `stream=True` in the request). SingleGeneration: required: