Skip to content

Commit 9fb30e6

Browse files
HavenDVgithub-actions[bot]
andauthored
feat: Updated OpenAPI spec (#247)
Co-authored-by: github-actions[bot] <bot@openai.com>
1 parent c23d795 commit 9fb30e6

18 files changed

+1208
-743
lines changed

src/libs/Cohere/Generated/Cohere..JsonSerializerContext.g.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ namespace Cohere
1717
typeof(global::Cohere.JsonConverters.CitationTypeNullableJsonConverter),
1818
typeof(global::Cohere.JsonConverters.ChatTextContentTypeJsonConverter),
1919
typeof(global::Cohere.JsonConverters.ChatTextContentTypeNullableJsonConverter),
20+
typeof(global::Cohere.JsonConverters.ChatThinkingContentTypeJsonConverter),
21+
typeof(global::Cohere.JsonConverters.ChatThinkingContentTypeNullableJsonConverter),
2022
typeof(global::Cohere.JsonConverters.AssistantMessageResponseContentItemDiscriminatorTypeJsonConverter),
2123
typeof(global::Cohere.JsonConverters.AssistantMessageResponseContentItemDiscriminatorTypeNullableJsonConverter),
2224
typeof(global::Cohere.JsonConverters.AssistantMessageResponseRoleJsonConverter),

src/libs/Cohere/Generated/Cohere.CohereClient.Chatv2.g.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,7 @@ partial void ProcessChatv2ResponseContent(
712712
/// Randomness can be further maximized by increasing the value of the `p` parameter.
713713
/// </param>
714714
/// <param name="thinking">
715-
/// Thinking gives the model enhanced reasoning capabilities for complex tasks, while also providing transparency into its step-by-step thought process before it delivers its final answer.<br/>
716-
/// When thinking is turned on, the model creates thinking content blocks where it outputs its internal reasoning. The model will incorporate insights from this reasoning before crafting a final response.<br/>
717-
/// When thinking is used without tools, the API response will include both thinking and text content blocks. Meanwhile, when thinking is used alongside tools and the model makes tool calls, the API response will include the thinking content block and `tool_calls`.
715+
/// Configuration for [reasoning features](https://docs.cohere.com/docs/reasoning).
718716
/// </param>
719717
/// <param name="toolChoice">
720718
/// Used to control whether or not the model will be forced to use a tool when answering. When `REQUIRED` is specified, the model will be forced to use at least one of the user-defined tools, and the `tools` parameter must be passed in the request.<br/>

src/libs/Cohere/Generated/Cohere.ICohereClient.Chatv2.g.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ public partial interface ICohereClient
107107
/// Randomness can be further maximized by increasing the value of the `p` parameter.
108108
/// </param>
109109
/// <param name="thinking">
110-
/// Thinking gives the model enhanced reasoning capabilities for complex tasks, while also providing transparency into its step-by-step thought process before it delivers its final answer.<br/>
111-
/// When thinking is turned on, the model creates thinking content blocks where it outputs its internal reasoning. The model will incorporate insights from this reasoning before crafting a final response.<br/>
112-
/// When thinking is used without tools, the API response will include both thinking and text content blocks. Meanwhile, when thinking is used alongside tools and the model makes tool calls, the API response will include the thinking content block and `tool_calls`.
110+
/// Configuration for [reasoning features](https://docs.cohere.com/docs/reasoning).
113111
/// </param>
114112
/// <param name="toolChoice">
115113
/// Used to control whether or not the model will be forced to use a tool when answering. When `REQUIRED` is specified, the model will be forced to use at least one of the user-defined tools, and the `tools` parameter must be passed in the request.<br/>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#nullable enable
2+
3+
namespace Cohere.JsonConverters
4+
{
5+
/// <inheritdoc />
6+
public sealed class ChatThinkingContentTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.ChatThinkingContentType>
7+
{
8+
/// <inheritdoc />
9+
public override global::Cohere.ChatThinkingContentType Read(
10+
ref global::System.Text.Json.Utf8JsonReader reader,
11+
global::System.Type typeToConvert,
12+
global::System.Text.Json.JsonSerializerOptions options)
13+
{
14+
switch (reader.TokenType)
15+
{
16+
case global::System.Text.Json.JsonTokenType.String:
17+
{
18+
var stringValue = reader.GetString();
19+
if (stringValue != null)
20+
{
21+
return global::Cohere.ChatThinkingContentTypeExtensions.ToEnum(stringValue) ?? default;
22+
}
23+
24+
break;
25+
}
26+
case global::System.Text.Json.JsonTokenType.Number:
27+
{
28+
var numValue = reader.GetInt32();
29+
return (global::Cohere.ChatThinkingContentType)numValue;
30+
}
31+
case global::System.Text.Json.JsonTokenType.Null:
32+
{
33+
return default(global::Cohere.ChatThinkingContentType);
34+
}
35+
default:
36+
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
37+
}
38+
39+
return default;
40+
}
41+
42+
/// <inheritdoc />
43+
public override void Write(
44+
global::System.Text.Json.Utf8JsonWriter writer,
45+
global::Cohere.ChatThinkingContentType value,
46+
global::System.Text.Json.JsonSerializerOptions options)
47+
{
48+
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
49+
50+
writer.WriteStringValue(global::Cohere.ChatThinkingContentTypeExtensions.ToValueString(value));
51+
}
52+
}
53+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#nullable enable
2+
3+
namespace Cohere.JsonConverters
4+
{
5+
/// <inheritdoc />
6+
public sealed class ChatThinkingContentTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.ChatThinkingContentType?>
7+
{
8+
/// <inheritdoc />
9+
public override global::Cohere.ChatThinkingContentType? Read(
10+
ref global::System.Text.Json.Utf8JsonReader reader,
11+
global::System.Type typeToConvert,
12+
global::System.Text.Json.JsonSerializerOptions options)
13+
{
14+
switch (reader.TokenType)
15+
{
16+
case global::System.Text.Json.JsonTokenType.String:
17+
{
18+
var stringValue = reader.GetString();
19+
if (stringValue != null)
20+
{
21+
return global::Cohere.ChatThinkingContentTypeExtensions.ToEnum(stringValue);
22+
}
23+
24+
break;
25+
}
26+
case global::System.Text.Json.JsonTokenType.Number:
27+
{
28+
var numValue = reader.GetInt32();
29+
return (global::Cohere.ChatThinkingContentType)numValue;
30+
}
31+
case global::System.Text.Json.JsonTokenType.Null:
32+
{
33+
return default(global::Cohere.ChatThinkingContentType?);
34+
}
35+
default:
36+
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
37+
}
38+
39+
return default;
40+
}
41+
42+
/// <inheritdoc />
43+
public override void Write(
44+
global::System.Text.Json.Utf8JsonWriter writer,
45+
global::Cohere.ChatThinkingContentType? value,
46+
global::System.Text.Json.JsonSerializerOptions options)
47+
{
48+
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
49+
50+
if (value == null)
51+
{
52+
writer.WriteNullValue();
53+
}
54+
else
55+
{
56+
writer.WriteStringValue(global::Cohere.ChatThinkingContentTypeExtensions.ToValueString(value.Value));
57+
}
58+
}
59+
}
60+
}

src/libs/Cohere/Generated/Cohere.JsonConverters.ContentItem.g.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ public class ContentItemJsonConverter : global::System.Text.Json.Serialization.J
2828
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Cohere.ChatTextContent)}");
2929
text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
3030
}
31+
global::Cohere.ChatThinkingContent? thinking = default;
32+
if (discriminator?.Type == global::Cohere.AssistantMessageResponseContentItemDiscriminatorType.Thinking)
33+
{
34+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Cohere.ChatThinkingContent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Cohere.ChatThinkingContent> ??
35+
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Cohere.ChatThinkingContent)}");
36+
thinking = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
37+
}
3138

3239
var result = new global::Cohere.ContentItem(
3340
discriminator?.Type,
34-
text
41+
text,
42+
thinking
3543
);
3644

3745
return result;
@@ -52,6 +60,12 @@ public override void Write(
5260
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Cohere.ChatTextContent).Name}");
5361
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo);
5462
}
63+
else if (value.IsThinking)
64+
{
65+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Cohere.ChatThinkingContent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Cohere.ChatThinkingContent?> ??
66+
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Cohere.ChatThinkingContent).Name}");
67+
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Thinking, typeInfo);
68+
}
5569
}
5670
}
5771
}

src/libs/Cohere/Generated/Cohere.JsonConverters.ContentVariant2Item.g.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ public class ContentVariant2ItemJsonConverter : global::System.Text.Json.Seriali
2828
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Cohere.ChatTextContent)}");
2929
text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
3030
}
31+
global::Cohere.ChatThinkingContent? thinking = default;
32+
if (discriminator?.Type == global::Cohere.AssistantMessageV2ContentVariant2ItemDiscriminatorType.Thinking)
33+
{
34+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Cohere.ChatThinkingContent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Cohere.ChatThinkingContent> ??
35+
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Cohere.ChatThinkingContent)}");
36+
thinking = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
37+
}
3138

3239
var result = new global::Cohere.ContentVariant2Item(
3340
discriminator?.Type,
34-
text
41+
text,
42+
thinking
3543
);
3644

3745
return result;
@@ -52,6 +60,12 @@ public override void Write(
5260
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Cohere.ChatTextContent).Name}");
5361
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo);
5462
}
63+
else if (value.IsThinking)
64+
{
65+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Cohere.ChatThinkingContent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Cohere.ChatThinkingContent?> ??
66+
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Cohere.ChatThinkingContent).Name}");
67+
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Thinking, typeInfo);
68+
}
5569
}
5670
}
5771
}

0 commit comments

Comments
 (0)