diff --git a/src/libs/Cohere/Generated/Cohere.CohereClient.Chat.g.cs b/src/libs/Cohere/Generated/Cohere.CohereClient.Chat.g.cs index 5c2e235e..6565a5ed 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereClient.Chat.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereClient.Chat.g.cs @@ -651,11 +651,6 @@ partial void ProcessChatResponseContent( /// 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.
/// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments /// - /// - /// Accepts `{"id": "web-search"}`, and/or the `"id"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) one.
- /// When specified, the model's reply will be enriched with information found by querying each of the connectors (RAG).
- /// Compatible Deployments: Cohere Platform - /// /// /// An alternative to `chat_history`.
/// Providing a `conversation_id` creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
@@ -760,11 +755,6 @@ partial void ProcessChatResponseContent( /// **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes.
/// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments /// - /// - /// Defaults to `false`.
- /// When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated.
- /// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - /// /// /// If specified, the backend will make a best effort to sample tokens
/// deterministically, such that repeated requests with the same
@@ -832,7 +822,6 @@ partial void ProcessChatResponseContent( global::Cohere.ChatAccepts? accepts = default, global::System.Collections.Generic.IList? chatHistory = default, global::Cohere.ChatRequestCitationQuality? citationQuality = default, - global::System.Collections.Generic.IList? connectors = default, string? conversationId = default, global::System.Collections.Generic.IList? documents = default, bool? forceSingleStep = default, @@ -842,7 +831,6 @@ partial void ProcessChatResponseContent( bool? rawPrompting = default, global::Cohere.ResponseFormat? responseFormat = default, global::Cohere.ChatRequestSafetyMode? safetyMode = default, - bool? searchQueriesOnly = default, int? seed = default, bool? stream = default, float? temperature = default, @@ -854,7 +842,6 @@ partial void ProcessChatResponseContent( { ChatHistory = chatHistory, CitationQuality = citationQuality, - Connectors = connectors, ConversationId = conversationId, Documents = documents, ForceSingleStep = forceSingleStep, @@ -871,7 +858,6 @@ partial void ProcessChatResponseContent( RawPrompting = rawPrompting, ResponseFormat = responseFormat, SafetyMode = safetyMode, - SearchQueriesOnly = searchQueriesOnly, Seed = seed, StopSequences = stopSequences, Stream = stream, diff --git a/src/libs/Cohere/Generated/Cohere.CohereClient.Classify.g.cs b/src/libs/Cohere/Generated/Cohere.CohereClient.Classify.g.cs deleted file mode 100644 index b75666be..00000000 --- a/src/libs/Cohere/Generated/Cohere.CohereClient.Classify.g.cs +++ /dev/null @@ -1,687 +0,0 @@ - -#nullable enable - -namespace Cohere -{ - public partial class CohereClient - { - partial void PrepareClassifyArguments( - global::System.Net.Http.HttpClient httpClient, - ref string? xClientName, - global::Cohere.ClassifyRequest request); - partial void PrepareClassifyRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string? xClientName, - global::Cohere.ClassifyRequest request); - partial void ProcessClassifyResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessClassifyResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Classify
- /// This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference.
- /// Note: [Fine-tuned models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly. - ///
- /// - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task ClassifyAsync( - global::Cohere.ClassifyRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - request = request ?? throw new global::System.ArgumentNullException(nameof(request)); - - PrepareArguments( - client: HttpClient); - PrepareClassifyArguments( - httpClient: HttpClient, - xClientName: ref xClientName, - request: request); - - var __pathBuilder = new global::Cohere.PathBuilder( - path: "/v1/classify", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Post, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in Authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - if (xClientName != default) - { - __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); - } - - var __httpRequestContentBody = request.ToJson(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); - PrepareClassifyRequest( - 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); - ProcessClassifyResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::Cohere.ClassifyResponse2? __value_400 = null; - try - { - if (ReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Cohere.ClassifyResponse2.FromJson(__content_400, JsonSerializerContext); - } - else - { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Cohere.ClassifyResponse2.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 401) - { - string? __content_401 = null; - global::System.Exception? __exception_401 = null; - global::Cohere.ClassifyResponse3? __value_401 = null; - try - { - if (ReadResponseAsString) - { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_401 = global::Cohere.ClassifyResponse3.FromJson(__content_401, JsonSerializerContext); - } - else - { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_401 = await global::Cohere.ClassifyResponse3.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_401 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::Cohere.ClassifyResponse4? __value_403 = null; - try - { - if (ReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Cohere.ClassifyResponse4.FromJson(__content_403, JsonSerializerContext); - } - else - { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Cohere.ClassifyResponse4.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id - if ((int)__response.StatusCode == 404) - { - string? __content_404 = null; - global::System.Exception? __exception_404 = null; - global::Cohere.ClassifyResponse5? __value_404 = null; - try - { - if (ReadResponseAsString) - { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Cohere.ClassifyResponse5.FromJson(__content_404, JsonSerializerContext); - } - else - { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Cohere.ClassifyResponse5.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_404 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::Cohere.ClassifyResponse6? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Cohere.ClassifyResponse6.FromJson(__content_422, JsonSerializerContext); - } - else - { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Cohere.ClassifyResponse6.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Too many requests - if ((int)__response.StatusCode == 429) - { - string? __content_429 = null; - global::System.Exception? __exception_429 = null; - global::Cohere.ClassifyResponse7? __value_429 = null; - try - { - if (ReadResponseAsString) - { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Cohere.ClassifyResponse7.FromJson(__content_429, JsonSerializerContext); - } - else - { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Cohere.ClassifyResponse7.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_429 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseObject = __value_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request or response contains a deny-listed token. - if ((int)__response.StatusCode == 498) - { - string? __content_498 = null; - global::System.Exception? __exception_498 = null; - global::Cohere.ClassifyResponse8? __value_498 = null; - try - { - if (ReadResponseAsString) - { - __content_498 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_498 = global::Cohere.ClassifyResponse8.FromJson(__content_498, JsonSerializerContext); - } - else - { - var __contentStream_498 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_498 = await global::Cohere.ClassifyResponse8.FromJsonStreamAsync(__contentStream_498, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_498 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_498 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_498, - statusCode: __response.StatusCode) - { - ResponseBody = __content_498, - ResponseObject = __value_498, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request is cancelled by the user. - if ((int)__response.StatusCode == 499) - { - string? __content_499 = null; - global::System.Exception? __exception_499 = null; - global::Cohere.ClassifyResponse9? __value_499 = null; - try - { - if (ReadResponseAsString) - { - __content_499 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_499 = global::Cohere.ClassifyResponse9.FromJson(__content_499, JsonSerializerContext); - } - else - { - var __contentStream_499 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_499 = await global::Cohere.ClassifyResponse9.FromJsonStreamAsync(__contentStream_499, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_499 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_499 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_499, - statusCode: __response.StatusCode) - { - ResponseBody = __content_499, - ResponseObject = __value_499, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when an uncategorised internal server error occurs. - if ((int)__response.StatusCode == 500) - { - string? __content_500 = null; - global::System.Exception? __exception_500 = null; - global::Cohere.ClassifyResponse10? __value_500 = null; - try - { - if (ReadResponseAsString) - { - __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_500 = global::Cohere.ClassifyResponse10.FromJson(__content_500, JsonSerializerContext); - } - else - { - var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_500 = await global::Cohere.ClassifyResponse10.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_500 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the requested feature is not implemented. - if ((int)__response.StatusCode == 501) - { - string? __content_501 = null; - global::System.Exception? __exception_501 = null; - global::Cohere.ClassifyResponse11? __value_501 = null; - try - { - if (ReadResponseAsString) - { - __content_501 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_501 = global::Cohere.ClassifyResponse11.FromJson(__content_501, JsonSerializerContext); - } - else - { - var __contentStream_501 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_501 = await global::Cohere.ClassifyResponse11.FromJsonStreamAsync(__contentStream_501, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_501 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_501 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_501, - statusCode: __response.StatusCode) - { - ResponseBody = __content_501, - ResponseObject = __value_501, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time - if ((int)__response.StatusCode == 503) - { - string? __content_503 = null; - global::System.Exception? __exception_503 = null; - global::Cohere.ClassifyResponse12? __value_503 = null; - try - { - if (ReadResponseAsString) - { - __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_503 = global::Cohere.ClassifyResponse12.FromJson(__content_503, JsonSerializerContext); - } - else - { - var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_503 = await global::Cohere.ClassifyResponse12.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_503 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseObject = __value_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond - if ((int)__response.StatusCode == 504) - { - string? __content_504 = null; - global::System.Exception? __exception_504 = null; - global::Cohere.ClassifyResponse13? __value_504 = null; - try - { - if (ReadResponseAsString) - { - __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_504 = global::Cohere.ClassifyResponse13.FromJson(__content_504, JsonSerializerContext); - } - else - { - var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_504 = await global::Cohere.ClassifyResponse13.FromJsonStreamAsync(__contentStream_504, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_504 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_504 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_504, - statusCode: __response.StatusCode) - { - ResponseBody = __content_504, - ResponseObject = __value_504, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessClassifyResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::Cohere.ClassifyResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Cohere.ClassifyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - } - - /// - /// Classify
- /// This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference.
- /// Note: [Fine-tuned models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly. - ///
- /// - /// - /// An array of examples to provide context to the model. Each example is a text string and its associated label/class. Each unique label requires at least 2 examples associated with it; the maximum number of examples is 2500, and each example has a maximum length of 512 tokens. The values should be structured as `{text: "...",label: "..."}`.
- /// Note: [Fine-tuned Models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly.
- /// Included only in requests - /// - /// - /// A list of up to 96 texts to be classified. Each one must be a non-empty string.
- /// There is, however, no consistent, universal limit to the length a particular input can be. We perform classification on the first `x` tokens of each input, and `x` varies depending on which underlying model is powering classification. The maximum token length for each model is listed in the "max tokens" column [here](https://docs.cohere.com/docs/models).
- /// Note: by default the `truncate` parameter is set to `END`, so tokens exceeding the limit will be automatically dropped. This behavior can be disabled by setting `truncate` to `NONE`, which will result in validation errors for longer texts.
- /// Included only in requests - /// - /// - /// ID of a [Fine-tuned](https://docs.cohere.com/v2/docs/classify-starting-the-training) Classify model
- /// Included only in requests - /// - /// - /// The ID of a custom playground preset. You can create presets in the [playground](https://dashboard.cohere.com/playground). If you use a preset, all other parameters become optional, and any included parameters will override the preset's parameters.
- /// Included only in requests
- /// Example: my-preset-a58sbd - /// - /// - /// One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.
- /// 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.
- /// If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned.
- /// Default Value: END
- /// Included only in requests - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task ClassifyAsync( - global::System.Collections.Generic.IList examples, - global::System.Collections.Generic.IList inputs, - string model, - string preset, - global::Cohere.ClassifyRequestTruncate truncate, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - var __request = new global::Cohere.ClassifyRequest - { - Examples = examples, - Inputs = inputs, - Model = model, -#pragma warning disable CS0618 // Type or member is obsolete - Preset = preset, -#pragma warning restore CS0618 // Type or member is obsolete - Truncate = truncate, - }; - - return await ClassifyAsync( - xClientName: xClientName, - request: __request, - cancellationToken: cancellationToken).ConfigureAwait(false); - } - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.CohereClient.Generate.g.cs b/src/libs/Cohere/Generated/Cohere.CohereClient.Generate.g.cs deleted file mode 100644 index a76ad369..00000000 --- a/src/libs/Cohere/Generated/Cohere.CohereClient.Generate.g.cs +++ /dev/null @@ -1,778 +0,0 @@ - -#nullable enable - -namespace Cohere -{ - public partial class CohereClient - { - partial void PrepareGenerateArguments( - global::System.Net.Http.HttpClient httpClient, - ref string? xClientName, - global::Cohere.GenerateRequest request); - partial void PrepareGenerateRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string? xClientName, - global::Cohere.GenerateRequest request); - partial void ProcessGenerateResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessGenerateResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Generate
- /// <Warning>
- /// This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.
- /// </Warning>
- /// Generates realistic text conditioned on a given input. - ///
- /// - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task GenerateAsync( - global::Cohere.GenerateRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - request = request ?? throw new global::System.ArgumentNullException(nameof(request)); - - PrepareArguments( - client: HttpClient); - PrepareGenerateArguments( - httpClient: HttpClient, - xClientName: ref xClientName, - request: request); - - var __pathBuilder = new global::Cohere.PathBuilder( - path: "/v1/generate", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Post, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in Authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - if (xClientName != default) - { - __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); - } - - var __httpRequestContentBody = request.ToJson(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); - PrepareGenerateRequest( - 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); - ProcessGenerateResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::Cohere.GenerateResponse? __value_400 = null; - try - { - if (ReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Cohere.GenerateResponse.FromJson(__content_400, JsonSerializerContext); - } - else - { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Cohere.GenerateResponse.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 401) - { - string? __content_401 = null; - global::System.Exception? __exception_401 = null; - global::Cohere.GenerateResponse2? __value_401 = null; - try - { - if (ReadResponseAsString) - { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_401 = global::Cohere.GenerateResponse2.FromJson(__content_401, JsonSerializerContext); - } - else - { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_401 = await global::Cohere.GenerateResponse2.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_401 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::Cohere.GenerateResponse3? __value_403 = null; - try - { - if (ReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Cohere.GenerateResponse3.FromJson(__content_403, JsonSerializerContext); - } - else - { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Cohere.GenerateResponse3.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id - if ((int)__response.StatusCode == 404) - { - string? __content_404 = null; - global::System.Exception? __exception_404 = null; - global::Cohere.GenerateResponse4? __value_404 = null; - try - { - if (ReadResponseAsString) - { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Cohere.GenerateResponse4.FromJson(__content_404, JsonSerializerContext); - } - else - { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Cohere.GenerateResponse4.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_404 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::Cohere.GenerateResponse5? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Cohere.GenerateResponse5.FromJson(__content_422, JsonSerializerContext); - } - else - { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Cohere.GenerateResponse5.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Too many requests - if ((int)__response.StatusCode == 429) - { - string? __content_429 = null; - global::System.Exception? __exception_429 = null; - global::Cohere.GenerateResponse6? __value_429 = null; - try - { - if (ReadResponseAsString) - { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Cohere.GenerateResponse6.FromJson(__content_429, JsonSerializerContext); - } - else - { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Cohere.GenerateResponse6.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_429 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseObject = __value_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request or response contains a deny-listed token. - if ((int)__response.StatusCode == 498) - { - string? __content_498 = null; - global::System.Exception? __exception_498 = null; - global::Cohere.GenerateResponse7? __value_498 = null; - try - { - if (ReadResponseAsString) - { - __content_498 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_498 = global::Cohere.GenerateResponse7.FromJson(__content_498, JsonSerializerContext); - } - else - { - var __contentStream_498 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_498 = await global::Cohere.GenerateResponse7.FromJsonStreamAsync(__contentStream_498, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_498 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_498 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_498, - statusCode: __response.StatusCode) - { - ResponseBody = __content_498, - ResponseObject = __value_498, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request is cancelled by the user. - if ((int)__response.StatusCode == 499) - { - string? __content_499 = null; - global::System.Exception? __exception_499 = null; - global::Cohere.GenerateResponse8? __value_499 = null; - try - { - if (ReadResponseAsString) - { - __content_499 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_499 = global::Cohere.GenerateResponse8.FromJson(__content_499, JsonSerializerContext); - } - else - { - var __contentStream_499 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_499 = await global::Cohere.GenerateResponse8.FromJsonStreamAsync(__contentStream_499, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_499 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_499 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_499, - statusCode: __response.StatusCode) - { - ResponseBody = __content_499, - ResponseObject = __value_499, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when an uncategorised internal server error occurs. - if ((int)__response.StatusCode == 500) - { - string? __content_500 = null; - global::System.Exception? __exception_500 = null; - global::Cohere.GenerateResponse9? __value_500 = null; - try - { - if (ReadResponseAsString) - { - __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_500 = global::Cohere.GenerateResponse9.FromJson(__content_500, JsonSerializerContext); - } - else - { - var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_500 = await global::Cohere.GenerateResponse9.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_500 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the requested feature is not implemented. - if ((int)__response.StatusCode == 501) - { - string? __content_501 = null; - global::System.Exception? __exception_501 = null; - global::Cohere.GenerateResponse10? __value_501 = null; - try - { - if (ReadResponseAsString) - { - __content_501 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_501 = global::Cohere.GenerateResponse10.FromJson(__content_501, JsonSerializerContext); - } - else - { - var __contentStream_501 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_501 = await global::Cohere.GenerateResponse10.FromJsonStreamAsync(__contentStream_501, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_501 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_501 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_501, - statusCode: __response.StatusCode) - { - ResponseBody = __content_501, - ResponseObject = __value_501, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time - if ((int)__response.StatusCode == 503) - { - string? __content_503 = null; - global::System.Exception? __exception_503 = null; - global::Cohere.GenerateResponse11? __value_503 = null; - try - { - if (ReadResponseAsString) - { - __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_503 = global::Cohere.GenerateResponse11.FromJson(__content_503, JsonSerializerContext); - } - else - { - var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_503 = await global::Cohere.GenerateResponse11.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_503 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseObject = __value_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond - if ((int)__response.StatusCode == 504) - { - string? __content_504 = null; - global::System.Exception? __exception_504 = null; - global::Cohere.GenerateResponse12? __value_504 = null; - try - { - if (ReadResponseAsString) - { - __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_504 = global::Cohere.GenerateResponse12.FromJson(__content_504, JsonSerializerContext); - } - else - { - var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_504 = await global::Cohere.GenerateResponse12.FromJsonStreamAsync(__contentStream_504, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_504 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_504 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_504, - statusCode: __response.StatusCode) - { - ResponseBody = __content_504, - ResponseObject = __value_504, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessGenerateResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::Cohere.Generation.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Cohere.Generation.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - } - - /// - /// Generate
- /// <Warning>
- /// This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.
- /// </Warning>
- /// Generates realistic text conditioned on a given input. - ///
- /// - /// - /// The generated text will be cut at the beginning of the earliest occurrence of an end sequence. The sequence will be excluded from the text.
- /// Included only in requests - /// - /// - /// Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
- /// Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models.
- /// Included only in requests - /// - /// - /// Ensures only the top `k` most likely tokens are considered for generation at each step.
- /// Defaults to `0`, min value of `0`, max value of `500`.
- /// Included only in requests - /// - /// - /// The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.
- /// This parameter is off by default, and if it's not specified, the model will continue generating until it emits an EOS completion token. See [BPE Tokens](/bpe-tokens-wiki) for more details.
- /// Can only be set to `0` if `return_likelihoods` is set to `ALL` to get the likelihood of the prompt.
- /// Included only in requests - /// - /// - /// The identifier of the model to generate with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental).
- /// Smaller, "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID.
- /// Included only in requests - /// - /// - /// The maximum number of generations that will be returned. Defaults to `1`, min value of `1`, max value of `5`.
- /// Included only in requests - /// - /// - /// Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`.
- /// Defaults to `0.75`. min value of `0.01`, max value of `0.99`.
- /// Included only in requests - /// - /// - /// Defaults to `0.0`, min value of `0.0`, max value of `1.0`.
- /// Can be used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
- /// Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models.
- /// Included only in requests - /// - /// - /// Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.com/playground/generate).
- /// When a preset is specified, the `prompt` parameter becomes optional, and any included parameters will override the preset's parameters.
- /// Included only in requests
- /// Example: my-preset-a58sbd - /// - /// - /// The input text that serves as the starting point for generating the response.
- /// Note: The prompt will be pre-processed and modified before reaching the model.
- /// Included only in requests
- /// Example: Please explain to me how LLMs work - /// - /// - /// When enabled, the user's prompt will be sent to the model without any pre-processing. - /// - /// - /// One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`.
- /// If `GENERATION` is selected, the token likelihoods will only be provided for generated text.
- /// WARNING: `ALL` is deprecated, and will be removed in a future release.
- /// Default Value: NONE - /// - /// - /// If specified, the backend will make a best effort to sample tokens
- /// deterministically, such that repeated requests with the same
- /// seed and parameters should return the same result. However,
- /// determinism cannot be totally guaranteed.
- /// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - /// - /// - /// The generated text will be cut at the end of the earliest occurrence of a stop sequence. The sequence will be included the text.
- /// Included only in requests - /// - /// - /// When `true`, the response will be a JSON stream of events. Streaming is beneficial for user interfaces that render the contents of the response piece by piece, as it gets generated.
- /// The final event will contain the complete response, and will contain an `is_finished` field set to `true`. The event will also contain a `finish_reason`, which can be one of the following:
- /// - `COMPLETE` - the model sent back a finished reply
- /// - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens for its context length
- /// - `ERROR` - something went wrong when generating the reply
- /// - `ERROR_TOXIC` - the model generated a reply that was deemed toxic - /// - /// - /// A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations. See [Temperature](/temperature-wiki) for more details.
- /// Defaults to `0.75`, min value of `0.0`, max value of `5.0`.
- /// Included only in requests - /// - /// - /// One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.
- /// 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.
- /// If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned.
- /// Default Value: END
- /// Included only in requests - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task GenerateAsync( - global::System.Collections.Generic.IList endSequences, - double frequencyPenalty, - int k, - int maxTokens, - string model, - int numGenerations, - double p, - double presencePenalty, - string preset, - string prompt, - global::System.Collections.Generic.IList stopSequences, - double temperature, - global::Cohere.GenerateRequestTruncate truncate, - string? xClientName = default, - bool? rawPrompting = default, - global::Cohere.GenerateRequestReturnLikelihoods? returnLikelihoods = default, - int? seed = default, - bool? stream = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - var __request = new global::Cohere.GenerateRequest - { - EndSequences = endSequences, - FrequencyPenalty = frequencyPenalty, - K = k, - MaxTokens = maxTokens, - Model = model, - NumGenerations = numGenerations, - P = p, - PresencePenalty = presencePenalty, - Preset = preset, - Prompt = prompt, - RawPrompting = rawPrompting, - ReturnLikelihoods = returnLikelihoods, - Seed = seed, - StopSequences = stopSequences, - Stream = stream, - Temperature = temperature, - Truncate = truncate, - }; - - return await GenerateAsync( - xClientName: xClientName, - request: __request, - cancellationToken: cancellationToken).ConfigureAwait(false); - } - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.CohereClient.Summarize.g.cs b/src/libs/Cohere/Generated/Cohere.CohereClient.Summarize.g.cs deleted file mode 100644 index 2ec359b3..00000000 --- a/src/libs/Cohere/Generated/Cohere.CohereClient.Summarize.g.cs +++ /dev/null @@ -1,698 +0,0 @@ - -#nullable enable - -namespace Cohere -{ - public partial class CohereClient - { - partial void PrepareSummarizeArguments( - global::System.Net.Http.HttpClient httpClient, - ref string? xClientName, - global::Cohere.SummarizeRequest request); - partial void PrepareSummarizeRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string? xClientName, - global::Cohere.SummarizeRequest request); - partial void ProcessSummarizeResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessSummarizeResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Summarize
- /// <Warning>
- /// This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.
- /// </Warning>
- /// Generates a summary in English for a given text. - ///
- /// - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task SummarizeAsync( - global::Cohere.SummarizeRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - request = request ?? throw new global::System.ArgumentNullException(nameof(request)); - - PrepareArguments( - client: HttpClient); - PrepareSummarizeArguments( - httpClient: HttpClient, - xClientName: ref xClientName, - request: request); - - var __pathBuilder = new global::Cohere.PathBuilder( - path: "/v1/summarize", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Post, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in Authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - if (xClientName != default) - { - __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); - } - - var __httpRequestContentBody = request.ToJson(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); - PrepareSummarizeRequest( - 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); - ProcessSummarizeResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::Cohere.SummarizeResponse2? __value_400 = null; - try - { - if (ReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Cohere.SummarizeResponse2.FromJson(__content_400, JsonSerializerContext); - } - else - { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Cohere.SummarizeResponse2.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 401) - { - string? __content_401 = null; - global::System.Exception? __exception_401 = null; - global::Cohere.SummarizeResponse3? __value_401 = null; - try - { - if (ReadResponseAsString) - { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_401 = global::Cohere.SummarizeResponse3.FromJson(__content_401, JsonSerializerContext); - } - else - { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_401 = await global::Cohere.SummarizeResponse3.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_401 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::Cohere.SummarizeResponse4? __value_403 = null; - try - { - if (ReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Cohere.SummarizeResponse4.FromJson(__content_403, JsonSerializerContext); - } - else - { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Cohere.SummarizeResponse4.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id - if ((int)__response.StatusCode == 404) - { - string? __content_404 = null; - global::System.Exception? __exception_404 = null; - global::Cohere.SummarizeResponse5? __value_404 = null; - try - { - if (ReadResponseAsString) - { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Cohere.SummarizeResponse5.FromJson(__content_404, JsonSerializerContext); - } - else - { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Cohere.SummarizeResponse5.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_404 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::Cohere.SummarizeResponse6? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Cohere.SummarizeResponse6.FromJson(__content_422, JsonSerializerContext); - } - else - { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Cohere.SummarizeResponse6.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Too many requests - if ((int)__response.StatusCode == 429) - { - string? __content_429 = null; - global::System.Exception? __exception_429 = null; - global::Cohere.SummarizeResponse7? __value_429 = null; - try - { - if (ReadResponseAsString) - { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Cohere.SummarizeResponse7.FromJson(__content_429, JsonSerializerContext); - } - else - { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Cohere.SummarizeResponse7.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_429 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseObject = __value_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request or response contains a deny-listed token. - if ((int)__response.StatusCode == 498) - { - string? __content_498 = null; - global::System.Exception? __exception_498 = null; - global::Cohere.SummarizeResponse8? __value_498 = null; - try - { - if (ReadResponseAsString) - { - __content_498 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_498 = global::Cohere.SummarizeResponse8.FromJson(__content_498, JsonSerializerContext); - } - else - { - var __contentStream_498 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_498 = await global::Cohere.SummarizeResponse8.FromJsonStreamAsync(__contentStream_498, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_498 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_498 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_498, - statusCode: __response.StatusCode) - { - ResponseBody = __content_498, - ResponseObject = __value_498, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request is cancelled by the user. - if ((int)__response.StatusCode == 499) - { - string? __content_499 = null; - global::System.Exception? __exception_499 = null; - global::Cohere.SummarizeResponse9? __value_499 = null; - try - { - if (ReadResponseAsString) - { - __content_499 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_499 = global::Cohere.SummarizeResponse9.FromJson(__content_499, JsonSerializerContext); - } - else - { - var __contentStream_499 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_499 = await global::Cohere.SummarizeResponse9.FromJsonStreamAsync(__contentStream_499, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_499 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_499 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_499, - statusCode: __response.StatusCode) - { - ResponseBody = __content_499, - ResponseObject = __value_499, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when an uncategorised internal server error occurs. - if ((int)__response.StatusCode == 500) - { - string? __content_500 = null; - global::System.Exception? __exception_500 = null; - global::Cohere.SummarizeResponse10? __value_500 = null; - try - { - if (ReadResponseAsString) - { - __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_500 = global::Cohere.SummarizeResponse10.FromJson(__content_500, JsonSerializerContext); - } - else - { - var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_500 = await global::Cohere.SummarizeResponse10.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_500 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the requested feature is not implemented. - if ((int)__response.StatusCode == 501) - { - string? __content_501 = null; - global::System.Exception? __exception_501 = null; - global::Cohere.SummarizeResponse11? __value_501 = null; - try - { - if (ReadResponseAsString) - { - __content_501 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_501 = global::Cohere.SummarizeResponse11.FromJson(__content_501, JsonSerializerContext); - } - else - { - var __contentStream_501 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_501 = await global::Cohere.SummarizeResponse11.FromJsonStreamAsync(__contentStream_501, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_501 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_501 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_501, - statusCode: __response.StatusCode) - { - ResponseBody = __content_501, - ResponseObject = __value_501, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time - if ((int)__response.StatusCode == 503) - { - string? __content_503 = null; - global::System.Exception? __exception_503 = null; - global::Cohere.SummarizeResponse12? __value_503 = null; - try - { - if (ReadResponseAsString) - { - __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_503 = global::Cohere.SummarizeResponse12.FromJson(__content_503, JsonSerializerContext); - } - else - { - var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_503 = await global::Cohere.SummarizeResponse12.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_503 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseObject = __value_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond - if ((int)__response.StatusCode == 504) - { - string? __content_504 = null; - global::System.Exception? __exception_504 = null; - global::Cohere.SummarizeResponse13? __value_504 = null; - try - { - if (ReadResponseAsString) - { - __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_504 = global::Cohere.SummarizeResponse13.FromJson(__content_504, JsonSerializerContext); - } - else - { - var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_504 = await global::Cohere.SummarizeResponse13.FromJsonStreamAsync(__contentStream_504, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_504 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_504 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_504, - statusCode: __response.StatusCode) - { - ResponseBody = __content_504, - ResponseObject = __value_504, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessSummarizeResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::Cohere.SummarizeResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Cohere.SummarizeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - } - - /// - /// Summarize
- /// <Warning>
- /// This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.
- /// </Warning>
- /// Generates a summary in English for a given text. - ///
- /// - /// - /// A free-form instruction for modifying how the summaries get generated. Should complete the sentence "Generate a summary _". Eg. "focusing on the next steps" or "written by Yoda"
- /// Included only in requests - /// - /// - /// One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text.
- /// Default Value: low
- /// Included only in requests - /// - /// - /// One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If `auto` is selected, the best option will be picked based on the input text.
- /// Default Value: paragraph
- /// Included only in requests - /// - /// - /// One of `short`, `medium`, `long`, or `auto` defaults to `auto`. Indicates the approximate length of the summary. If `auto` is selected, the best option will be picked based on the input text.
- /// Default Value: medium
- /// Included only in requests - /// - /// - /// The identifier of the model to generate the summary with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental). Smaller, "light" models are faster, while larger models will perform better.
- /// Included only in requests - /// - /// - /// Ranges from 0 to 5. Controls the randomness of the output. Lower values tend to generate more “predictable” output, while higher values tend to generate more “creative” output. The sweet spot is typically between 0 and 1.
- /// Default Value: 0.3
- /// Included only in requests - /// - /// - /// The text to generate a summary for. Can be up to 100,000 characters long. Currently the only supported language is English.
- /// Included only in requests - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task SummarizeAsync( - string additionalCommand, - global::Cohere.SummarizeRequestExtractiveness extractiveness, - global::Cohere.SummarizeRequestFormat format, - global::Cohere.SummarizeRequestLength length, - string model, - double temperature, - string text, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - var __request = new global::Cohere.SummarizeRequest - { - AdditionalCommand = additionalCommand, - Extractiveness = extractiveness, - Format = format, - Length = length, - Model = model, - Temperature = temperature, - Text = text, - }; - - return await SummarizeAsync( - xClientName: xClientName, - request: __request, - cancellationToken: cancellationToken).ConfigureAwait(false); - } - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.CreateConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.CreateConnector.g.cs deleted file mode 100644 index 1cd881a0..00000000 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.CreateConnector.g.cs +++ /dev/null @@ -1,684 +0,0 @@ - -#nullable enable - -namespace Cohere -{ - public partial class ConnectorsClient - { - partial void PrepareCreateConnectorArguments( - global::System.Net.Http.HttpClient httpClient, - ref string? xClientName, - global::Cohere.CreateConnectorRequest request); - partial void PrepareCreateConnectorRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string? xClientName, - global::Cohere.CreateConnectorRequest request); - partial void ProcessCreateConnectorResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessCreateConnectorResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Create a Connector
- /// Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) for more information. - ///
- /// - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task CreateConnectorAsync( - global::Cohere.CreateConnectorRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - request = request ?? throw new global::System.ArgumentNullException(nameof(request)); - - PrepareArguments( - client: HttpClient); - PrepareCreateConnectorArguments( - httpClient: HttpClient, - xClientName: ref xClientName, - request: request); - - var __pathBuilder = new global::Cohere.PathBuilder( - path: "/v1/connectors", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Post, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in Authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - if (xClientName != default) - { - __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); - } - - var __httpRequestContentBody = request.ToJson(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); - PrepareCreateConnectorRequest( - 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); - ProcessCreateConnectorResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::Cohere.CreateConnectorResponse2? __value_400 = null; - try - { - if (ReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Cohere.CreateConnectorResponse2.FromJson(__content_400, JsonSerializerContext); - } - else - { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Cohere.CreateConnectorResponse2.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 401) - { - string? __content_401 = null; - global::System.Exception? __exception_401 = null; - global::Cohere.CreateConnectorResponse3? __value_401 = null; - try - { - if (ReadResponseAsString) - { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_401 = global::Cohere.CreateConnectorResponse3.FromJson(__content_401, JsonSerializerContext); - } - else - { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_401 = await global::Cohere.CreateConnectorResponse3.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_401 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::Cohere.CreateConnectorResponse4? __value_403 = null; - try - { - if (ReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Cohere.CreateConnectorResponse4.FromJson(__content_403, JsonSerializerContext); - } - else - { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Cohere.CreateConnectorResponse4.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id - if ((int)__response.StatusCode == 404) - { - string? __content_404 = null; - global::System.Exception? __exception_404 = null; - global::Cohere.CreateConnectorResponse5? __value_404 = null; - try - { - if (ReadResponseAsString) - { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Cohere.CreateConnectorResponse5.FromJson(__content_404, JsonSerializerContext); - } - else - { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Cohere.CreateConnectorResponse5.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_404 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::Cohere.CreateConnectorResponse6? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Cohere.CreateConnectorResponse6.FromJson(__content_422, JsonSerializerContext); - } - else - { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Cohere.CreateConnectorResponse6.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Too many requests - if ((int)__response.StatusCode == 429) - { - string? __content_429 = null; - global::System.Exception? __exception_429 = null; - global::Cohere.CreateConnectorResponse7? __value_429 = null; - try - { - if (ReadResponseAsString) - { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Cohere.CreateConnectorResponse7.FromJson(__content_429, JsonSerializerContext); - } - else - { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Cohere.CreateConnectorResponse7.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_429 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseObject = __value_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request or response contains a deny-listed token. - if ((int)__response.StatusCode == 498) - { - string? __content_498 = null; - global::System.Exception? __exception_498 = null; - global::Cohere.CreateConnectorResponse8? __value_498 = null; - try - { - if (ReadResponseAsString) - { - __content_498 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_498 = global::Cohere.CreateConnectorResponse8.FromJson(__content_498, JsonSerializerContext); - } - else - { - var __contentStream_498 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_498 = await global::Cohere.CreateConnectorResponse8.FromJsonStreamAsync(__contentStream_498, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_498 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_498 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_498, - statusCode: __response.StatusCode) - { - ResponseBody = __content_498, - ResponseObject = __value_498, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request is cancelled by the user. - if ((int)__response.StatusCode == 499) - { - string? __content_499 = null; - global::System.Exception? __exception_499 = null; - global::Cohere.CreateConnectorResponse9? __value_499 = null; - try - { - if (ReadResponseAsString) - { - __content_499 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_499 = global::Cohere.CreateConnectorResponse9.FromJson(__content_499, JsonSerializerContext); - } - else - { - var __contentStream_499 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_499 = await global::Cohere.CreateConnectorResponse9.FromJsonStreamAsync(__contentStream_499, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_499 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_499 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_499, - statusCode: __response.StatusCode) - { - ResponseBody = __content_499, - ResponseObject = __value_499, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when an uncategorised internal server error occurs. - if ((int)__response.StatusCode == 500) - { - string? __content_500 = null; - global::System.Exception? __exception_500 = null; - global::Cohere.CreateConnectorResponse10? __value_500 = null; - try - { - if (ReadResponseAsString) - { - __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_500 = global::Cohere.CreateConnectorResponse10.FromJson(__content_500, JsonSerializerContext); - } - else - { - var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_500 = await global::Cohere.CreateConnectorResponse10.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_500 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the requested feature is not implemented. - if ((int)__response.StatusCode == 501) - { - string? __content_501 = null; - global::System.Exception? __exception_501 = null; - global::Cohere.CreateConnectorResponse11? __value_501 = null; - try - { - if (ReadResponseAsString) - { - __content_501 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_501 = global::Cohere.CreateConnectorResponse11.FromJson(__content_501, JsonSerializerContext); - } - else - { - var __contentStream_501 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_501 = await global::Cohere.CreateConnectorResponse11.FromJsonStreamAsync(__contentStream_501, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_501 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_501 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_501, - statusCode: __response.StatusCode) - { - ResponseBody = __content_501, - ResponseObject = __value_501, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time - if ((int)__response.StatusCode == 503) - { - string? __content_503 = null; - global::System.Exception? __exception_503 = null; - global::Cohere.CreateConnectorResponse12? __value_503 = null; - try - { - if (ReadResponseAsString) - { - __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_503 = global::Cohere.CreateConnectorResponse12.FromJson(__content_503, JsonSerializerContext); - } - else - { - var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_503 = await global::Cohere.CreateConnectorResponse12.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_503 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseObject = __value_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond - if ((int)__response.StatusCode == 504) - { - string? __content_504 = null; - global::System.Exception? __exception_504 = null; - global::Cohere.CreateConnectorResponse13? __value_504 = null; - try - { - if (ReadResponseAsString) - { - __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_504 = global::Cohere.CreateConnectorResponse13.FromJson(__content_504, JsonSerializerContext); - } - else - { - var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_504 = await global::Cohere.CreateConnectorResponse13.FromJsonStreamAsync(__contentStream_504, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_504 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_504 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_504, - statusCode: __response.StatusCode) - { - ResponseBody = __content_504, - ResponseObject = __value_504, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessCreateConnectorResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::Cohere.CreateConnectorResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Cohere.CreateConnectorResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - } - - /// - /// Create a Connector
- /// Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) for more information. - ///
- /// - /// - /// Whether the connector is active or not.
- /// Default Value: true - /// - /// - /// Whether a chat request should continue or not if the request to this connector fails.
- /// Default Value: false - /// - /// - /// A description of the connector. - /// - /// - /// A list of fields to exclude from the prompt (fields remain in the document). - /// - /// - /// A human-readable name for the connector. - /// - /// - /// - /// - /// The URL of the connector that will be used to search for documents. - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task CreateConnectorAsync( - string name, - string url, - string? xClientName = default, - bool? active = default, - bool? continueOnFailure = default, - string? description = default, - global::System.Collections.Generic.IList? excludes = default, - global::Cohere.CreateConnectorOAuth? oauth = default, - global::Cohere.CreateConnectorServiceAuth? serviceAuth = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - var __request = new global::Cohere.CreateConnectorRequest - { - Active = active, - ContinueOnFailure = continueOnFailure, - Description = description, - Excludes = excludes, - Name = name, - Oauth = oauth, - ServiceAuth = serviceAuth, - Url = url, - }; - - return await CreateConnectorAsync( - xClientName: xClientName, - request: __request, - cancellationToken: cancellationToken).ConfigureAwait(false); - } - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.DeleteConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.DeleteConnector.g.cs deleted file mode 100644 index feef7870..00000000 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.DeleteConnector.g.cs +++ /dev/null @@ -1,613 +0,0 @@ - -#nullable enable - -namespace Cohere -{ - public partial class ConnectorsClient - { - partial void PrepareDeleteConnectorArguments( - global::System.Net.Http.HttpClient httpClient, - ref string id, - ref string? xClientName); - partial void PrepareDeleteConnectorRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string id, - string? xClientName); - partial void ProcessDeleteConnectorResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessDeleteConnectorResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Delete a Connector
- /// Delete a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information. - ///
- /// - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task DeleteConnectorAsync( - string id, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - PrepareArguments( - client: HttpClient); - PrepareDeleteConnectorArguments( - httpClient: HttpClient, - id: ref id, - xClientName: ref xClientName); - - var __pathBuilder = new global::Cohere.PathBuilder( - path: $"/v1/connectors/{id}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Delete, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in Authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - if (xClientName != default) - { - __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); - } - - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareDeleteConnectorRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - id: id, - xClientName: xClientName); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); - - ProcessResponse( - client: HttpClient, - response: __response); - ProcessDeleteConnectorResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::Cohere.DeleteConnectorResponse2? __value_400 = null; - try - { - if (ReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Cohere.DeleteConnectorResponse2.FromJson(__content_400, JsonSerializerContext); - } - else - { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Cohere.DeleteConnectorResponse2.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 401) - { - string? __content_401 = null; - global::System.Exception? __exception_401 = null; - global::Cohere.DeleteConnectorResponse3? __value_401 = null; - try - { - if (ReadResponseAsString) - { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_401 = global::Cohere.DeleteConnectorResponse3.FromJson(__content_401, JsonSerializerContext); - } - else - { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_401 = await global::Cohere.DeleteConnectorResponse3.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_401 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::Cohere.DeleteConnectorResponse4? __value_403 = null; - try - { - if (ReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Cohere.DeleteConnectorResponse4.FromJson(__content_403, JsonSerializerContext); - } - else - { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Cohere.DeleteConnectorResponse4.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id - if ((int)__response.StatusCode == 404) - { - string? __content_404 = null; - global::System.Exception? __exception_404 = null; - global::Cohere.DeleteConnectorResponse5? __value_404 = null; - try - { - if (ReadResponseAsString) - { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Cohere.DeleteConnectorResponse5.FromJson(__content_404, JsonSerializerContext); - } - else - { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Cohere.DeleteConnectorResponse5.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_404 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::Cohere.DeleteConnectorResponse6? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Cohere.DeleteConnectorResponse6.FromJson(__content_422, JsonSerializerContext); - } - else - { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Cohere.DeleteConnectorResponse6.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Too many requests - if ((int)__response.StatusCode == 429) - { - string? __content_429 = null; - global::System.Exception? __exception_429 = null; - global::Cohere.DeleteConnectorResponse7? __value_429 = null; - try - { - if (ReadResponseAsString) - { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Cohere.DeleteConnectorResponse7.FromJson(__content_429, JsonSerializerContext); - } - else - { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Cohere.DeleteConnectorResponse7.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_429 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseObject = __value_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request or response contains a deny-listed token. - if ((int)__response.StatusCode == 498) - { - string? __content_498 = null; - global::System.Exception? __exception_498 = null; - global::Cohere.DeleteConnectorResponse8? __value_498 = null; - try - { - if (ReadResponseAsString) - { - __content_498 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_498 = global::Cohere.DeleteConnectorResponse8.FromJson(__content_498, JsonSerializerContext); - } - else - { - var __contentStream_498 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_498 = await global::Cohere.DeleteConnectorResponse8.FromJsonStreamAsync(__contentStream_498, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_498 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_498 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_498, - statusCode: __response.StatusCode) - { - ResponseBody = __content_498, - ResponseObject = __value_498, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request is cancelled by the user. - if ((int)__response.StatusCode == 499) - { - string? __content_499 = null; - global::System.Exception? __exception_499 = null; - global::Cohere.DeleteConnectorResponse9? __value_499 = null; - try - { - if (ReadResponseAsString) - { - __content_499 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_499 = global::Cohere.DeleteConnectorResponse9.FromJson(__content_499, JsonSerializerContext); - } - else - { - var __contentStream_499 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_499 = await global::Cohere.DeleteConnectorResponse9.FromJsonStreamAsync(__contentStream_499, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_499 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_499 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_499, - statusCode: __response.StatusCode) - { - ResponseBody = __content_499, - ResponseObject = __value_499, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when an uncategorised internal server error occurs. - if ((int)__response.StatusCode == 500) - { - string? __content_500 = null; - global::System.Exception? __exception_500 = null; - global::Cohere.DeleteConnectorResponse10? __value_500 = null; - try - { - if (ReadResponseAsString) - { - __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_500 = global::Cohere.DeleteConnectorResponse10.FromJson(__content_500, JsonSerializerContext); - } - else - { - var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_500 = await global::Cohere.DeleteConnectorResponse10.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_500 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the requested feature is not implemented. - if ((int)__response.StatusCode == 501) - { - string? __content_501 = null; - global::System.Exception? __exception_501 = null; - global::Cohere.DeleteConnectorResponse11? __value_501 = null; - try - { - if (ReadResponseAsString) - { - __content_501 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_501 = global::Cohere.DeleteConnectorResponse11.FromJson(__content_501, JsonSerializerContext); - } - else - { - var __contentStream_501 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_501 = await global::Cohere.DeleteConnectorResponse11.FromJsonStreamAsync(__contentStream_501, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_501 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_501 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_501, - statusCode: __response.StatusCode) - { - ResponseBody = __content_501, - ResponseObject = __value_501, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time - if ((int)__response.StatusCode == 503) - { - string? __content_503 = null; - global::System.Exception? __exception_503 = null; - global::Cohere.DeleteConnectorResponse12? __value_503 = null; - try - { - if (ReadResponseAsString) - { - __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_503 = global::Cohere.DeleteConnectorResponse12.FromJson(__content_503, JsonSerializerContext); - } - else - { - var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_503 = await global::Cohere.DeleteConnectorResponse12.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_503 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseObject = __value_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond - if ((int)__response.StatusCode == 504) - { - string? __content_504 = null; - global::System.Exception? __exception_504 = null; - global::Cohere.DeleteConnectorResponse13? __value_504 = null; - try - { - if (ReadResponseAsString) - { - __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_504 = global::Cohere.DeleteConnectorResponse13.FromJson(__content_504, JsonSerializerContext); - } - else - { - var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_504 = await global::Cohere.DeleteConnectorResponse13.FromJsonStreamAsync(__contentStream_504, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_504 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_504 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_504, - statusCode: __response.StatusCode) - { - ResponseBody = __content_504, - ResponseObject = __value_504, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessDeleteConnectorResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return __content; - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - } - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.GetConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.GetConnector.g.cs deleted file mode 100644 index cb22f8b8..00000000 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.GetConnector.g.cs +++ /dev/null @@ -1,617 +0,0 @@ - -#nullable enable - -namespace Cohere -{ - public partial class ConnectorsClient - { - partial void PrepareGetConnectorArguments( - global::System.Net.Http.HttpClient httpClient, - ref string id, - ref string? xClientName); - partial void PrepareGetConnectorRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string id, - string? xClientName); - partial void ProcessGetConnectorResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessGetConnectorResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Get a Connector
- /// Retrieve a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information. - ///
- /// - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task GetConnectorAsync( - string id, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - PrepareArguments( - client: HttpClient); - PrepareGetConnectorArguments( - httpClient: HttpClient, - id: ref id, - xClientName: ref xClientName); - - var __pathBuilder = new global::Cohere.PathBuilder( - path: $"/v1/connectors/{id}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Get, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in Authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - if (xClientName != default) - { - __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); - } - - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetConnectorRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - id: id, - xClientName: xClientName); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); - - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetConnectorResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::Cohere.GetConnectorResponse2? __value_400 = null; - try - { - if (ReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Cohere.GetConnectorResponse2.FromJson(__content_400, JsonSerializerContext); - } - else - { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Cohere.GetConnectorResponse2.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 401) - { - string? __content_401 = null; - global::System.Exception? __exception_401 = null; - global::Cohere.GetConnectorResponse3? __value_401 = null; - try - { - if (ReadResponseAsString) - { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_401 = global::Cohere.GetConnectorResponse3.FromJson(__content_401, JsonSerializerContext); - } - else - { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_401 = await global::Cohere.GetConnectorResponse3.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_401 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::Cohere.GetConnectorResponse4? __value_403 = null; - try - { - if (ReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Cohere.GetConnectorResponse4.FromJson(__content_403, JsonSerializerContext); - } - else - { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Cohere.GetConnectorResponse4.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id - if ((int)__response.StatusCode == 404) - { - string? __content_404 = null; - global::System.Exception? __exception_404 = null; - global::Cohere.GetConnectorResponse5? __value_404 = null; - try - { - if (ReadResponseAsString) - { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Cohere.GetConnectorResponse5.FromJson(__content_404, JsonSerializerContext); - } - else - { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Cohere.GetConnectorResponse5.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_404 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::Cohere.GetConnectorResponse6? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Cohere.GetConnectorResponse6.FromJson(__content_422, JsonSerializerContext); - } - else - { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Cohere.GetConnectorResponse6.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Too many requests - if ((int)__response.StatusCode == 429) - { - string? __content_429 = null; - global::System.Exception? __exception_429 = null; - global::Cohere.GetConnectorResponse7? __value_429 = null; - try - { - if (ReadResponseAsString) - { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Cohere.GetConnectorResponse7.FromJson(__content_429, JsonSerializerContext); - } - else - { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Cohere.GetConnectorResponse7.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_429 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseObject = __value_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request or response contains a deny-listed token. - if ((int)__response.StatusCode == 498) - { - string? __content_498 = null; - global::System.Exception? __exception_498 = null; - global::Cohere.GetConnectorResponse8? __value_498 = null; - try - { - if (ReadResponseAsString) - { - __content_498 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_498 = global::Cohere.GetConnectorResponse8.FromJson(__content_498, JsonSerializerContext); - } - else - { - var __contentStream_498 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_498 = await global::Cohere.GetConnectorResponse8.FromJsonStreamAsync(__contentStream_498, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_498 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_498 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_498, - statusCode: __response.StatusCode) - { - ResponseBody = __content_498, - ResponseObject = __value_498, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request is cancelled by the user. - if ((int)__response.StatusCode == 499) - { - string? __content_499 = null; - global::System.Exception? __exception_499 = null; - global::Cohere.GetConnectorResponse9? __value_499 = null; - try - { - if (ReadResponseAsString) - { - __content_499 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_499 = global::Cohere.GetConnectorResponse9.FromJson(__content_499, JsonSerializerContext); - } - else - { - var __contentStream_499 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_499 = await global::Cohere.GetConnectorResponse9.FromJsonStreamAsync(__contentStream_499, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_499 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_499 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_499, - statusCode: __response.StatusCode) - { - ResponseBody = __content_499, - ResponseObject = __value_499, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when an uncategorised internal server error occurs. - if ((int)__response.StatusCode == 500) - { - string? __content_500 = null; - global::System.Exception? __exception_500 = null; - global::Cohere.GetConnectorResponse10? __value_500 = null; - try - { - if (ReadResponseAsString) - { - __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_500 = global::Cohere.GetConnectorResponse10.FromJson(__content_500, JsonSerializerContext); - } - else - { - var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_500 = await global::Cohere.GetConnectorResponse10.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_500 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the requested feature is not implemented. - if ((int)__response.StatusCode == 501) - { - string? __content_501 = null; - global::System.Exception? __exception_501 = null; - global::Cohere.GetConnectorResponse11? __value_501 = null; - try - { - if (ReadResponseAsString) - { - __content_501 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_501 = global::Cohere.GetConnectorResponse11.FromJson(__content_501, JsonSerializerContext); - } - else - { - var __contentStream_501 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_501 = await global::Cohere.GetConnectorResponse11.FromJsonStreamAsync(__contentStream_501, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_501 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_501 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_501, - statusCode: __response.StatusCode) - { - ResponseBody = __content_501, - ResponseObject = __value_501, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time - if ((int)__response.StatusCode == 503) - { - string? __content_503 = null; - global::System.Exception? __exception_503 = null; - global::Cohere.GetConnectorResponse12? __value_503 = null; - try - { - if (ReadResponseAsString) - { - __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_503 = global::Cohere.GetConnectorResponse12.FromJson(__content_503, JsonSerializerContext); - } - else - { - var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_503 = await global::Cohere.GetConnectorResponse12.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_503 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseObject = __value_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond - if ((int)__response.StatusCode == 504) - { - string? __content_504 = null; - global::System.Exception? __exception_504 = null; - global::Cohere.GetConnectorResponse13? __value_504 = null; - try - { - if (ReadResponseAsString) - { - __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_504 = global::Cohere.GetConnectorResponse13.FromJson(__content_504, JsonSerializerContext); - } - else - { - var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_504 = await global::Cohere.GetConnectorResponse13.FromJsonStreamAsync(__contentStream_504, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_504 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_504 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_504, - statusCode: __response.StatusCode) - { - ResponseBody = __content_504, - ResponseObject = __value_504, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessGetConnectorResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::Cohere.GetConnectorResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Cohere.GetConnectorResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - } - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.ListConnectors.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.ListConnectors.g.cs deleted file mode 100644 index 3a82e637..00000000 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.ListConnectors.g.cs +++ /dev/null @@ -1,631 +0,0 @@ - -#nullable enable - -namespace Cohere -{ - public partial class ConnectorsClient - { - partial void PrepareListConnectorsArguments( - global::System.Net.Http.HttpClient httpClient, - ref double? limit, - ref double? offset, - ref string? xClientName); - partial void PrepareListConnectorsRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - double? limit, - double? offset, - string? xClientName); - partial void ProcessListConnectorsResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessListConnectorsResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// List Connectors
- /// Returns a list of connectors ordered by descending creation date (newer first). See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information. - ///
- /// - /// Default Value: 30 - /// - /// - /// Default Value: 0 - /// - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task ListConnectorsAsync( - double? limit = default, - double? offset = default, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - PrepareArguments( - client: HttpClient); - PrepareListConnectorsArguments( - httpClient: HttpClient, - limit: ref limit, - offset: ref offset, - xClientName: ref xClientName); - - var __pathBuilder = new global::Cohere.PathBuilder( - path: "/v1/connectors", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("offset", offset?.ToString()) - ; - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Get, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in Authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - if (xClientName != default) - { - __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); - } - - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareListConnectorsRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - limit: limit, - offset: offset, - xClientName: xClientName); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); - - ProcessResponse( - client: HttpClient, - response: __response); - ProcessListConnectorsResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::Cohere.ListConnectorsResponse2? __value_400 = null; - try - { - if (ReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Cohere.ListConnectorsResponse2.FromJson(__content_400, JsonSerializerContext); - } - else - { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Cohere.ListConnectorsResponse2.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 401) - { - string? __content_401 = null; - global::System.Exception? __exception_401 = null; - global::Cohere.ListConnectorsResponse3? __value_401 = null; - try - { - if (ReadResponseAsString) - { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_401 = global::Cohere.ListConnectorsResponse3.FromJson(__content_401, JsonSerializerContext); - } - else - { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_401 = await global::Cohere.ListConnectorsResponse3.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_401 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::Cohere.ListConnectorsResponse4? __value_403 = null; - try - { - if (ReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Cohere.ListConnectorsResponse4.FromJson(__content_403, JsonSerializerContext); - } - else - { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Cohere.ListConnectorsResponse4.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id - if ((int)__response.StatusCode == 404) - { - string? __content_404 = null; - global::System.Exception? __exception_404 = null; - global::Cohere.ListConnectorsResponse5? __value_404 = null; - try - { - if (ReadResponseAsString) - { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Cohere.ListConnectorsResponse5.FromJson(__content_404, JsonSerializerContext); - } - else - { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Cohere.ListConnectorsResponse5.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_404 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::Cohere.ListConnectorsResponse6? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Cohere.ListConnectorsResponse6.FromJson(__content_422, JsonSerializerContext); - } - else - { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Cohere.ListConnectorsResponse6.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Too many requests - if ((int)__response.StatusCode == 429) - { - string? __content_429 = null; - global::System.Exception? __exception_429 = null; - global::Cohere.ListConnectorsResponse7? __value_429 = null; - try - { - if (ReadResponseAsString) - { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Cohere.ListConnectorsResponse7.FromJson(__content_429, JsonSerializerContext); - } - else - { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Cohere.ListConnectorsResponse7.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_429 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseObject = __value_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request or response contains a deny-listed token. - if ((int)__response.StatusCode == 498) - { - string? __content_498 = null; - global::System.Exception? __exception_498 = null; - global::Cohere.ListConnectorsResponse8? __value_498 = null; - try - { - if (ReadResponseAsString) - { - __content_498 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_498 = global::Cohere.ListConnectorsResponse8.FromJson(__content_498, JsonSerializerContext); - } - else - { - var __contentStream_498 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_498 = await global::Cohere.ListConnectorsResponse8.FromJsonStreamAsync(__contentStream_498, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_498 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_498 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_498, - statusCode: __response.StatusCode) - { - ResponseBody = __content_498, - ResponseObject = __value_498, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request is cancelled by the user. - if ((int)__response.StatusCode == 499) - { - string? __content_499 = null; - global::System.Exception? __exception_499 = null; - global::Cohere.ListConnectorsResponse9? __value_499 = null; - try - { - if (ReadResponseAsString) - { - __content_499 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_499 = global::Cohere.ListConnectorsResponse9.FromJson(__content_499, JsonSerializerContext); - } - else - { - var __contentStream_499 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_499 = await global::Cohere.ListConnectorsResponse9.FromJsonStreamAsync(__contentStream_499, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_499 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_499 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_499, - statusCode: __response.StatusCode) - { - ResponseBody = __content_499, - ResponseObject = __value_499, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when an uncategorised internal server error occurs. - if ((int)__response.StatusCode == 500) - { - string? __content_500 = null; - global::System.Exception? __exception_500 = null; - global::Cohere.ListConnectorsResponse10? __value_500 = null; - try - { - if (ReadResponseAsString) - { - __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_500 = global::Cohere.ListConnectorsResponse10.FromJson(__content_500, JsonSerializerContext); - } - else - { - var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_500 = await global::Cohere.ListConnectorsResponse10.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_500 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the requested feature is not implemented. - if ((int)__response.StatusCode == 501) - { - string? __content_501 = null; - global::System.Exception? __exception_501 = null; - global::Cohere.ListConnectorsResponse11? __value_501 = null; - try - { - if (ReadResponseAsString) - { - __content_501 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_501 = global::Cohere.ListConnectorsResponse11.FromJson(__content_501, JsonSerializerContext); - } - else - { - var __contentStream_501 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_501 = await global::Cohere.ListConnectorsResponse11.FromJsonStreamAsync(__contentStream_501, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_501 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_501 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_501, - statusCode: __response.StatusCode) - { - ResponseBody = __content_501, - ResponseObject = __value_501, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time - if ((int)__response.StatusCode == 503) - { - string? __content_503 = null; - global::System.Exception? __exception_503 = null; - global::Cohere.ListConnectorsResponse12? __value_503 = null; - try - { - if (ReadResponseAsString) - { - __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_503 = global::Cohere.ListConnectorsResponse12.FromJson(__content_503, JsonSerializerContext); - } - else - { - var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_503 = await global::Cohere.ListConnectorsResponse12.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_503 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseObject = __value_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond - if ((int)__response.StatusCode == 504) - { - string? __content_504 = null; - global::System.Exception? __exception_504 = null; - global::Cohere.ListConnectorsResponse13? __value_504 = null; - try - { - if (ReadResponseAsString) - { - __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_504 = global::Cohere.ListConnectorsResponse13.FromJson(__content_504, JsonSerializerContext); - } - else - { - var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_504 = await global::Cohere.ListConnectorsResponse13.FromJsonStreamAsync(__contentStream_504, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_504 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_504 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_504, - statusCode: __response.StatusCode) - { - ResponseBody = __content_504, - ResponseObject = __value_504, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessListConnectorsResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::Cohere.ListConnectorsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Cohere.ListConnectorsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - } - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.OAuthAuthorizeConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.OAuthAuthorizeConnector.g.cs deleted file mode 100644 index 804e7580..00000000 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.OAuthAuthorizeConnector.g.cs +++ /dev/null @@ -1,626 +0,0 @@ - -#nullable enable - -namespace Cohere -{ - public partial class ConnectorsClient - { - partial void PrepareOAuthAuthorizeConnectorArguments( - global::System.Net.Http.HttpClient httpClient, - ref string id, - ref string? afterTokenRedirect, - ref string? xClientName); - partial void PrepareOAuthAuthorizeConnectorRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string id, - string? afterTokenRedirect, - string? xClientName); - partial void ProcessOAuthAuthorizeConnectorResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessOAuthAuthorizeConnectorResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Authorize with oAuth
- /// Authorize the connector with the given ID for the connector oauth app. See ['Connector Authentication'](https://docs.cohere.com/docs/connector-authentication) for more information. - ///
- /// - /// - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task OAuthAuthorizeConnectorAsync( - string id, - string? afterTokenRedirect = default, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - PrepareArguments( - client: HttpClient); - PrepareOAuthAuthorizeConnectorArguments( - httpClient: HttpClient, - id: ref id, - afterTokenRedirect: ref afterTokenRedirect, - xClientName: ref xClientName); - - var __pathBuilder = new global::Cohere.PathBuilder( - path: $"/v1/connectors/{id}/oauth/authorize", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("after_token_redirect", afterTokenRedirect) - ; - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Post, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in Authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - if (xClientName != default) - { - __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); - } - - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareOAuthAuthorizeConnectorRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - id: id, - afterTokenRedirect: afterTokenRedirect, - xClientName: xClientName); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); - - ProcessResponse( - client: HttpClient, - response: __response); - ProcessOAuthAuthorizeConnectorResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::Cohere.OAuthAuthorizeConnectorResponse? __value_400 = null; - try - { - if (ReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Cohere.OAuthAuthorizeConnectorResponse.FromJson(__content_400, JsonSerializerContext); - } - else - { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Cohere.OAuthAuthorizeConnectorResponse.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 401) - { - string? __content_401 = null; - global::System.Exception? __exception_401 = null; - global::Cohere.OAuthAuthorizeConnectorResponse2? __value_401 = null; - try - { - if (ReadResponseAsString) - { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_401 = global::Cohere.OAuthAuthorizeConnectorResponse2.FromJson(__content_401, JsonSerializerContext); - } - else - { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_401 = await global::Cohere.OAuthAuthorizeConnectorResponse2.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_401 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::Cohere.OAuthAuthorizeConnectorResponse3? __value_403 = null; - try - { - if (ReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Cohere.OAuthAuthorizeConnectorResponse3.FromJson(__content_403, JsonSerializerContext); - } - else - { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Cohere.OAuthAuthorizeConnectorResponse3.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id - if ((int)__response.StatusCode == 404) - { - string? __content_404 = null; - global::System.Exception? __exception_404 = null; - global::Cohere.OAuthAuthorizeConnectorResponse4? __value_404 = null; - try - { - if (ReadResponseAsString) - { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Cohere.OAuthAuthorizeConnectorResponse4.FromJson(__content_404, JsonSerializerContext); - } - else - { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Cohere.OAuthAuthorizeConnectorResponse4.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_404 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::Cohere.OAuthAuthorizeConnectorResponse5? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Cohere.OAuthAuthorizeConnectorResponse5.FromJson(__content_422, JsonSerializerContext); - } - else - { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Cohere.OAuthAuthorizeConnectorResponse5.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Too many requests - if ((int)__response.StatusCode == 429) - { - string? __content_429 = null; - global::System.Exception? __exception_429 = null; - global::Cohere.OAuthAuthorizeConnectorResponse6? __value_429 = null; - try - { - if (ReadResponseAsString) - { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Cohere.OAuthAuthorizeConnectorResponse6.FromJson(__content_429, JsonSerializerContext); - } - else - { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Cohere.OAuthAuthorizeConnectorResponse6.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_429 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseObject = __value_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request or response contains a deny-listed token. - if ((int)__response.StatusCode == 498) - { - string? __content_498 = null; - global::System.Exception? __exception_498 = null; - global::Cohere.OAuthAuthorizeConnectorResponse7? __value_498 = null; - try - { - if (ReadResponseAsString) - { - __content_498 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_498 = global::Cohere.OAuthAuthorizeConnectorResponse7.FromJson(__content_498, JsonSerializerContext); - } - else - { - var __contentStream_498 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_498 = await global::Cohere.OAuthAuthorizeConnectorResponse7.FromJsonStreamAsync(__contentStream_498, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_498 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_498 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_498, - statusCode: __response.StatusCode) - { - ResponseBody = __content_498, - ResponseObject = __value_498, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request is cancelled by the user. - if ((int)__response.StatusCode == 499) - { - string? __content_499 = null; - global::System.Exception? __exception_499 = null; - global::Cohere.OAuthAuthorizeConnectorResponse8? __value_499 = null; - try - { - if (ReadResponseAsString) - { - __content_499 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_499 = global::Cohere.OAuthAuthorizeConnectorResponse8.FromJson(__content_499, JsonSerializerContext); - } - else - { - var __contentStream_499 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_499 = await global::Cohere.OAuthAuthorizeConnectorResponse8.FromJsonStreamAsync(__contentStream_499, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_499 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_499 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_499, - statusCode: __response.StatusCode) - { - ResponseBody = __content_499, - ResponseObject = __value_499, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when an uncategorised internal server error occurs. - if ((int)__response.StatusCode == 500) - { - string? __content_500 = null; - global::System.Exception? __exception_500 = null; - global::Cohere.OAuthAuthorizeConnectorResponse9? __value_500 = null; - try - { - if (ReadResponseAsString) - { - __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_500 = global::Cohere.OAuthAuthorizeConnectorResponse9.FromJson(__content_500, JsonSerializerContext); - } - else - { - var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_500 = await global::Cohere.OAuthAuthorizeConnectorResponse9.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_500 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the requested feature is not implemented. - if ((int)__response.StatusCode == 501) - { - string? __content_501 = null; - global::System.Exception? __exception_501 = null; - global::Cohere.OAuthAuthorizeConnectorResponse10? __value_501 = null; - try - { - if (ReadResponseAsString) - { - __content_501 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_501 = global::Cohere.OAuthAuthorizeConnectorResponse10.FromJson(__content_501, JsonSerializerContext); - } - else - { - var __contentStream_501 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_501 = await global::Cohere.OAuthAuthorizeConnectorResponse10.FromJsonStreamAsync(__contentStream_501, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_501 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_501 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_501, - statusCode: __response.StatusCode) - { - ResponseBody = __content_501, - ResponseObject = __value_501, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time - if ((int)__response.StatusCode == 503) - { - string? __content_503 = null; - global::System.Exception? __exception_503 = null; - global::Cohere.OAuthAuthorizeConnectorResponse11? __value_503 = null; - try - { - if (ReadResponseAsString) - { - __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_503 = global::Cohere.OAuthAuthorizeConnectorResponse11.FromJson(__content_503, JsonSerializerContext); - } - else - { - var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_503 = await global::Cohere.OAuthAuthorizeConnectorResponse11.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_503 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseObject = __value_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond - if ((int)__response.StatusCode == 504) - { - string? __content_504 = null; - global::System.Exception? __exception_504 = null; - global::Cohere.OAuthAuthorizeConnectorResponse12? __value_504 = null; - try - { - if (ReadResponseAsString) - { - __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_504 = global::Cohere.OAuthAuthorizeConnectorResponse12.FromJson(__content_504, JsonSerializerContext); - } - else - { - var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_504 = await global::Cohere.OAuthAuthorizeConnectorResponse12.FromJsonStreamAsync(__contentStream_504, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_504 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_504 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_504, - statusCode: __response.StatusCode) - { - ResponseBody = __content_504, - ResponseObject = __value_504, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessOAuthAuthorizeConnectorResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::Cohere.OAuthAuthorizeResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Cohere.OAuthAuthorizeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - } - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.UpdateConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.UpdateConnector.g.cs deleted file mode 100644 index fe1796e9..00000000 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.UpdateConnector.g.cs +++ /dev/null @@ -1,686 +0,0 @@ - -#nullable enable - -namespace Cohere -{ - public partial class ConnectorsClient - { - partial void PrepareUpdateConnectorArguments( - global::System.Net.Http.HttpClient httpClient, - ref string id, - ref string? xClientName, - global::Cohere.UpdateConnectorRequest request); - partial void PrepareUpdateConnectorRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string id, - string? xClientName, - global::Cohere.UpdateConnectorRequest request); - partial void ProcessUpdateConnectorResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessUpdateConnectorResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Update a Connector
- /// Update a connector by ID. Omitted fields will not be updated. See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information. - ///
- /// - /// - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task UpdateConnectorAsync( - string id, - global::Cohere.UpdateConnectorRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - request = request ?? throw new global::System.ArgumentNullException(nameof(request)); - - PrepareArguments( - client: HttpClient); - PrepareUpdateConnectorArguments( - httpClient: HttpClient, - id: ref id, - xClientName: ref xClientName, - request: request); - - var __pathBuilder = new global::Cohere.PathBuilder( - path: $"/v1/connectors/{id}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: new global::System.Net.Http.HttpMethod("PATCH"), - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in Authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - if (xClientName != default) - { - __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); - } - - var __httpRequestContentBody = request.ToJson(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); - PrepareUpdateConnectorRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - id: id, - 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); - ProcessUpdateConnectorResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::Cohere.UpdateConnectorResponse2? __value_400 = null; - try - { - if (ReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Cohere.UpdateConnectorResponse2.FromJson(__content_400, JsonSerializerContext); - } - else - { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Cohere.UpdateConnectorResponse2.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 401) - { - string? __content_401 = null; - global::System.Exception? __exception_401 = null; - global::Cohere.UpdateConnectorResponse3? __value_401 = null; - try - { - if (ReadResponseAsString) - { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_401 = global::Cohere.UpdateConnectorResponse3.FromJson(__content_401, JsonSerializerContext); - } - else - { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_401 = await global::Cohere.UpdateConnectorResponse3.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_401 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::Cohere.UpdateConnectorResponse4? __value_403 = null; - try - { - if (ReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Cohere.UpdateConnectorResponse4.FromJson(__content_403, JsonSerializerContext); - } - else - { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Cohere.UpdateConnectorResponse4.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id - if ((int)__response.StatusCode == 404) - { - string? __content_404 = null; - global::System.Exception? __exception_404 = null; - global::Cohere.UpdateConnectorResponse5? __value_404 = null; - try - { - if (ReadResponseAsString) - { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Cohere.UpdateConnectorResponse5.FromJson(__content_404, JsonSerializerContext); - } - else - { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Cohere.UpdateConnectorResponse5.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_404 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::Cohere.UpdateConnectorResponse6? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Cohere.UpdateConnectorResponse6.FromJson(__content_422, JsonSerializerContext); - } - else - { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Cohere.UpdateConnectorResponse6.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Too many requests - if ((int)__response.StatusCode == 429) - { - string? __content_429 = null; - global::System.Exception? __exception_429 = null; - global::Cohere.UpdateConnectorResponse7? __value_429 = null; - try - { - if (ReadResponseAsString) - { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Cohere.UpdateConnectorResponse7.FromJson(__content_429, JsonSerializerContext); - } - else - { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Cohere.UpdateConnectorResponse7.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_429 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseObject = __value_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request or response contains a deny-listed token. - if ((int)__response.StatusCode == 498) - { - string? __content_498 = null; - global::System.Exception? __exception_498 = null; - global::Cohere.UpdateConnectorResponse8? __value_498 = null; - try - { - if (ReadResponseAsString) - { - __content_498 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_498 = global::Cohere.UpdateConnectorResponse8.FromJson(__content_498, JsonSerializerContext); - } - else - { - var __contentStream_498 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_498 = await global::Cohere.UpdateConnectorResponse8.FromJsonStreamAsync(__contentStream_498, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_498 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_498 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_498, - statusCode: __response.StatusCode) - { - ResponseBody = __content_498, - ResponseObject = __value_498, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request is cancelled by the user. - if ((int)__response.StatusCode == 499) - { - string? __content_499 = null; - global::System.Exception? __exception_499 = null; - global::Cohere.UpdateConnectorResponse9? __value_499 = null; - try - { - if (ReadResponseAsString) - { - __content_499 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_499 = global::Cohere.UpdateConnectorResponse9.FromJson(__content_499, JsonSerializerContext); - } - else - { - var __contentStream_499 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_499 = await global::Cohere.UpdateConnectorResponse9.FromJsonStreamAsync(__contentStream_499, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_499 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_499 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_499, - statusCode: __response.StatusCode) - { - ResponseBody = __content_499, - ResponseObject = __value_499, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when an uncategorised internal server error occurs. - if ((int)__response.StatusCode == 500) - { - string? __content_500 = null; - global::System.Exception? __exception_500 = null; - global::Cohere.UpdateConnectorResponse10? __value_500 = null; - try - { - if (ReadResponseAsString) - { - __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_500 = global::Cohere.UpdateConnectorResponse10.FromJson(__content_500, JsonSerializerContext); - } - else - { - var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_500 = await global::Cohere.UpdateConnectorResponse10.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_500 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the requested feature is not implemented. - if ((int)__response.StatusCode == 501) - { - string? __content_501 = null; - global::System.Exception? __exception_501 = null; - global::Cohere.UpdateConnectorResponse11? __value_501 = null; - try - { - if (ReadResponseAsString) - { - __content_501 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_501 = global::Cohere.UpdateConnectorResponse11.FromJson(__content_501, JsonSerializerContext); - } - else - { - var __contentStream_501 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_501 = await global::Cohere.UpdateConnectorResponse11.FromJsonStreamAsync(__contentStream_501, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_501 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_501 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_501, - statusCode: __response.StatusCode) - { - ResponseBody = __content_501, - ResponseObject = __value_501, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time - if ((int)__response.StatusCode == 503) - { - string? __content_503 = null; - global::System.Exception? __exception_503 = null; - global::Cohere.UpdateConnectorResponse12? __value_503 = null; - try - { - if (ReadResponseAsString) - { - __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_503 = global::Cohere.UpdateConnectorResponse12.FromJson(__content_503, JsonSerializerContext); - } - else - { - var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_503 = await global::Cohere.UpdateConnectorResponse12.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_503 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseObject = __value_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond - if ((int)__response.StatusCode == 504) - { - string? __content_504 = null; - global::System.Exception? __exception_504 = null; - global::Cohere.UpdateConnectorResponse13? __value_504 = null; - try - { - if (ReadResponseAsString) - { - __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_504 = global::Cohere.UpdateConnectorResponse13.FromJson(__content_504, JsonSerializerContext); - } - else - { - var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_504 = await global::Cohere.UpdateConnectorResponse13.FromJsonStreamAsync(__contentStream_504, JsonSerializerContext).ConfigureAwait(false); - } - } - catch (global::System.Exception __ex) - { - __exception_504 = __ex; - } - - throw new global::Cohere.ApiException( - message: __content_504 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_504, - statusCode: __response.StatusCode) - { - ResponseBody = __content_504, - ResponseObject = __value_504, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessUpdateConnectorResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::Cohere.UpdateConnectorResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Cohere.UpdateConnectorResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - throw new global::Cohere.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - } - - /// - /// Update a Connector
- /// Update a connector by ID. Omitted fields will not be updated. See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information. - ///
- /// - /// - /// - /// Default Value: true - /// - /// - /// Default Value: false - /// - /// - /// A list of fields to exclude from the prompt (fields remain in the document). - /// - /// - /// A human-readable name for the connector. - /// - /// - /// - /// - /// The URL of the connector that will be used to search for documents. - /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task UpdateConnectorAsync( - string id, - string? xClientName = default, - bool? active = default, - bool? continueOnFailure = default, - global::System.Collections.Generic.IList? excludes = default, - string? name = default, - global::Cohere.CreateConnectorOAuth? oauth = default, - global::Cohere.CreateConnectorServiceAuth? serviceAuth = default, - string? url = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - var __request = new global::Cohere.UpdateConnectorRequest - { - Active = active, - ContinueOnFailure = continueOnFailure, - Excludes = excludes, - Name = name, - Oauth = oauth, - ServiceAuth = serviceAuth, - Url = url, - }; - - return await UpdateConnectorAsync( - id: id, - xClientName: xClientName, - request: __request, - cancellationToken: cancellationToken).ConfigureAwait(false); - } - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.ICohereClient.Chat.g.cs b/src/libs/Cohere/Generated/Cohere.ICohereClient.Chat.g.cs index 66374227..3e3a65af 100644 --- a/src/libs/Cohere/Generated/Cohere.ICohereClient.Chat.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ICohereClient.Chat.g.cs @@ -38,11 +38,6 @@ public partial interface ICohereClient /// 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.
/// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments /// - /// - /// Accepts `{"id": "web-search"}`, and/or the `"id"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) one.
- /// When specified, the model's reply will be enriched with information found by querying each of the connectors (RAG).
- /// Compatible Deployments: Cohere Platform - /// /// /// An alternative to `chat_history`.
/// Providing a `conversation_id` creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
@@ -147,11 +142,6 @@ public partial interface ICohereClient /// **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes.
/// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments /// - /// - /// Defaults to `false`.
- /// When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated.
- /// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - /// /// /// If specified, the backend will make a best effort to sample tokens
/// deterministically, such that repeated requests with the same
@@ -219,7 +209,6 @@ public partial interface ICohereClient global::Cohere.ChatAccepts? accepts = default, global::System.Collections.Generic.IList? chatHistory = default, global::Cohere.ChatRequestCitationQuality? citationQuality = default, - global::System.Collections.Generic.IList? connectors = default, string? conversationId = default, global::System.Collections.Generic.IList? documents = default, bool? forceSingleStep = default, @@ -229,7 +218,6 @@ public partial interface ICohereClient bool? rawPrompting = default, global::Cohere.ResponseFormat? responseFormat = default, global::Cohere.ChatRequestSafetyMode? safetyMode = default, - bool? searchQueriesOnly = default, int? seed = default, bool? stream = default, float? temperature = default, diff --git a/src/libs/Cohere/Generated/Cohere.ICohereClient.Classify.g.cs b/src/libs/Cohere/Generated/Cohere.ICohereClient.Classify.g.cs deleted file mode 100644 index a04c7b11..00000000 --- a/src/libs/Cohere/Generated/Cohere.ICohereClient.Classify.g.cs +++ /dev/null @@ -1,65 +0,0 @@ -#nullable enable - -namespace Cohere -{ - public partial interface ICohereClient - { - /// - /// Classify
- /// This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference.
- /// Note: [Fine-tuned models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly. - ///
- /// - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task ClassifyAsync( - global::Cohere.ClassifyRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - - /// - /// Classify
- /// This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference.
- /// Note: [Fine-tuned models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly. - ///
- /// - /// - /// An array of examples to provide context to the model. Each example is a text string and its associated label/class. Each unique label requires at least 2 examples associated with it; the maximum number of examples is 2500, and each example has a maximum length of 512 tokens. The values should be structured as `{text: "...",label: "..."}`.
- /// Note: [Fine-tuned Models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly.
- /// Included only in requests - /// - /// - /// A list of up to 96 texts to be classified. Each one must be a non-empty string.
- /// There is, however, no consistent, universal limit to the length a particular input can be. We perform classification on the first `x` tokens of each input, and `x` varies depending on which underlying model is powering classification. The maximum token length for each model is listed in the "max tokens" column [here](https://docs.cohere.com/docs/models).
- /// Note: by default the `truncate` parameter is set to `END`, so tokens exceeding the limit will be automatically dropped. This behavior can be disabled by setting `truncate` to `NONE`, which will result in validation errors for longer texts.
- /// Included only in requests - /// - /// - /// ID of a [Fine-tuned](https://docs.cohere.com/v2/docs/classify-starting-the-training) Classify model
- /// Included only in requests - /// - /// - /// The ID of a custom playground preset. You can create presets in the [playground](https://dashboard.cohere.com/playground). If you use a preset, all other parameters become optional, and any included parameters will override the preset's parameters.
- /// Included only in requests
- /// Example: my-preset-a58sbd - /// - /// - /// One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.
- /// 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.
- /// If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned.
- /// Default Value: END
- /// Included only in requests - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task ClassifyAsync( - global::System.Collections.Generic.IList examples, - global::System.Collections.Generic.IList inputs, - string model, - string preset, - global::Cohere.ClassifyRequestTruncate truncate, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.ICohereClient.Generate.g.cs b/src/libs/Cohere/Generated/Cohere.ICohereClient.Generate.g.cs deleted file mode 100644 index 7753c93a..00000000 --- a/src/libs/Cohere/Generated/Cohere.ICohereClient.Generate.g.cs +++ /dev/null @@ -1,146 +0,0 @@ -#nullable enable - -namespace Cohere -{ - public partial interface ICohereClient - { - /// - /// Generate
- /// <Warning>
- /// This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.
- /// </Warning>
- /// Generates realistic text conditioned on a given input. - ///
- /// - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task GenerateAsync( - global::Cohere.GenerateRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - - /// - /// Generate
- /// <Warning>
- /// This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.
- /// </Warning>
- /// Generates realistic text conditioned on a given input. - ///
- /// - /// - /// The generated text will be cut at the beginning of the earliest occurrence of an end sequence. The sequence will be excluded from the text.
- /// Included only in requests - /// - /// - /// Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
- /// Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models.
- /// Included only in requests - /// - /// - /// Ensures only the top `k` most likely tokens are considered for generation at each step.
- /// Defaults to `0`, min value of `0`, max value of `500`.
- /// Included only in requests - /// - /// - /// The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.
- /// This parameter is off by default, and if it's not specified, the model will continue generating until it emits an EOS completion token. See [BPE Tokens](/bpe-tokens-wiki) for more details.
- /// Can only be set to `0` if `return_likelihoods` is set to `ALL` to get the likelihood of the prompt.
- /// Included only in requests - /// - /// - /// The identifier of the model to generate with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental).
- /// Smaller, "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID.
- /// Included only in requests - /// - /// - /// The maximum number of generations that will be returned. Defaults to `1`, min value of `1`, max value of `5`.
- /// Included only in requests - /// - /// - /// Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`.
- /// Defaults to `0.75`. min value of `0.01`, max value of `0.99`.
- /// Included only in requests - /// - /// - /// Defaults to `0.0`, min value of `0.0`, max value of `1.0`.
- /// Can be used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
- /// Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models.
- /// Included only in requests - /// - /// - /// Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.com/playground/generate).
- /// When a preset is specified, the `prompt` parameter becomes optional, and any included parameters will override the preset's parameters.
- /// Included only in requests
- /// Example: my-preset-a58sbd - /// - /// - /// The input text that serves as the starting point for generating the response.
- /// Note: The prompt will be pre-processed and modified before reaching the model.
- /// Included only in requests
- /// Example: Please explain to me how LLMs work - /// - /// - /// When enabled, the user's prompt will be sent to the model without any pre-processing. - /// - /// - /// One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`.
- /// If `GENERATION` is selected, the token likelihoods will only be provided for generated text.
- /// WARNING: `ALL` is deprecated, and will be removed in a future release.
- /// Default Value: NONE - /// - /// - /// If specified, the backend will make a best effort to sample tokens
- /// deterministically, such that repeated requests with the same
- /// seed and parameters should return the same result. However,
- /// determinism cannot be totally guaranteed.
- /// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - /// - /// - /// The generated text will be cut at the end of the earliest occurrence of a stop sequence. The sequence will be included the text.
- /// Included only in requests - /// - /// - /// When `true`, the response will be a JSON stream of events. Streaming is beneficial for user interfaces that render the contents of the response piece by piece, as it gets generated.
- /// The final event will contain the complete response, and will contain an `is_finished` field set to `true`. The event will also contain a `finish_reason`, which can be one of the following:
- /// - `COMPLETE` - the model sent back a finished reply
- /// - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens for its context length
- /// - `ERROR` - something went wrong when generating the reply
- /// - `ERROR_TOXIC` - the model generated a reply that was deemed toxic - /// - /// - /// A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations. See [Temperature](/temperature-wiki) for more details.
- /// Defaults to `0.75`, min value of `0.0`, max value of `5.0`.
- /// Included only in requests - /// - /// - /// One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.
- /// 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.
- /// If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned.
- /// Default Value: END
- /// Included only in requests - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task GenerateAsync( - global::System.Collections.Generic.IList endSequences, - double frequencyPenalty, - int k, - int maxTokens, - string model, - int numGenerations, - double p, - double presencePenalty, - string preset, - string prompt, - global::System.Collections.Generic.IList stopSequences, - double temperature, - global::Cohere.GenerateRequestTruncate truncate, - string? xClientName = default, - bool? rawPrompting = default, - global::Cohere.GenerateRequestReturnLikelihoods? returnLikelihoods = default, - int? seed = default, - bool? stream = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.ICohereClient.Summarize.g.cs b/src/libs/Cohere/Generated/Cohere.ICohereClient.Summarize.g.cs deleted file mode 100644 index f1351db0..00000000 --- a/src/libs/Cohere/Generated/Cohere.ICohereClient.Summarize.g.cs +++ /dev/null @@ -1,76 +0,0 @@ -#nullable enable - -namespace Cohere -{ - public partial interface ICohereClient - { - /// - /// Summarize
- /// <Warning>
- /// This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.
- /// </Warning>
- /// Generates a summary in English for a given text. - ///
- /// - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task SummarizeAsync( - global::Cohere.SummarizeRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - - /// - /// Summarize
- /// <Warning>
- /// This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.
- /// </Warning>
- /// Generates a summary in English for a given text. - ///
- /// - /// - /// A free-form instruction for modifying how the summaries get generated. Should complete the sentence "Generate a summary _". Eg. "focusing on the next steps" or "written by Yoda"
- /// Included only in requests - /// - /// - /// One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text.
- /// Default Value: low
- /// Included only in requests - /// - /// - /// One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If `auto` is selected, the best option will be picked based on the input text.
- /// Default Value: paragraph
- /// Included only in requests - /// - /// - /// One of `short`, `medium`, `long`, or `auto` defaults to `auto`. Indicates the approximate length of the summary. If `auto` is selected, the best option will be picked based on the input text.
- /// Default Value: medium
- /// Included only in requests - /// - /// - /// The identifier of the model to generate the summary with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental). Smaller, "light" models are faster, while larger models will perform better.
- /// Included only in requests - /// - /// - /// Ranges from 0 to 5. Controls the randomness of the output. Lower values tend to generate more “predictable” output, while higher values tend to generate more “creative” output. The sweet spot is typically between 0 and 1.
- /// Default Value: 0.3
- /// Included only in requests - /// - /// - /// The text to generate a summary for. Can be up to 100,000 characters long. Currently the only supported language is English.
- /// Included only in requests - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task SummarizeAsync( - string additionalCommand, - global::Cohere.SummarizeRequestExtractiveness extractiveness, - global::Cohere.SummarizeRequestFormat format, - global::Cohere.SummarizeRequestLength length, - string model, - double temperature, - string text, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.CreateConnector.g.cs b/src/libs/Cohere/Generated/Cohere.IConnectorsClient.CreateConnector.g.cs deleted file mode 100644 index a12aca78..00000000 --- a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.CreateConnector.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -#nullable enable - -namespace Cohere -{ - public partial interface IConnectorsClient - { - /// - /// Create a Connector
- /// Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) for more information. - ///
- /// - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task CreateConnectorAsync( - global::Cohere.CreateConnectorRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - - /// - /// Create a Connector
- /// Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) for more information. - ///
- /// - /// - /// Whether the connector is active or not.
- /// Default Value: true - /// - /// - /// Whether a chat request should continue or not if the request to this connector fails.
- /// Default Value: false - /// - /// - /// A description of the connector. - /// - /// - /// A list of fields to exclude from the prompt (fields remain in the document). - /// - /// - /// A human-readable name for the connector. - /// - /// - /// - /// - /// The URL of the connector that will be used to search for documents. - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task CreateConnectorAsync( - string name, - string url, - string? xClientName = default, - bool? active = default, - bool? continueOnFailure = default, - string? description = default, - global::System.Collections.Generic.IList? excludes = default, - global::Cohere.CreateConnectorOAuth? oauth = default, - global::Cohere.CreateConnectorServiceAuth? serviceAuth = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.DeleteConnector.g.cs b/src/libs/Cohere/Generated/Cohere.IConnectorsClient.DeleteConnector.g.cs deleted file mode 100644 index 9c648d30..00000000 --- a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.DeleteConnector.g.cs +++ /dev/null @@ -1,20 +0,0 @@ -#nullable enable - -namespace Cohere -{ - public partial interface IConnectorsClient - { - /// - /// Delete a Connector
- /// Delete a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information. - ///
- /// - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task DeleteConnectorAsync( - string id, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.GetConnector.g.cs b/src/libs/Cohere/Generated/Cohere.IConnectorsClient.GetConnector.g.cs deleted file mode 100644 index 95fcb404..00000000 --- a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.GetConnector.g.cs +++ /dev/null @@ -1,20 +0,0 @@ -#nullable enable - -namespace Cohere -{ - public partial interface IConnectorsClient - { - /// - /// Get a Connector
- /// Retrieve a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information. - ///
- /// - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task GetConnectorAsync( - string id, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.ListConnectors.g.cs b/src/libs/Cohere/Generated/Cohere.IConnectorsClient.ListConnectors.g.cs deleted file mode 100644 index 7881a80e..00000000 --- a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.ListConnectors.g.cs +++ /dev/null @@ -1,26 +0,0 @@ -#nullable enable - -namespace Cohere -{ - public partial interface IConnectorsClient - { - /// - /// List Connectors
- /// Returns a list of connectors ordered by descending creation date (newer first). See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information. - ///
- /// - /// Default Value: 30 - /// - /// - /// Default Value: 0 - /// - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task ListConnectorsAsync( - double? limit = default, - double? offset = default, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.OAuthAuthorizeConnector.g.cs b/src/libs/Cohere/Generated/Cohere.IConnectorsClient.OAuthAuthorizeConnector.g.cs deleted file mode 100644 index 454c7cd4..00000000 --- a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.OAuthAuthorizeConnector.g.cs +++ /dev/null @@ -1,22 +0,0 @@ -#nullable enable - -namespace Cohere -{ - public partial interface IConnectorsClient - { - /// - /// Authorize with oAuth
- /// Authorize the connector with the given ID for the connector oauth app. See ['Connector Authentication'](https://docs.cohere.com/docs/connector-authentication) for more information. - ///
- /// - /// - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task OAuthAuthorizeConnectorAsync( - string id, - string? afterTokenRedirect = default, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.UpdateConnector.g.cs b/src/libs/Cohere/Generated/Cohere.IConnectorsClient.UpdateConnector.g.cs deleted file mode 100644 index 71b1cbf3..00000000 --- a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.UpdateConnector.g.cs +++ /dev/null @@ -1,59 +0,0 @@ -#nullable enable - -namespace Cohere -{ - public partial interface IConnectorsClient - { - /// - /// Update a Connector
- /// Update a connector by ID. Omitted fields will not be updated. See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information. - ///
- /// - /// - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task UpdateConnectorAsync( - string id, - global::Cohere.UpdateConnectorRequest request, - string? xClientName = default, - global::System.Threading.CancellationToken cancellationToken = default); - - /// - /// Update a Connector
- /// Update a connector by ID. Omitted fields will not be updated. See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information. - ///
- /// - /// - /// - /// Default Value: true - /// - /// - /// Default Value: false - /// - /// - /// A list of fields to exclude from the prompt (fields remain in the document). - /// - /// - /// A human-readable name for the connector. - /// - /// - /// - /// - /// The URL of the connector that will be used to search for documents. - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task UpdateConnectorAsync( - string id, - string? xClientName = default, - bool? active = default, - bool? continueOnFailure = default, - global::System.Collections.Generic.IList? excludes = default, - string? name = default, - global::Cohere.CreateConnectorOAuth? oauth = default, - global::Cohere.CreateConnectorServiceAuth? serviceAuth = default, - string? url = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Cohere/Generated/Cohere.Models.ChatRequest.g.cs b/src/libs/Cohere/Generated/Cohere.Models.ChatRequest.g.cs index 216f7107..7a22dc0b 100644 --- a/src/libs/Cohere/Generated/Cohere.Models.ChatRequest.g.cs +++ b/src/libs/Cohere/Generated/Cohere.Models.ChatRequest.g.cs @@ -32,6 +32,7 @@ public sealed partial class ChatRequest /// Compatible Deployments: Cohere Platform /// [global::System.Text.Json.Serialization.JsonPropertyName("connectors")] + [global::System.Obsolete("This property marked as deprecated.")] public global::System.Collections.Generic.IList? Connectors { get; set; } /// @@ -196,6 +197,7 @@ public sealed partial class ChatRequest /// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments /// [global::System.Text.Json.Serialization.JsonPropertyName("search_queries_only")] + [global::System.Obsolete("This property marked as deprecated.")] public bool? SearchQueriesOnly { get; set; } /// @@ -288,11 +290,6 @@ public sealed partial class ChatRequest /// 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.
/// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments /// - /// - /// Accepts `{"id": "web-search"}`, and/or the `"id"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) one.
- /// When specified, the model's reply will be enriched with information found by querying each of the connectors (RAG).
- /// Compatible Deployments: Cohere Platform - /// /// /// An alternative to `chat_history`.
/// Providing a `conversation_id` creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
@@ -397,11 +394,6 @@ public sealed partial class ChatRequest /// **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes.
/// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments /// - /// - /// Defaults to `false`.
- /// When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated.
- /// Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - /// /// /// If specified, the backend will make a best effort to sample tokens
/// deterministically, such that repeated requests with the same
@@ -461,7 +453,6 @@ public ChatRequest( string message, global::System.Collections.Generic.IList? chatHistory, global::Cohere.ChatRequestCitationQuality? citationQuality, - global::System.Collections.Generic.IList? connectors, string? conversationId, global::System.Collections.Generic.IList? documents, bool? forceSingleStep, @@ -477,7 +468,6 @@ public ChatRequest( bool? rawPrompting, global::Cohere.ResponseFormat? responseFormat, global::Cohere.ChatRequestSafetyMode? safetyMode, - bool? searchQueriesOnly, int? seed, global::System.Collections.Generic.IList? stopSequences, bool? stream, @@ -488,7 +478,6 @@ public ChatRequest( this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); this.ChatHistory = chatHistory; this.CitationQuality = citationQuality; - this.Connectors = connectors; this.ConversationId = conversationId; this.Documents = documents; this.ForceSingleStep = forceSingleStep; @@ -504,7 +493,6 @@ public ChatRequest( this.RawPrompting = rawPrompting; this.ResponseFormat = responseFormat; this.SafetyMode = safetyMode; - this.SearchQueriesOnly = searchQueriesOnly; this.Seed = seed; this.StopSequences = stopSequences; this.Stream = stream; diff --git a/src/libs/Cohere/openapi.yaml b/src/libs/Cohere/openapi.yaml index ced239e7..143c2296 100644 --- a/src/libs/Cohere/openapi.yaml +++ b/src/libs/Cohere/openapi.yaml @@ -63,6 +63,7 @@ paths: items: $ref: '#/components/schemas/ChatConnector' description: "Accepts `{\"id\": \"web-search\"}`, and/or the `\"id\"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) one.\n\nWhen specified, the model's reply will be enriched with information found by querying each of the connectors (RAG).\n\nCompatible Deployments: Cohere Platform\n" + deprecated: true x-fern-audiences: - public conversation_id: @@ -167,6 +168,7 @@ paths: search_queries_only: type: boolean description: "Defaults to `false`.\n\nWhen `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated.\n\nCompatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments\n" + deprecated: true x-fern-audiences: - public seed: @@ -1002,6 +1004,7 @@ paths: $ref: '#/components/responses/ServiceUnavailable' '504': $ref: '#/components/responses/GatewayTimeout' + deprecated: true x-fern-audiences: - public x-fern-examples: @@ -1125,6 +1128,7 @@ paths: $ref: '#/components/responses/ServiceUnavailable' '504': $ref: '#/components/responses/GatewayTimeout' + deprecated: true x-fern-audiences: - public x-fern-examples: @@ -1194,6 +1198,7 @@ paths: $ref: '#/components/responses/ServiceUnavailable' '504': $ref: '#/components/responses/GatewayTimeout' + deprecated: true x-fern-audiences: - public x-fern-examples: @@ -1266,6 +1271,7 @@ paths: $ref: '#/components/responses/ServiceUnavailable' '504': $ref: '#/components/responses/GatewayTimeout' + deprecated: true x-fern-audiences: - public x-fern-examples: @@ -1337,6 +1343,7 @@ paths: $ref: '#/components/responses/ServiceUnavailable' '504': $ref: '#/components/responses/GatewayTimeout' + deprecated: true x-fern-audiences: - public x-fern-examples: @@ -1414,6 +1421,7 @@ paths: $ref: '#/components/responses/ServiceUnavailable' '504': $ref: '#/components/responses/GatewayTimeout' + deprecated: true x-fern-audiences: - public x-fern-examples: @@ -1493,6 +1501,7 @@ paths: $ref: '#/components/responses/ServiceUnavailable' '504': $ref: '#/components/responses/GatewayTimeout' + deprecated: true x-fern-audiences: - public x-fern-examples: @@ -6614,6 +6623,7 @@ paths: $ref: '#/components/responses/ServiceUnavailable' '504': $ref: '#/components/responses/GatewayTimeout' + deprecated: true x-fern-audiences: - public x-fern-examples: @@ -7168,6 +7178,7 @@ paths: $ref: '#/components/responses/ServiceUnavailable' '504': $ref: '#/components/responses/GatewayTimeout' + deprecated: true x-fern-audiences: - public x-fern-examples: @@ -8761,16 +8772,16 @@ paths: type: message-end event: message-end - code-samples: - - code: "const { CohereClientV2 } = require('cohere-ai');\n\nconst cohere = new CohereClientV2({});\n\n(async () => {\n const response = await cohere.chat({\n model: 'command-a-vision-07-2025',\n messages: [\n {\n role: 'user',\n content: [\n { type: 'text', text: 'Describe the logo!' },\n {\n type: 'image_url',\n imageUrl: {\n url: 'https://cohere.com/favicon-32x32.png',\n detail: 'auto',\n },\n },\n ],\n },\n ],\n });\n console.log(response.message.content[0].text);\n})();\n" + - code: "const { CohereClientV2 } = require('cohere-ai');\n\nconst cohere = new CohereClientV2({});\n\n(async () => {\n const response = await cohere.chat({\n model: 'command-a-vision-07-2025',\n messages: [\n {\n role: 'user',\n content: [\n { type: 'text', text: 'Describe the logo!' },\n {\n type: 'image_url',\n imageUrl: {\n // Can be either a base64 data URI or a web URL.\n url: 'https://cohere.com/favicon-32x32.png',\n detail: 'auto',\n },\n },\n ],\n },\n ],\n });\n console.log(response.message.content[0].text);\n})();\n" name: Images sdk: typescript - - code: "import cohere\n\nco = cohere.ClientV2()\n\nresponse = co.chat(\n model=\"command-a-vision-07-2025\",\n messages=[\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Describe the logo!\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://cohere.com/favicon-32x32.png\",\n \"detail\": \"auto\"\n }\n }\n ]\n \n }\n ]\n)\n\nprint(response)" + - code: "import cohere\n\nco = cohere.ClientV2()\n\nresponse = co.chat(\n model=\"command-a-vision-07-2025\",\n messages=[\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Describe the logo!\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n # Can be either a base64 data URI or a web URL.\n \"url\": \"https://cohere.com/favicon-32x32.png\",\n \"detail\": \"auto\"\n }\n }\n ]\n \n }\n ]\n)\n\nprint(response)" name: Images sdk: python - - code: "/* (C)2024 */\npackage chatv2post;\n\nimport java.util.List;\n\nimport com.cohere.api.Cohere;\nimport com.cohere.api.resources.v2.requests.V2ChatRequest;\nimport com.cohere.api.types.ChatMessageV2;\nimport com.cohere.api.types.ChatResponse;\nimport com.cohere.api.types.Content;\nimport com.cohere.api.types.ImageContent;\nimport com.cohere.api.types.ImageUrl;\nimport com.cohere.api.types.TextContent;\nimport com.cohere.api.types.UserMessage;\nimport com.cohere.api.types.UserMessageContent;\n\npublic class Image {\n\n public static void main(String[] args) {\n Cohere cohere = Cohere.builder().clientName(\"snippet\").build();\n\n ChatResponse response\n = cohere\n .v2()\n .chat(\n V2ChatRequest.builder()\n .model(\"command-a-vision-07-2025\")\n .messages(\n List.of(\n ChatMessageV2.user(\n UserMessage.builder()\n .content(\n UserMessageContent.of(\n List.of(\n Content.text(\n TextContent.builder()\n .text(\"Describe the logo!\")\n .build()),\n Content.imageUrl(\n ImageContent.builder()\n .imageUrl(\n ImageUrl.builder()\n .url(\n \"https://cohere.com/favicon-32x32.png\")\n .build())\n .build()))))\n .build())))\n .build());\n System.out.println(response);\n }\n}\n" + - code: "/* (C)2024 */\npackage chatv2post;\n\nimport java.util.List;\n\nimport com.cohere.api.Cohere;\nimport com.cohere.api.resources.v2.requests.V2ChatRequest;\nimport com.cohere.api.types.ChatMessageV2;\nimport com.cohere.api.types.ChatResponse;\nimport com.cohere.api.types.Content;\nimport com.cohere.api.types.ImageContent;\nimport com.cohere.api.types.ImageUrl;\nimport com.cohere.api.types.TextContent;\nimport com.cohere.api.types.UserMessage;\nimport com.cohere.api.types.UserMessageContent;\n\npublic class Image {\n\n public static void main(String[] args) {\n Cohere cohere = Cohere.builder().clientName(\"snippet\").build();\n\n ChatResponse response\n = cohere\n .v2()\n .chat(\n V2ChatRequest.builder()\n .model(\"command-a-vision-07-2025\")\n .messages(\n List.of(\n ChatMessageV2.user(\n UserMessage.builder()\n .content(\n UserMessageContent.of(\n List.of(\n Content.text(\n TextContent.builder()\n .text(\"Describe the logo!\")\n .build()),\n Content.imageUrl(\n ImageContent.builder()\n .imageUrl(\n ImageUrl.builder()\n // Can be either a base64 data URI or a web URL.\n .url(\n \"https://cohere.com/favicon-32x32.png\")\n .build())\n .build()))))\n .build())))\n .build());\n System.out.println(response);\n }\n}\n" name: Images sdk: java - - code: "package main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\n\tcohere \"github.com/cohere-ai/cohere-go/v2\"\n\tclient \"github.com/cohere-ai/cohere-go/v2/client\"\n)\n\nfunc main() {\n\tco := client.NewClient(client.WithToken(os.Getenv(\"CO_API_KEY\")))\n\n\tresp, err := co.V2.Chat(\n\t\tcontext.TODO(),\n\t\t&cohere.V2ChatRequest{\n\t\t\tModel: \"command-a-03-2025\",\n\t\t\tMessages: cohere.ChatMessages{\n\t\t\t\t{\n\t\t\t\t\tRole: \"user\",\n\t\t\t\t\tUser: &cohere.UserMessageV2{Content: &cohere.UserMessageV2Content{\n\t\t\t\t\t\tContentList: []*cohere.Content{\n\t\t\t\t\t\t\t{Type: \"text\", Text: &cohere.ChatTextContent{Text: \"Describe the logo!\"}},\n\t\t\t\t\t\t\t{Type: \"image_url\", ImageUrl: &cohere.ImageContent{\n\t\t\t\t\t\t\t\tImageUrl: &cohere.ImageUrl{\n\t\t\t\t\t\t\t\t\tUrl: \"https://cohere.com/favicon-32x32.png\",\n\t\t\t\t\t\t\t\t\tDetail: cohere.ImageUrlDetailAuto.Ptr(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t}}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"%+v\", resp)\n}\n" + - code: "package main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\n\tcohere \"github.com/cohere-ai/cohere-go/v2\"\n\tclient \"github.com/cohere-ai/cohere-go/v2/client\"\n)\n\nfunc main() {\n\tco := client.NewClient(client.WithToken(os.Getenv(\"CO_API_KEY\")))\n\n\tresp, err := co.V2.Chat(\n\t\tcontext.TODO(),\n\t\t&cohere.V2ChatRequest{\n\t\t\tModel: \"command-a-03-2025\",\n\t\t\tMessages: cohere.ChatMessages{\n\t\t\t\t{\n\t\t\t\t\tRole: \"user\",\n\t\t\t\t\tUser: &cohere.UserMessageV2{Content: &cohere.UserMessageV2Content{\n\t\t\t\t\t\tContentList: []*cohere.Content{\n\t\t\t\t\t\t\t{Type: \"text\", Text: &cohere.ChatTextContent{Text: \"Describe the logo!\"}},\n\t\t\t\t\t\t\t{Type: \"image_url\", ImageUrl: &cohere.ImageContent{\n\t\t\t\t\t\t\t\tImageUrl: &cohere.ImageUrl{\n\t\t\t\t\t\t\t\t\t// Can be either a base64 data URI or a web URL.\n\t\t\t\t\t\t\t\t\tUrl: \"https://cohere.com/favicon-32x32.png\",\n\t\t\t\t\t\t\t\t\tDetail: cohere.ImageUrlDetailAuto.Ptr(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t}}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"%+v\", resp)\n}\n" name: Images sdk: go - code: "curl --request POST \\\n --url https://api.cohere.com/v2/chat \\\n --header 'accept: application/json' \\\n --header 'content-type: application/json' \\\n --header \"Authorization: bearer $CO_API_KEY\" \\\n --data '{\n \"model\": \"command-a-vision-07-2025\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Describe the logo!\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://cohere.com/favicon-32x32.png\",\n \"detail\": \"auto\"\n }\n }\n ]\n }\n ]\n }'\n"