Skip to content
Merged
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
6 changes: 2 additions & 4 deletions src/libs/Cohere/Generated/Cohere.Models.ImageContent.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Cohere
public sealed partial class ImageContent
{
/// <summary>
/// Base64 url of image.
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("image_url")]
[global::System.Text.Json.Serialization.JsonRequired]
Expand All @@ -32,9 +32,7 @@ public sealed partial class ImageContent
/// <summary>
/// Initializes a new instance of the <see cref="ImageContent" /> class.
/// </summary>
/// <param name="imageUrl">
/// Base64 url of image.
/// </param>
/// <param name="imageUrl"></param>
/// <param name="type">
/// Type of message content
/// </param>
Expand Down
22 changes: 18 additions & 4 deletions src/libs/Cohere/Generated/Cohere.Models.ImageUrl.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
namespace Cohere
{
/// <summary>
/// Base64 url of image.
///
/// </summary>
public sealed partial class ImageUrl
{
/// <summary>
///
/// Controls the level of detail in image processing. `"auto"` is the default and lets the system choose, `"low"` is faster but less detailed, and `"high"` preserves maximum detail. You can save tokens and speed up responses by using detail: `"low"`.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("detail")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Cohere.JsonConverters.ImageUrlDetailJsonConverter))]
public global::Cohere.ImageUrlDetail? Detail { get; set; }

/// <summary>
/// URL of an image. Can be either a base64 data URI or a web URL.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("url")]
[global::System.Text.Json.Serialization.JsonRequired]
Expand All @@ -24,14 +31,21 @@ public sealed partial class ImageUrl
/// <summary>
/// Initializes a new instance of the <see cref="ImageUrl" /> class.
/// </summary>
/// <param name="url"></param>
/// <param name="detail">
/// Controls the level of detail in image processing. `"auto"` is the default and lets the system choose, `"low"` is faster but less detailed, and `"high"` preserves maximum detail. You can save tokens and speed up responses by using detail: `"low"`.
/// </param>
/// <param name="url">
/// URL of an image. Can be either a base64 data URI or a web URL.
/// </param>
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
public ImageUrl(
string url)
string url,
global::Cohere.ImageUrlDetail? detail)
{
this.Url = url ?? throw new global::System.ArgumentNullException(nameof(url));
this.Detail = detail;
}

/// <summary>
Expand Down
57 changes: 57 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.ImageUrlDetail.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

#nullable enable

namespace Cohere
{
/// <summary>
/// Controls the level of detail in image processing. `"auto"` is the default and lets the system choose, `"low"` is faster but less detailed, and `"high"` preserves maximum detail. You can save tokens and speed up responses by using detail: `"low"`.
/// </summary>
public enum ImageUrlDetail
{
/// <summary>
/// `"low"`.
/// </summary>
Auto,
/// <summary>
/// `"low"`.
/// </summary>
Low,
/// <summary>
/// `"low"`.
/// </summary>
High,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class ImageUrlDetailExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this ImageUrlDetail value)
{
return value switch
{
ImageUrlDetail.Auto => "auto",
ImageUrlDetail.Low => "low",
ImageUrlDetail.High => "high",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static ImageUrlDetail? ToEnum(string value)
{
return value switch
{
"auto" => ImageUrlDetail.Auto,
"low" => ImageUrlDetail.Low,
"high" => ImageUrlDetail.High,
_ => null,
};
}
}
}
49 changes: 49 additions & 0 deletions src/libs/Cohere/Generated/JsonConverters.ImageUrlDetail.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace Cohere.JsonConverters
{
/// <inheritdoc />
public sealed class ImageUrlDetailJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.ImageUrlDetail>
{
/// <inheritdoc />
public override global::Cohere.ImageUrlDetail 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::Cohere.ImageUrlDetailExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Cohere.ImageUrlDetail)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Cohere.ImageUrlDetail value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Cohere.ImageUrlDetailExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#nullable enable

namespace Cohere.JsonConverters
{
/// <inheritdoc />
public sealed class ImageUrlDetailNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.ImageUrlDetail?>
{
/// <inheritdoc />
public override global::Cohere.ImageUrlDetail? 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::Cohere.ImageUrlDetailExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Cohere.ImageUrlDetail)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Cohere.ImageUrlDetail? 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::Cohere.ImageUrlDetailExtensions.ToValueString(value.Value));
}
}
}
}
2 changes: 2 additions & 0 deletions src/libs/Cohere/Generated/JsonSerializerContext.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ namespace Cohere
typeof(global::Cohere.JsonConverters.ChatRoleNullableJsonConverter),
typeof(global::Cohere.JsonConverters.ChatMessageStartEventVariant2DeltaMessageRoleJsonConverter),
typeof(global::Cohere.JsonConverters.ChatMessageStartEventVariant2DeltaMessageRoleNullableJsonConverter),
typeof(global::Cohere.JsonConverters.ImageUrlDetailJsonConverter),
typeof(global::Cohere.JsonConverters.ImageUrlDetailNullableJsonConverter),
typeof(global::Cohere.JsonConverters.ContentTypeJsonConverter),
typeof(global::Cohere.JsonConverters.ContentTypeNullableJsonConverter),
typeof(global::Cohere.JsonConverters.ContentDiscriminatorTypeJsonConverter),
Expand Down
Loading
Loading