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 documents parameter and Document class to Cohere API #50

Merged
merged 1 commit into from
Sep 17, 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
5 changes: 5 additions & 0 deletions src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ partial void ProcessChatv2ResponseContent(
/// A list of available tools (functions) that the model may suggest invoking before producing a text response.<br/>
/// When `tools` is passed (without `tool_results`), the `text` content in the response will be empty and the `tool_calls` field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the `tool_calls` array will be empty.
/// </param>
/// <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.
Expand Down Expand Up @@ -169,6 +172,7 @@ partial void ProcessChatv2ResponseContent(
string model,
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider positioning the new optional parameter at the end of the parameter list to maintain API compatibility

Adding the new optional parameter documents in the middle of the parameters list may cause issues for users who call the method using positional arguments. To prevent breaking changes and maintain backward compatibility, it's recommended to add new optional parameters at the end of the parameter list.

Apply this diff to move the documents parameter to the end:

 public async global::System.Threading.Tasks.Task<global::Cohere.OneOf<global::Cohere.NonStreamedChatResponse2, global::Cohere.StreamedChatResponse2?>> Chatv2Async(
     string model,
     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.ResponseFormat2? responseFormat = default,
     global::Cohere.Chatv2RequestSafetyMode? safetyMode = default,
     int? maxTokens = default,
     global::System.Collections.Generic.IList<string>? stopSequences = default,
     float? temperature = default,
     int? seed = default,
     float? frequencyPenalty = default,
     float? presencePenalty = default,
     float? k = 0F,
     float? p = 0.75F,
     global::System.Threading.CancellationToken cancellationToken = default,
+    global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.Document>>? documents = default)

And update the assignment accordingly.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.Document>>? documents = default,
global::System.Threading.CancellationToken cancellationToken = default,
global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.Document>>? documents = default)

global::Cohere.Chatv2RequestCitationMode? citationMode = default,
global::Cohere.ResponseFormat2? responseFormat = default,
global::Cohere.Chatv2RequestSafetyMode? safetyMode = default,
Expand All @@ -187,6 +191,7 @@ partial void ProcessChatv2ResponseContent(
Model = model,
Messages = messages,
Tools = tools,
Documents = documents,
CitationMode = citationMode,
ResponseFormat = responseFormat,
SafetyMode = safetyMode,
Expand Down
4 changes: 4 additions & 0 deletions src/libs/Cohere/Generated/Cohere.ICohereApi.Chatv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public partial interface ICohereApi
/// A list of available tools (functions) that the model may suggest invoking before producing a text response.<br/>
/// When `tools` is passed (without `tool_results`), the `text` content in the response will be empty and the `tool_calls` field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the `tool_calls` array will be empty.
/// </param>
/// <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.
Expand Down Expand Up @@ -89,6 +92,7 @@ public partial interface ICohereApi
string model,
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider relocating the new optional parameter to maintain backward compatibility

Adding the documents optional parameter before other optional parameters may affect existing code that relies on positional arguments. To avoid potential breaking changes, it's recommended to add new optional parameters at the end of the parameter list.

Apply this diff to move the documents parameter to the end of the parameter list:

 public Task<OneOf<NonStreamedChatResponse2, StreamedChatResponse2?>> Chatv2Async(
     string model,
     IList<ChatMessage2> messages,
     IList<Tool2>? tools = default,
     Chatv2RequestCitationMode? citationMode = default,
     ResponseFormat2? responseFormat = default,
     Chatv2RequestSafetyMode? safetyMode = default,
     int? maxTokens = default,
     IList<string>? stopSequences = default,
     float? temperature = default,
     int? seed = default,
     float? frequencyPenalty = default,
     float? presencePenalty = default,
     float? k = 0F,
     float? p = 0.75F,
+    IList<OneOf<string, Document>>? documents = default,
     CancellationToken cancellationToken = default);

Committable suggestion was skipped due to low confidence.

global::Cohere.Chatv2RequestCitationMode? citationMode = default,
global::Cohere.ResponseFormat2? responseFormat = default,
global::Cohere.Chatv2RequestSafetyMode? safetyMode = default,
Expand Down
8 changes: 8 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.Chatv2Request.g.cs
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 @@ -30,6 +32,12 @@ public sealed partial class Chatv2Request
[global::System.Text.Json.Serialization.JsonPropertyName("tools")]
public global::System.Collections.Generic.IList<global::Cohere.Tool2>? Tools { get; set; }

/// <summary>
/// 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.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("documents")]
public global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.Document>>? Documents { get; set; }
Comment on lines +35 to +39
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure proper serialization of OneOf<string, Document>

The Documents property uses a union type OneOf<string, Document>. Ensure that the JSON serializer is configured to handle this union type correctly during serialization and deserialization. Missing or incorrect converters may lead to runtime errors or incorrect data handling.


/// <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.
Expand Down
32 changes: 32 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.Document.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

#nullable enable

namespace Cohere
{
/// <summary>
/// Relevant information that could be used by the model to generate a more accurate reply.<br/>
/// The content of each document are generally short (should be under 300 words). Metadata should be used to provide additional information, both the key name and the value will be<br/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix grammatical error in summary comment

The sentence "The content of each document are generally short..." should be "The content of each document is generally short..." to maintain subject-verb agreement.

Apply this diff to correct the grammatical error:

-/// The content of each document are generally short (should be under 300 words). Metadata should be used to provide additional information, both the key name and the value will be passed to the model.
+/// The content of each document is generally short (should be under 300 words). Metadata should be used to provide additional information; both the key name and the value will be passed to the model.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// The content of each document are generally short (should be under 300 words). Metadata should be used to provide additional information, both the key name and the value will be<br/>
/// The content of each document is generally short (should be under 300 words). Metadata should be used to provide additional information; both the key name and the value will be passed to the model.

/// passed to the model.
/// </summary>
public sealed partial class Document
{
/// <summary>
/// A relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary.
Comment on lines +13 to +14
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct grammatical error in property summary

The comment reads "A relevant documents that the model can cite..." which is grammatically incorrect. It should be "A relevant document that the model can cite..."

Apply this diff to fix the grammatical error:

-/// A relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary.
+/// A relevant document that the model can cite to generate a more accurate reply. Each document is a dictionary of string-string pairs.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// <summary>
/// A relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary.
/// <summary>
/// A relevant document that the model can cite to generate a more accurate reply. Each document is a dictionary of string-string pairs.

/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("data")]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::Cohere.DocumentData Data { get; set; }

/// <summary>
/// Unique identifier for this document which will be referenced in citations. If not provided an ID will be automatically generated
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("id")]
public string? Id { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow for nullable values in AdditionalProperties dictionary

To accommodate potential null values in AdditionalProperties, consider updating the type to IDictionary<string, object?>.

Apply this diff to update the type:

-public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
+public global::System.Collections.Generic.IDictionary<string, object?> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object?>();

Committable suggestion was skipped due to low confidence.

public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
33 changes: 33 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.DocumentContent.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

#nullable enable

namespace Cohere
{
/// <summary>
/// Document content.
/// </summary>
public sealed partial class DocumentContent
{
/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("type")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Cohere.JsonConverters.DocumentContentTypeJsonConverter))]
public global::Cohere.DocumentContentType Type { get; set; }

/// <summary>
/// Relevant information that could be used by the model to generate a more accurate reply.<br/>
/// The content of each document are generally short (should be under 300 words). Metadata should be used to provide additional information, both the key name and the value will be<br/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix grammatical error in the documentation comment

There is a grammatical error in the documentation. The sentence should use "is" instead of "are":

  • Incorrect: "The content of each document are generally short..."
  • Correct: "The content of each document is generally short..."

Apply this diff to correct the error:

- /// The content of each document are generally short (should be under 300 words). Metadata should be used to provide additional information, both the key name and the value will be<br/>
+ /// The content of each document is generally short (should be under 300 words). Metadata should be used to provide additional information; both the key name and the value will be<br/>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// The content of each document are generally short (should be under 300 words). Metadata should be used to provide additional information, both the key name and the value will be<br/>
/// The content of each document is generally short (should be under 300 words). Metadata should be used to provide additional information; both the key name and the value will be<br/>

/// passed to the model.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("document")]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::Cohere.Document Document { 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>();
}
}
45 changes: 45 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.DocumentContentType.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

#nullable enable

namespace Cohere
{
/// <summary>
///
/// </summary>
public enum DocumentContentType
{
/// <summary>
///
/// </summary>
Document,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class DocumentContentTypeExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this DocumentContentType value)
{
return value switch
{
DocumentContentType.Document => "document",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static DocumentContentType? ToEnum(string value)
{
return value switch
{
"document" => DocumentContentType.Document,
_ => null,
};
}
}
}
18 changes: 18 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.DocumentData.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#nullable enable

namespace Cohere
{
/// <summary>
/// A relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary.
/// </summary>
Comment on lines +7 to +8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the grammatical error in the summary comment.

The summary comment has a grammatical error that should be corrected for clarity.

Apply this diff to fix the typo:

-    /// A relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary.
+    /// Relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// A relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary.
/// </summary>
/// Relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary.
/// </summary>

public sealed partial class DocumentData
{

/// <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>();
}
}
166 changes: 166 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.ToolContent.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
using System.Linq;
#pragma warning disable CS0618 // Type or member is obsolete

#nullable enable

namespace Cohere
{
/// <summary>
/// A content block which contains information about the content of a tool result
/// </summary>
public readonly partial struct ToolContent : global::System.IEquatable<ToolContent>
{
/// <summary>
/// Text content of the message.
/// </summary>
#if NET6_0_OR_GREATER
public global::Cohere.TextContent? Text { get; init; }
#else
public global::Cohere.TextContent? Text { get; }
#endif

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

/// <summary>
///
/// </summary>
public static implicit operator ToolContent(global::Cohere.TextContent value) => new ToolContent(value);

/// <summary>
///
/// </summary>
public static implicit operator global::Cohere.TextContent?(ToolContent @this) => @this.Text;

/// <summary>
///
/// </summary>
public ToolContent(global::Cohere.TextContent? value)
{
Text = value;
}

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

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

/// <summary>
///
/// </summary>
public static implicit operator ToolContent(global::Cohere.DocumentContent value) => new ToolContent(value);

/// <summary>
///
/// </summary>
public static implicit operator global::Cohere.DocumentContent?(ToolContent @this) => @this.Document;

/// <summary>
///
/// </summary>
public ToolContent(global::Cohere.DocumentContent? value)
{
Document = value;
}

/// <summary>
///
/// </summary>
public ToolContent(
global::Cohere.TextContent? text,
global::Cohere.DocumentContent? document
)
{
Text = text;
Document = document;
}
Comment on lines +86 to +93
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enforce assignment of either Text or Document but not both

The constructor allows both Text and Document to be assigned simultaneously, which may lead to an invalid state per the Validate method. Consider enforcing that only one is assigned to prevent misuse.

Apply this diff to enforce the constraint:

 public ToolContent(
     global::Cohere.TextContent? text,
     global::Cohere.DocumentContent? document
     )
 {
+    if ((text == null) == (document == null))
+        throw new ArgumentException("Exactly one of 'text' or 'document' must be provided.");
     Text = text;
     Document = document;
 }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public ToolContent(
global::Cohere.TextContent? text,
global::Cohere.DocumentContent? document
)
{
Text = text;
Document = document;
}
public ToolContent(
global::Cohere.TextContent? text,
global::Cohere.DocumentContent? document
)
{
if ((text == null) == (document == null))
throw new ArgumentException("Exactly one of 'text' or 'document' must be provided.");
Text = text;
Document = document;
}


/// <summary>
///
/// </summary>
public object? Object =>
Document as object ??
Text as object
;

/// <summary>
///
/// </summary>
public bool Validate()
{
return IsText && !IsDocument || !IsText && IsDocument;
}
Comment on lines +106 to +109
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify the logic in the Validate method

The current condition in the Validate method can be simplified. Using IsText != IsDocument directly checks that exactly one of Text or Document is assigned.

Apply this diff to simplify the method:

 public bool Validate()
 {
-    return IsText && !IsDocument || !IsText && IsDocument;
+    return IsText != IsDocument;
 }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public bool Validate()
{
return IsText && !IsDocument || !IsText && IsDocument;
}
public bool Validate()
{
return IsText != IsDocument;
}


/// <summary>
///
/// </summary>
public override int GetHashCode()
{
var fields = new object?[]
{
Text,
typeof(global::Cohere.TextContent),
Document,
typeof(global::Cohere.DocumentContent),
};
const int offset = unchecked((int)2166136261);
const int prime = 16777619;
static int HashCodeAggregator(int hashCode, object? value) => value == null
? (hashCode ^ 0) * prime
: (hashCode ^ value.GetHashCode()) * prime;
return fields.Aggregate(offset, HashCodeAggregator);
}

/// <summary>
///
/// </summary>
public bool Equals(ToolContent other)
{
return
global::System.Collections.Generic.EqualityComparer<global::Cohere.TextContent?>.Default.Equals(Text, other.Text) &&
global::System.Collections.Generic.EqualityComparer<global::Cohere.DocumentContent?>.Default.Equals(Document, other.Document)
;
}

/// <summary>
///
/// </summary>
public static bool operator ==(ToolContent obj1, ToolContent obj2)
{
return global::System.Collections.Generic.EqualityComparer<ToolContent>.Default.Equals(obj1, obj2);
}
Comment on lines +147 to +148
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify the equality operator == implementation

You can simplify the == operator by directly calling the Equals method, improving readability.

Apply this diff:

 public static bool operator ==(ToolContent obj1, ToolContent obj2)
 {
-    return global::System.Collections.Generic.EqualityComparer<ToolContent>.Default.Equals(obj1, obj2);
+    return obj1.Equals(obj2);
 }

Committable suggestion was skipped due to low confidence.


/// <summary>
///
/// </summary>
public static bool operator !=(ToolContent obj1, ToolContent obj2)
{
return !(obj1 == obj2);
}
Comment on lines +153 to +156
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify the inequality operator != implementation

Consistent with the == operator, simplify the != operator for clarity.

Apply this diff:

 public static bool operator !=(ToolContent obj1, ToolContent obj2)
 {
-    return !(obj1 == obj2);
+    return !obj1.Equals(obj2);
 }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public static bool operator !=(ToolContent obj1, ToolContent obj2)
{
return !(obj1 == obj2);
}
public static bool operator !=(ToolContent obj1, ToolContent obj2)
{
return !obj1.Equals(obj2);
}


/// <summary>
///
/// </summary>
public override bool Equals(object? obj)
{
return obj is ToolContent o && Equals(o);
}
}
}
7 changes: 5 additions & 2 deletions src/libs/Cohere/Generated/Cohere.Models.ToolMessage2.g.cs
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 All @@ -23,11 +25,12 @@ public sealed partial class ToolMessage2
public required string ToolCallId { get; set; }

/// <summary>
/// A list of outputs from a tool. The content should formatted as a JSON object string
/// A single or list of outputs from a tool. The content should formatted as a JSON object string, or a list of tool content blocks
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("tool_content")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Cohere.JsonConverters.OneOfJsonConverterFactory2))]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::System.Collections.Generic.IList<string> ToolContent { get; set; }
public required global::Cohere.OneOf<string, global::System.Collections.Generic.IList<global::Cohere.ToolContent>> ToolContent { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
Expand Down
Loading
Loading