-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from tryAGI/bot/update-openapi_202408300121
feat:@coderabbitai
- Loading branch information
Showing
10 changed files
with
608 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/libs/Cohere/Generated/Cohere.Models.ChatRequestSafetyMode.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
#nullable enable | ||
|
||
namespace Cohere | ||
{ | ||
/// <summary> | ||
/// Used to select the [safety instruction](/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL.<br/> | ||
/// When `NONE` is specified, the safety instruction will be omitted.<br/> | ||
/// Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters.<br/> | ||
/// **Note**: This parameter is only compatible with models [Command R 08-2024](/docs/command-r#august-2024-release), [Command R+ 08-2024]((/docs/command-r-plus#august-2024-release) and newer.<br/> | ||
/// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments | ||
/// </summary> | ||
public enum ChatRequestSafetyMode | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
CONTEXTUAL, | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
STRICT, | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
NONE, | ||
} | ||
|
||
/// <summary> | ||
/// Enum extensions to do fast conversions without the reflection. | ||
/// </summary> | ||
public static class ChatRequestSafetyModeExtensions | ||
{ | ||
/// <summary> | ||
/// Converts an enum to a string. | ||
/// </summary> | ||
public static string ToValueString(this ChatRequestSafetyMode value) | ||
{ | ||
return value switch | ||
{ | ||
ChatRequestSafetyMode.CONTEXTUAL => "CONTEXTUAL", | ||
ChatRequestSafetyMode.STRICT => "STRICT", | ||
ChatRequestSafetyMode.NONE => "NONE", | ||
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), | ||
}; | ||
} | ||
/// <summary> | ||
/// Converts an string to a enum. | ||
/// </summary> | ||
public static ChatRequestSafetyMode? ToEnum(string value) | ||
{ | ||
return value switch | ||
{ | ||
"CONTEXTUAL" => ChatRequestSafetyMode.CONTEXTUAL, | ||
"STRICT" => ChatRequestSafetyMode.STRICT, | ||
"NONE" => ChatRequestSafetyMode.NONE, | ||
_ => null, | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/libs/Cohere/Generated/JsonConverters.ChatRequestSafetyMode.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#nullable enable | ||
|
||
namespace OpenApiGenerator.JsonConverters | ||
{ | ||
/// <inheritdoc /> | ||
public sealed class ChatRequestSafetyModeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.ChatRequestSafetyMode> | ||
{ | ||
/// <inheritdoc /> | ||
public override global::Cohere.ChatRequestSafetyMode 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.ChatRequestSafetyModeExtensions.ToEnum(stringValue) ?? default; | ||
} | ||
|
||
break; | ||
} | ||
case global::System.Text.Json.JsonTokenType.Number: | ||
{ | ||
var numValue = reader.GetInt32(); | ||
return (global::Cohere.ChatRequestSafetyMode)numValue; | ||
} | ||
default: | ||
throw new global::System.ArgumentOutOfRangeException(nameof(reader)); | ||
} | ||
|
||
return default; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override void Write( | ||
global::System.Text.Json.Utf8JsonWriter writer, | ||
global::Cohere.ChatRequestSafetyMode value, | ||
global::System.Text.Json.JsonSerializerOptions options) | ||
{ | ||
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); | ||
|
||
writer.WriteStringValue(global::Cohere.ChatRequestSafetyModeExtensions.ToValueString(value)); | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/libs/Cohere/Generated/JsonConverters.ChatRequestSafetyModeNullable.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#nullable enable | ||
|
||
namespace OpenApiGenerator.JsonConverters | ||
{ | ||
/// <inheritdoc /> | ||
public sealed class ChatRequestSafetyModeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Cohere.ChatRequestSafetyMode?> | ||
{ | ||
/// <inheritdoc /> | ||
public override global::Cohere.ChatRequestSafetyMode? 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.ChatRequestSafetyModeExtensions.ToEnum(stringValue); | ||
} | ||
|
||
break; | ||
} | ||
case global::System.Text.Json.JsonTokenType.Number: | ||
{ | ||
var numValue = reader.GetInt32(); | ||
return (global::Cohere.ChatRequestSafetyMode)numValue; | ||
} | ||
default: | ||
throw new global::System.ArgumentOutOfRangeException(nameof(reader)); | ||
} | ||
|
||
return default; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override void Write( | ||
global::System.Text.Json.Utf8JsonWriter writer, | ||
global::Cohere.ChatRequestSafetyMode? 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.ChatRequestSafetyModeExtensions.ToValueString(value.Value)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.