Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Add user authentication feature to the login module #23

Merged
merged 1 commit into from
Aug 27, 2024
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
13 changes: 8 additions & 5 deletions src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
ref string content);

/// <summary>
/// Chat with the model
/// Chat with the model<br/>
/// Generates a message from the model in response to a provided conversation. To learn how to use the Chat API with Streaming and RAG follow our Text Generation guides.
/// </summary>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
Expand Down Expand Up @@ -95,13 +96,15 @@
}

/// <summary>
/// Chat with the model
/// Chat with the model<br/>
/// Generates a message from the model in response to a provided conversation. To learn how to use the Chat API with Streaming and RAG follow our Text Generation guides.
/// </summary>
/// <param name="model">
/// The model to use for the chat.
/// The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) (such as command-r or command-r-plus) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model.
/// </param>
/// <param name="messages">
/// A list of chat messages representing the list chat message turns.
/// A list of chat messages in chronological order, representing a conversation between the user and the model.<br/>
/// Messages can be from `User`, `Assistant`, `Tool` and `System` roles. Learn more about messages and roles in [the Chat API guide](https://docs.cohere.com/docs/chat-api).
/// </param>
/// <param name="tools">
/// A list of available tools (functions) that the model may suggest invoking before producing a text response.<br/>
Expand Down Expand Up @@ -160,7 +163,7 @@
global::System.Collections.Generic.IList<global::Cohere.ChatMessage2> messages,
global::System.Collections.Generic.IList<global::Cohere.Tool2>? tools = default,
global::Cohere.Chatv2RequestCitationMode? citationMode = default,
global::Cohere.ResponseFormat? responseFormat = default,
global::Cohere.ResponseFormat2? responseFormat = default,
int maxTokens = default,
global::System.Collections.Generic.IList<string>? stopSequences = default,
float temperature = default,
Expand All @@ -168,7 +171,7 @@
float frequencyPenalty = default,
float presencePenalty = default,
float k = 0,
float p = 0.75,

Check failure on line 174 in src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs

View workflow job for this annotation

GitHub Actions / Test / Build, test and publish

A value of type 'double' cannot be used as a default parameter because there are no standard conversions to type 'float'

Check failure on line 174 in src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs

View workflow job for this annotation

GitHub Actions / Test / Build, test and publish

A value of type 'double' cannot be used as a default parameter because there are no standard conversions to type 'float'

Check failure on line 174 in src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs

View workflow job for this annotation

GitHub Actions / Test / Build, test and publish

A value of type 'double' cannot be used as a default parameter because there are no standard conversions to type 'float'

Check failure on line 174 in src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs

View workflow job for this annotation

GitHub Actions / Test / Build, test and publish

A value of type 'double' cannot be used as a default parameter because there are no standard conversions to type 'float'

Check failure on line 174 in src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs

View workflow job for this annotation

GitHub Actions / Test / Build, test and publish

A value of type 'double' cannot be used as a default parameter because there are no standard conversions to type 'float'

Check failure on line 174 in src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs

View workflow job for this annotation

GitHub Actions / Test / Build, test and publish

A value of type 'double' cannot be used as a default parameter because there are no standard conversions to type 'float'

Check failure on line 174 in src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs

View workflow job for this annotation

GitHub Actions / Test / Build, test and publish

A value of type 'double' cannot be used as a default parameter because there are no standard conversions to type 'float'

Check failure on line 174 in src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs

View workflow job for this annotation

GitHub Actions / Test / Build, test and publish

A value of type 'double' cannot be used as a default parameter because there are no standard conversions to type 'float'
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Cohere.Chatv2Request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

#pragma warning disable CS0618 // Type or member is obsolete

#nullable enable

namespace Cohere
Expand Down Expand Up @@ -31,7 +33,8 @@ public sealed partial class AssistantMessage
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("content")]
public global::System.Collections.Generic.IList<global::Cohere.TextContent>? Content { get; set; }
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))]
public global::System.OneOf<string?, global::System.Collections.Generic.IList<global::System.OneOf<global::Cohere.TextContent>>>? Content { get; set; }

/// <summary>
///
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

#pragma warning disable CS0618 // Type or member is obsolete

#nullable enable

namespace Cohere
{
/// <summary>
/// A message from the assistant role can contain text and tool call information.
/// </summary>
public sealed partial class AssistantMessageResponse
{
/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("role")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AssistantMessageResponseRoleJsonConverter))]
public global::Cohere.AssistantMessageResponseRole Role { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("tool_calls")]
public global::System.Collections.Generic.IList<global::Cohere.ToolCall2>? ToolCalls { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("tool_plan")]
public string? ToolPlan { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("content")]
public global::System.Collections.Generic.IList<global::System.OneOf<global::Cohere.TextContent>>? Content { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("citations")]
public global::System.Collections.Generic.IList<global::Cohere.Citation>? Citations { 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
@@ -0,0 +1,45 @@

#nullable enable

namespace Cohere
{
/// <summary>
///
/// </summary>
public enum AssistantMessageResponseRole
{
/// <summary>
///
/// </summary>
Assistant,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class AssistantMessageResponseRoleExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this AssistantMessageResponseRole value)
{
return value switch
{
AssistantMessageResponseRole.Assistant => "assistant",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static AssistantMessageResponseRole? ToEnum(string value)
{
return value switch
{
"assistant" => AssistantMessageResponseRole.Assistant,
_ => null,
};
}
}
}
64 changes: 32 additions & 32 deletions src/libs/Cohere/Generated/Cohere.Models.ChatMessage2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,105 +14,105 @@ namespace Cohere
///
/// </summary>
#if NET6_0_OR_GREATER
public global::Cohere.SystemMessage? SystemMessage { get; init; }
public global::Cohere.UserMessage? UserMessage { get; init; }
#else
public global::Cohere.SystemMessage? SystemMessage { get; }
public global::Cohere.UserMessage? UserMessage { get; }
#endif

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

/// <summary>
///
/// </summary>
public static implicit operator ChatMessage2(global::Cohere.SystemMessage value) => new ChatMessage2(value);
public static implicit operator ChatMessage2(global::Cohere.UserMessage value) => new ChatMessage2(value);

/// <summary>
///
/// </summary>
public static implicit operator global::Cohere.SystemMessage?(ChatMessage2 @this) => @this.SystemMessage;
public static implicit operator global::Cohere.UserMessage?(ChatMessage2 @this) => @this.UserMessage;

/// <summary>
///
/// </summary>
public ChatMessage2(global::Cohere.SystemMessage? value)
public ChatMessage2(global::Cohere.UserMessage? value)
{
SystemMessage = value;
UserMessage = value;
}

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

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

/// <summary>
///
/// </summary>
public static implicit operator ChatMessage2(global::Cohere.UserMessage value) => new ChatMessage2(value);
public static implicit operator ChatMessage2(global::Cohere.AssistantMessage value) => new ChatMessage2(value);

/// <summary>
///
/// </summary>
public static implicit operator global::Cohere.UserMessage?(ChatMessage2 @this) => @this.UserMessage;
public static implicit operator global::Cohere.AssistantMessage?(ChatMessage2 @this) => @this.AssistantMessage;

/// <summary>
///
/// </summary>
public ChatMessage2(global::Cohere.UserMessage? value)
public ChatMessage2(global::Cohere.AssistantMessage? value)
{
UserMessage = value;
AssistantMessage = value;
}

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

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

/// <summary>
///
/// </summary>
public static implicit operator ChatMessage2(global::Cohere.AssistantMessage value) => new ChatMessage2(value);
public static implicit operator ChatMessage2(global::Cohere.SystemMessage value) => new ChatMessage2(value);

/// <summary>
///
/// </summary>
public static implicit operator global::Cohere.AssistantMessage?(ChatMessage2 @this) => @this.AssistantMessage;
public static implicit operator global::Cohere.SystemMessage?(ChatMessage2 @this) => @this.SystemMessage;

/// <summary>
///
/// </summary>
public ChatMessage2(global::Cohere.AssistantMessage? value)
public ChatMessage2(global::Cohere.SystemMessage? value)
{
AssistantMessage = value;
SystemMessage = value;
}

/// <summary>
Expand Down Expand Up @@ -154,15 +154,15 @@ public ChatMessage2(global::Cohere.ToolMessage2? value)
///
/// </summary>
public ChatMessage2(
global::Cohere.SystemMessage? systemMessage,
global::Cohere.UserMessage? userMessage,
global::Cohere.AssistantMessage? assistantMessage,
global::Cohere.SystemMessage? systemMessage,
global::Cohere.ToolMessage2? tool
)
{
SystemMessage = systemMessage;
UserMessage = userMessage;
AssistantMessage = assistantMessage;
SystemMessage = systemMessage;
Tool = tool;
}

Expand All @@ -171,17 +171,17 @@ public ChatMessage2(
/// </summary>
public object? Object =>
Tool as object ??
SystemMessage as object ??
AssistantMessage as object ??
UserMessage as object ??
SystemMessage as object
UserMessage as object
;

/// <summary>
///
/// </summary>
public bool Validate()
{
return IsSystemMessage && !IsUserMessage && !IsAssistantMessage && !IsTool || !IsSystemMessage && IsUserMessage && !IsAssistantMessage && !IsTool || !IsSystemMessage && !IsUserMessage && IsAssistantMessage && !IsTool || !IsSystemMessage && !IsUserMessage && !IsAssistantMessage && IsTool;
return IsUserMessage && !IsAssistantMessage && !IsSystemMessage && !IsTool || !IsUserMessage && IsAssistantMessage && !IsSystemMessage && !IsTool || !IsUserMessage && !IsAssistantMessage && IsSystemMessage && !IsTool || !IsUserMessage && !IsAssistantMessage && !IsSystemMessage && IsTool;
}

/// <summary>
Expand All @@ -191,12 +191,12 @@ public override int GetHashCode()
{
var fields = new object?[]
{
SystemMessage,
typeof(global::Cohere.SystemMessage),
UserMessage,
typeof(global::Cohere.UserMessage),
AssistantMessage,
typeof(global::Cohere.AssistantMessage),
SystemMessage,
typeof(global::Cohere.SystemMessage),
Tool,
typeof(global::Cohere.ToolMessage2),
};
Expand All @@ -214,9 +214,9 @@ static int HashCodeAggregator(int hashCode, object? value) => value == null
public bool Equals(ChatMessage2 other)
{
return
global::System.Collections.Generic.EqualityComparer<global::Cohere.SystemMessage?>.Default.Equals(SystemMessage, other.SystemMessage) &&
global::System.Collections.Generic.EqualityComparer<global::Cohere.UserMessage?>.Default.Equals(UserMessage, other.UserMessage) &&
global::System.Collections.Generic.EqualityComparer<global::Cohere.AssistantMessage?>.Default.Equals(AssistantMessage, other.AssistantMessage) &&
global::System.Collections.Generic.EqualityComparer<global::Cohere.SystemMessage?>.Default.Equals(SystemMessage, other.SystemMessage) &&
global::System.Collections.Generic.EqualityComparer<global::Cohere.ToolMessage2?>.Default.Equals(Tool, other.Tool)
;
}
Expand Down
9 changes: 5 additions & 4 deletions src/libs/Cohere/Generated/Cohere.Models.Chatv2Request.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ namespace Cohere
public sealed partial class Chatv2Request
{
/// <summary>
/// The model to use for the chat.
/// The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) (such as command-r or command-r-plus) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("model")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string Model { get; set; }

/// <summary>
/// A list of chat messages representing the list chat message turns.
/// A list of chat messages in chronological order, representing a conversation between the user and the model.<br/>
/// Messages can be from `User`, `Assistant`, `Tool` and `System` roles. Learn more about messages and roles in [the Chat API guide](https://docs.cohere.com/docs/chat-api).
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("messages")]
[global::System.Text.Json.Serialization.JsonRequired]
Expand Down Expand Up @@ -45,8 +46,8 @@ public sealed partial class Chatv2Request
/// **Limitation**: The parameter is not supported in RAG mode (when any of `connectors`, `documents`, `tools`, `tool_results` are provided).
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("response_format")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.ResponseFormatJsonConverter))]
public global::Cohere.ResponseFormat? ResponseFormat { get; set; }
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.ResponseFormat2JsonConverter))]
public global::Cohere.ResponseFormat2? ResponseFormat { get; set; }

/// <summary>
/// The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.
Expand Down
Loading
Loading