Skip to content

Commit

Permalink
feat: Updated OpenAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 17, 2024
1 parent ef6ce5e commit 34f6c54
Show file tree
Hide file tree
Showing 10 changed files with 630 additions and 598 deletions.
9 changes: 4 additions & 5 deletions src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ partial void ProcessChatv2ResponseContent(
/// <param name="documents">
/// A list of relevant documents that the model can cite to generate a more accurate reply. Each document is either a string or document object with content and metadata.
/// </param>
/// <param name="citationMode">
/// Defaults to `"accurate"`.<br/>
/// Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
/// <param name="citationOptions">
/// Options for controlling citation generation.
/// </param>
/// <param name="responseFormat">
/// Configuration for forcing the model output to adhere to the specified format. Supported on [Command R](https://docs.cohere.com/docs/command-r), [Command R+](https://docs.cohere.com/docs/command-r-plus) and newer models.<br/>
Expand Down Expand Up @@ -173,7 +172,7 @@ partial void ProcessChatv2ResponseContent(
global::System.Collections.Generic.IList<global::Cohere.ChatMessage2> messages,
global::System.Collections.Generic.IList<global::Cohere.Tool2>? tools = default,
global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.Document>>? documents = default,
global::Cohere.Chatv2RequestCitationMode? citationMode = default,
global::Cohere.CitationOptions? citationOptions = default,
global::Cohere.ResponseFormat2? responseFormat = default,
global::Cohere.Chatv2RequestSafetyMode? safetyMode = default,
int? maxTokens = default,
Expand All @@ -192,7 +191,7 @@ partial void ProcessChatv2ResponseContent(
Messages = messages,
Tools = tools,
Documents = documents,
CitationMode = citationMode,
CitationOptions = citationOptions,
ResponseFormat = responseFormat,
SafetyMode = safetyMode,
MaxTokens = maxTokens,
Expand Down
7 changes: 3 additions & 4 deletions src/libs/Cohere/Generated/Cohere.ICohereApi.Chatv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ public partial interface ICohereApi
/// <param name="documents">
/// A list of relevant documents that the model can cite to generate a more accurate reply. Each document is either a string or document object with content and metadata.
/// </param>
/// <param name="citationMode">
/// Defaults to `"accurate"`.<br/>
/// Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
/// <param name="citationOptions">
/// Options for controlling citation generation.
/// </param>
/// <param name="responseFormat">
/// Configuration for forcing the model output to adhere to the specified format. Supported on [Command R](https://docs.cohere.com/docs/command-r), [Command R+](https://docs.cohere.com/docs/command-r-plus) and newer models.<br/>
Expand Down Expand Up @@ -93,7 +92,7 @@ public partial interface ICohereApi
global::System.Collections.Generic.IList<global::Cohere.ChatMessage2> messages,
global::System.Collections.Generic.IList<global::Cohere.Tool2>? tools = default,
global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.Document>>? documents = default,
global::Cohere.Chatv2RequestCitationMode? citationMode = default,
global::Cohere.CitationOptions? citationOptions = default,
global::Cohere.ResponseFormat2? responseFormat = default,
global::Cohere.Chatv2RequestSafetyMode? safetyMode = default,
int? maxTokens = default,
Expand Down
8 changes: 3 additions & 5 deletions src/libs/Cohere/Generated/Cohere.Models.Chatv2Request.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ public sealed partial class Chatv2Request
public global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.Document>>? Documents { get; set; }

/// <summary>
/// Defaults to `"accurate"`.<br/>
/// Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
/// Options for controlling citation generation.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("citation_mode")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Cohere.JsonConverters.Chatv2RequestCitationModeJsonConverter))]
public global::Cohere.Chatv2RequestCitationMode? CitationMode { get; set; }
[global::System.Text.Json.Serialization.JsonPropertyName("citation_options")]
public global::Cohere.CitationOptions? CitationOptions { get; set; }

/// <summary>
/// Configuration for forcing the model output to adhere to the specified format. Supported on [Command R](https://docs.cohere.com/docs/command-r), [Command R+](https://docs.cohere.com/docs/command-r-plus) and newer models.<br/>
Expand Down
25 changes: 25 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.CitationOptions.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

#nullable enable

namespace Cohere
{
/// <summary>
/// Options for controlling citation generation.
/// </summary>
public sealed partial class CitationOptions
{
/// <summary>
/// Defaults to `"accurate"`.<br/>
/// Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("mode")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Cohere.JsonConverters.CitationOptionsModeJsonConverter))]
public global::Cohere.CitationOptionsMode? Mode { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Cohere
/// Defaults to `"accurate"`.<br/>
/// Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
/// </summary>
public enum Chatv2RequestCitationMode
public enum CitationOptionsMode
{
/// <summary>
///
Expand All @@ -26,31 +26,31 @@ public enum Chatv2RequestCitationMode
/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class Chatv2RequestCitationModeExtensions
public static class CitationOptionsModeExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this Chatv2RequestCitationMode value)
public static string ToValueString(this CitationOptionsMode value)
{
return value switch
{
Chatv2RequestCitationMode.FAST => "FAST",
Chatv2RequestCitationMode.ACCURATE => "ACCURATE",
Chatv2RequestCitationMode.OFF => "OFF",
CitationOptionsMode.FAST => "FAST",
CitationOptionsMode.ACCURATE => "ACCURATE",
CitationOptionsMode.OFF => "OFF",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static Chatv2RequestCitationMode? ToEnum(string value)
public static CitationOptionsMode? ToEnum(string value)
{
return value switch
{
"FAST" => Chatv2RequestCitationMode.FAST,
"ACCURATE" => Chatv2RequestCitationMode.ACCURATE,
"OFF" => Chatv2RequestCitationMode.OFF,
"FAST" => CitationOptionsMode.FAST,
"ACCURATE" => CitationOptionsMode.ACCURATE,
"OFF" => CitationOptionsMode.OFF,
_ => null,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Cohere.JsonConverters
{
/// <inheritdoc />
public sealed class Chatv2RequestCitationModeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.Chatv2RequestCitationMode>
public sealed class CitationOptionsModeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.CitationOptionsMode>
{
/// <inheritdoc />
public override global::Cohere.Chatv2RequestCitationMode Read(
public override global::Cohere.CitationOptionsMode Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
Expand All @@ -18,15 +18,15 @@ public sealed class Chatv2RequestCitationModeJsonConverter : global::System.Text
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Cohere.Chatv2RequestCitationModeExtensions.ToEnum(stringValue) ?? default;
return global::Cohere.CitationOptionsModeExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Cohere.Chatv2RequestCitationMode)numValue;
return (global::Cohere.CitationOptionsMode)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
Expand All @@ -38,12 +38,12 @@ public sealed class Chatv2RequestCitationModeJsonConverter : global::System.Text
/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Cohere.Chatv2RequestCitationMode value,
global::Cohere.CitationOptionsMode value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Cohere.Chatv2RequestCitationModeExtensions.ToValueString(value));
writer.WriteStringValue(global::Cohere.CitationOptionsModeExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Cohere.JsonConverters
{
/// <inheritdoc />
public sealed class Chatv2RequestCitationModeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.Chatv2RequestCitationMode?>
public sealed class CitationOptionsModeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.CitationOptionsMode?>
{
/// <inheritdoc />
public override global::Cohere.Chatv2RequestCitationMode? Read(
public override global::Cohere.CitationOptionsMode? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
Expand All @@ -18,15 +18,15 @@ public sealed class Chatv2RequestCitationModeNullableJsonConverter : global::Sys
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Cohere.Chatv2RequestCitationModeExtensions.ToEnum(stringValue);
return global::Cohere.CitationOptionsModeExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Cohere.Chatv2RequestCitationMode)numValue;
return (global::Cohere.CitationOptionsMode)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
Expand All @@ -38,7 +38,7 @@ public sealed class Chatv2RequestCitationModeNullableJsonConverter : global::Sys
/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Cohere.Chatv2RequestCitationMode? value,
global::Cohere.CitationOptionsMode? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
Expand All @@ -49,7 +49,7 @@ public override void Write(
}
else
{
writer.WriteStringValue(global::Cohere.Chatv2RequestCitationModeExtensions.ToValueString(value.Value));
writer.WriteStringValue(global::Cohere.CitationOptionsModeExtensions.ToValueString(value.Value));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libs/Cohere/Generated/JsonSerializerContext.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ namespace Cohere
typeof(global::Cohere.JsonConverters.ToolMessage2RoleNullableJsonConverter),
typeof(global::Cohere.JsonConverters.Tool2TypeJsonConverter),
typeof(global::Cohere.JsonConverters.Tool2TypeNullableJsonConverter),
typeof(global::Cohere.JsonConverters.CitationOptionsModeJsonConverter),
typeof(global::Cohere.JsonConverters.CitationOptionsModeNullableJsonConverter),
typeof(global::Cohere.JsonConverters.ResponseFormatType2JsonConverter),
typeof(global::Cohere.JsonConverters.ResponseFormatType2NullableJsonConverter),
typeof(global::Cohere.JsonConverters.ChatFinishReasonJsonConverter),
Expand Down Expand Up @@ -95,8 +97,6 @@ namespace Cohere
typeof(global::Cohere.JsonConverters.ChatRequestCitationQualityNullableJsonConverter),
typeof(global::Cohere.JsonConverters.ChatRequestSafetyModeJsonConverter),
typeof(global::Cohere.JsonConverters.ChatRequestSafetyModeNullableJsonConverter),
typeof(global::Cohere.JsonConverters.Chatv2RequestCitationModeJsonConverter),
typeof(global::Cohere.JsonConverters.Chatv2RequestCitationModeNullableJsonConverter),
typeof(global::Cohere.JsonConverters.Chatv2RequestSafetyModeJsonConverter),
typeof(global::Cohere.JsonConverters.Chatv2RequestSafetyModeNullableJsonConverter),
typeof(global::Cohere.JsonConverters.GenerateRequestTruncateJsonConverter),
Expand Down
Loading

0 comments on commit 34f6c54

Please sign in to comment.