Skip to content

Commit

Permalink
Merge pull request #112 from tryAGI/bot/update-openapi_202411221826
Browse files Browse the repository at this point in the history
feat:Update openapi.yaml file in src/libs/Cohere directory
  • Loading branch information
github-actions[bot] authored Nov 22, 2024
2 parents 2cca106 + 075a0b0 commit 7fe30a3
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,41 @@ public StreamedChatResponseV2(global::Cohere.ChatMessageEndEvent? value)
MessageEndEvent = value;
}

/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
public global::Cohere.ChatDebugEvent? DebugEvent { get; init; }
#else
public global::Cohere.ChatDebugEvent? DebugEvent { get; }
#endif

/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(DebugEvent))]
#endif
public bool IsDebugEvent => DebugEvent != null;

/// <summary>
///
/// </summary>
public static implicit operator StreamedChatResponseV2(global::Cohere.ChatDebugEvent value) => new StreamedChatResponseV2(value);

/// <summary>
///
/// </summary>
public static implicit operator global::Cohere.ChatDebugEvent?(StreamedChatResponseV2 @this) => @this.DebugEvent;

/// <summary>
///
/// </summary>
public StreamedChatResponseV2(global::Cohere.ChatDebugEvent? value)
{
DebugEvent = value;
}

/// <summary>
///
/// </summary>
Expand All @@ -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;
Expand All @@ -348,12 +384,14 @@ public StreamedChatResponseV2(
ToolCallDeltaEvent = toolCallDeltaEvent;
ToolCallEndEvent = toolCallEndEvent;
MessageEndEvent = messageEndEvent;
DebugEvent = debugEvent;
}

/// <summary>
///
/// </summary>
public object? Object =>
DebugEvent as object ??
MessageEndEvent as object ??
ToolCallEndEvent as object ??
ToolCallDeltaEvent as object ??
Expand All @@ -370,7 +408,7 @@ MessageStartEvent as object
/// </summary>
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;
}

/// <summary>
Expand All @@ -386,6 +424,7 @@ public bool Validate()
global::System.Func<global::Cohere.ChatToolCallDeltaEvent?, TResult>? toolCallDeltaEvent = null,
global::System.Func<global::Cohere.ChatToolCallEndEvent?, TResult>? toolCallEndEvent = null,
global::System.Func<global::Cohere.ChatMessageEndEvent?, TResult>? messageEndEvent = null,
global::System.Func<global::Cohere.ChatDebugEvent?, TResult>? debugEvent = null,
bool validate = true)
{
if (validate)
Expand Down Expand Up @@ -429,6 +468,10 @@ public bool Validate()
{
return messageEndEvent(MessageEndEvent!);
}
else if (IsDebugEvent && debugEvent != null)
{
return debugEvent(DebugEvent!);
}

return default(TResult);
}
Expand All @@ -446,6 +489,7 @@ public void Match(
global::System.Action<global::Cohere.ChatToolCallDeltaEvent?>? toolCallDeltaEvent = null,
global::System.Action<global::Cohere.ChatToolCallEndEvent?>? toolCallEndEvent = null,
global::System.Action<global::Cohere.ChatMessageEndEvent?>? messageEndEvent = null,
global::System.Action<global::Cohere.ChatDebugEvent?>? debugEvent = null,
bool validate = true)
{
if (validate)
Expand Down Expand Up @@ -489,6 +533,10 @@ public void Match(
{
messageEndEvent?.Invoke(MessageEndEvent!);
}
else if (IsDebugEvent)
{
debugEvent?.Invoke(DebugEvent!);
}
}

/// <summary>
Expand Down Expand Up @@ -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;
Expand All @@ -540,7 +590,8 @@ public bool Equals(StreamedChatResponseV2 other)
global::System.Collections.Generic.EqualityComparer<global::Cohere.ChatToolCallStartEvent?>.Default.Equals(ToolCallStartEvent, other.ToolCallStartEvent) &&
global::System.Collections.Generic.EqualityComparer<global::Cohere.ChatToolCallDeltaEvent?>.Default.Equals(ToolCallDeltaEvent, other.ToolCallDeltaEvent) &&
global::System.Collections.Generic.EqualityComparer<global::Cohere.ChatToolCallEndEvent?>.Default.Equals(ToolCallEndEvent, other.ToolCallEndEvent) &&
global::System.Collections.Generic.EqualityComparer<global::Cohere.ChatMessageEndEvent?>.Default.Equals(MessageEndEvent, other.MessageEndEvent)
global::System.Collections.Generic.EqualityComparer<global::Cohere.ChatMessageEndEvent?>.Default.Equals(MessageEndEvent, other.MessageEndEvent) &&
global::System.Collections.Generic.EqualityComparer<global::Cohere.ChatDebugEvent?>.Default.Equals(DebugEvent, other.DebugEvent)
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<global::Cohere.ChatDebugEvent> ??
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,
Expand All @@ -133,7 +145,8 @@ public class StreamedChatResponseV2JsonConverter : global::System.Text.Json.Seri
toolCallStartEvent,
toolCallDeltaEvent,
toolCallEndEvent,
messageEndEvent
messageEndEvent,
debugEvent
);

if (messageStartEvent != null)
Expand Down Expand Up @@ -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<global::Cohere.ChatDebugEvent> ??
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;
}
Expand Down Expand Up @@ -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<global::Cohere.ChatDebugEvent?> ??
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);
}
}
}
}
3 changes: 3 additions & 0 deletions src/libs/Cohere/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7fe30a3

Please sign in to comment.