Skip to content

Commit

Permalink
Merge pull request #53 from tryAGI/bot/update-openapi_202409191824
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Sep 19, 2024
2 parents 6b047e5 + 5a7c8a9 commit db87da6
Show file tree
Hide file tree
Showing 68 changed files with 1,983 additions and 1,179 deletions.
12 changes: 6 additions & 6 deletions src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ partial void ProcessChatv2ResponseContent(
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Cohere.OneOf<global::Cohere.NonStreamedChatResponse2, global::Cohere.StreamedChatResponse2?>> Chatv2Async(
public async global::System.Threading.Tasks.Task<global::Cohere.OneOf<global::Cohere.ChatResponse, global::Cohere.StreamedChatResponseV2?>> Chatv2Async(
global::Cohere.Chatv2Request request,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand Down Expand Up @@ -91,7 +91,7 @@ partial void ProcessChatv2ResponseContent(
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Cohere.OneOf<global::Cohere.NonStreamedChatResponse2, global::Cohere.StreamedChatResponse2?>?), JsonSerializerContext) as global::Cohere.OneOf<global::Cohere.NonStreamedChatResponse2, global::Cohere.StreamedChatResponse2?>? ??
global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Cohere.OneOf<global::Cohere.ChatResponse, global::Cohere.StreamedChatResponseV2?>?), JsonSerializerContext) as global::Cohere.OneOf<global::Cohere.ChatResponse, global::Cohere.StreamedChatResponseV2?>? ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}

Expand Down Expand Up @@ -167,13 +167,13 @@ partial void ProcessChatv2ResponseContent(
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Cohere.OneOf<global::Cohere.NonStreamedChatResponse2, global::Cohere.StreamedChatResponse2?>> Chatv2Async(
public async global::System.Threading.Tasks.Task<global::Cohere.OneOf<global::Cohere.ChatResponse, global::Cohere.StreamedChatResponseV2?>> Chatv2Async(
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.ChatMessageV2> messages,
global::System.Collections.Generic.IList<global::Cohere.ToolV2>? tools = default,
global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.Document>>? documents = default,
global::Cohere.CitationOptions? citationOptions = default,
global::Cohere.ResponseFormat2? responseFormat = default,
global::Cohere.ResponseFormatV2? responseFormat = default,
global::Cohere.Chatv2RequestSafetyMode? safetyMode = default,
int? maxTokens = default,
global::System.Collections.Generic.IList<string>? stopSequences = default,
Expand Down
57 changes: 53 additions & 4 deletions src/libs/Cohere/Generated/Cohere.CohereApi.Embedv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ public partial class CohereApi
partial void PrepareEmbedv2Arguments(
global::System.Net.Http.HttpClient httpClient,
ref string? xClientName,
global::Cohere.V2EmbedRequest request);
global::Cohere.Embedv2Request request);
partial void PrepareEmbedv2Request(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string? xClientName,
global::Cohere.V2EmbedRequest request);
global::Cohere.Embedv2Request request);
partial void ProcessEmbedv2Response(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);
Expand All @@ -34,10 +34,12 @@ partial void ProcessEmbedv2ResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Cohere.EmbedByTypeResponse> Embedv2Async(
global::Cohere.V2EmbedRequest request,
global::Cohere.Embedv2Request request,
string? xClientName = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));

PrepareArguments(
client: _httpClient);
PrepareEmbedv2Arguments(
Expand Down Expand Up @@ -108,14 +110,61 @@ partial void ProcessEmbedv2ResponseContent(
/// If you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](/docs/semantic-search).
/// </summary>
/// <param name="xClientName"></param>
/// <param name="texts">
/// An array of strings for the model to embed. Maximum number of texts per call is `96`. We recommend reducing the length of each text to be under `512` tokens for optimal quality.
/// </param>
/// <param name="model">
/// Defaults to embed-english-v2.0<br/>
/// The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](/docs/training-custom-models) can also be supplied with their full ID.<br/>
/// Available models and corresponding embedding dimensions:<br/>
/// * `embed-english-v3.0` 1024<br/>
/// * `embed-multilingual-v3.0` 1024<br/>
/// * `embed-english-light-v3.0` 384<br/>
/// * `embed-multilingual-light-v3.0` 384<br/>
/// * `embed-english-v2.0` 4096<br/>
/// * `embed-english-light-v2.0` 1024<br/>
/// * `embed-multilingual-v2.0` 768
/// </param>
/// <param name="inputType">
/// Specifies the type of input passed to the model. Required for embedding models v3 and higher.<br/>
/// - `"search_document"`: Used for embeddings stored in a vector database for search use-cases.<br/>
/// - `"search_query"`: Used for embeddings of search queries run against a vector DB to find relevant documents.<br/>
/// - `"classification"`: Used for embeddings passed through a text classifier.<br/>
/// - `"clustering"`: Used for the embeddings run through a clustering algorithm.<br/>
/// - `"image"`: Used for embeddings with image input.
/// </param>
/// <param name="embeddingTypes">
/// Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types.<br/>
/// * `"float"`: Use this when you want to get back the default float embeddings. Valid for all models.<br/>
/// * `"int8"`: Use this when you want to get back signed int8 embeddings. Valid for only v3 models.<br/>
/// * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Valid for only v3 models.<br/>
/// * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for only v3 models.<br/>
/// * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models.
/// </param>
/// <param name="truncate">
/// One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.<br/>
/// Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model.<br/>
/// If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned.<br/>
/// Default Value: END
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Cohere.EmbedByTypeResponse> Embedv2Async(
string model,
string? xClientName = default,
global::System.Collections.Generic.IList<string>? texts = default,
global::Cohere.EmbedInputType? inputType = default,
global::System.Collections.Generic.IList<global::Cohere.EmbeddingType>? embeddingTypes = default,
global::Cohere.Embedv2RequestTruncate? truncate = global::Cohere.Embedv2RequestTruncate.END,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Cohere.V2EmbedRequest
var request = new global::Cohere.Embedv2Request
{
Texts = texts,
Model = model,
InputType = inputType,
EmbeddingTypes = embeddingTypes,
Truncate = truncate,
};

return await Embedv2Async(
Expand Down
166 changes: 166 additions & 0 deletions src/libs/Cohere/Generated/Cohere.CohereApi.Rerankv2.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@

#nullable enable

namespace Cohere
{
public partial class CohereApi
{
partial void PrepareRerankv2Arguments(
global::System.Net.Http.HttpClient httpClient,
ref string? xClientName,
global::Cohere.Rerankv2Request request);
partial void PrepareRerankv2Request(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string? xClientName,
global::Cohere.Rerankv2Request request);
partial void ProcessRerankv2Response(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

partial void ProcessRerankv2ResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);

/// <summary>
/// Rerank<br/>
/// This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.
/// </summary>
/// <param name="xClientName"></param>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Cohere.Rerankv2Response> Rerankv2Async(
global::Cohere.Rerankv2Request request,
string? xClientName = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));

PrepareArguments(
client: _httpClient);
PrepareRerankv2Arguments(
httpClient: _httpClient,
xClientName: ref xClientName,
request: request);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/v2/rerank", global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
encoding: global::System.Text.Encoding.UTF8,
mediaType: "application/json");
httpRequest.Content = __httpRequestContent;

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareRerankv2Request(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
xClientName: xClientName,
request: request);

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
ProcessRerankv2Response(
httpClient: _httpClient,
httpResponseMessage: response);

var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: _httpClient,
response: response,
content: ref __content);
ProcessRerankv2ResponseContent(
httpClient: _httpClient,
httpResponseMessage: response,
content: ref __content);

try
{
response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException ex)
{
throw new global::System.InvalidOperationException(__content, ex);
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Cohere.Rerankv2Response), JsonSerializerContext) as global::Cohere.Rerankv2Response ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}

/// <summary>
/// Rerank<br/>
/// This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.
/// </summary>
/// <param name="xClientName"></param>
/// <param name="model">
/// The identifier of the model to use, one of : `rerank-english-v3.0`, `rerank-multilingual-v3.0`, `rerank-english-v2.0`, `rerank-multilingual-v2.0`
/// </param>
/// <param name="query">
/// The search query
/// </param>
/// <param name="documents">
/// A list of document objects or strings to rerank.<br/>
/// If a document is provided the text fields is required and all other fields will be preserved in the response.<br/>
/// The total max chunks (length of documents * max_chunks_per_doc) must be less than 10000.<br/>
/// We recommend a maximum of 1,000 documents for optimal endpoint performance.
/// </param>
/// <param name="topN">
/// The number of most relevant documents or indices to return, defaults to the length of the documents
/// </param>
/// <param name="rankFields">
/// If a JSON object is provided, you can specify which keys you would like to have considered for reranking. The model will rerank based on order of the fields passed in (i.e. rank_fields=['title','author','text'] will rerank using the values in title, author, text sequentially. If the length of title, author, and text exceeds the context length of the model, the chunking will not re-consider earlier fields). If not provided, the model will use the default text field for ranking.
/// </param>
/// <param name="returnDocuments">
/// - If false, returns results without the doc text - the api will return a list of {index, relevance score} where index is inferred from the list passed into the request.<br/>
/// - If true, returns results with the doc text passed in - the api will return an ordered list of {index, text, relevance score} where index + text refers to the list passed into the request.<br/>
/// Default Value: false
/// </param>
/// <param name="maxChunksPerDoc">
/// The maximum number of chunks to produce internally from a document<br/>
/// Default Value: 10
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Cohere.Rerankv2Response> Rerankv2Async(
string model,
string query,
global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.RerankDocument>> documents,
string? xClientName = default,
int? topN = default,
global::System.Collections.Generic.IList<string>? rankFields = default,
bool? returnDocuments = false,
int? maxChunksPerDoc = 10,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Cohere.Rerankv2Request
{
Model = model,
Query = query,
Documents = documents,
TopN = topN,
RankFields = rankFields,
ReturnDocuments = returnDocuments,
MaxChunksPerDoc = maxChunksPerDoc,
};

return await Rerankv2Async(
xClientName: xClientName,
request: request,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
}
10 changes: 5 additions & 5 deletions src/libs/Cohere/Generated/Cohere.ICohereApi.Chatv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial interface ICohereApi
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Cohere.OneOf<global::Cohere.NonStreamedChatResponse2, global::Cohere.StreamedChatResponse2?>> Chatv2Async(
global::System.Threading.Tasks.Task<global::Cohere.OneOf<global::Cohere.ChatResponse, global::Cohere.StreamedChatResponseV2?>> Chatv2Async(
global::Cohere.Chatv2Request request,
global::System.Threading.CancellationToken cancellationToken = default);

Expand Down Expand Up @@ -87,13 +87,13 @@ public partial interface ICohereApi
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Cohere.OneOf<global::Cohere.NonStreamedChatResponse2, global::Cohere.StreamedChatResponse2?>> Chatv2Async(
global::System.Threading.Tasks.Task<global::Cohere.OneOf<global::Cohere.ChatResponse, global::Cohere.StreamedChatResponseV2?>> Chatv2Async(
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.ChatMessageV2> messages,
global::System.Collections.Generic.IList<global::Cohere.ToolV2>? tools = default,
global::System.Collections.Generic.IList<global::Cohere.OneOf<string, global::Cohere.Document>>? documents = default,
global::Cohere.CitationOptions? citationOptions = default,
global::Cohere.ResponseFormat2? responseFormat = default,
global::Cohere.ResponseFormatV2? responseFormat = default,
global::Cohere.Chatv2RequestSafetyMode? safetyMode = default,
int? maxTokens = default,
global::System.Collections.Generic.IList<string>? stopSequences = default,
Expand Down
Loading

0 comments on commit db87da6

Please sign in to comment.