generated from tryAGI/SdkTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
2,303 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
166 changes: 166 additions & 0 deletions
166
src/libs/Jina/Generated/Jina.ClassificationClient.Classify.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
|
||
#nullable enable | ||
|
||
namespace Jina | ||
{ | ||
public partial class ClassificationClient | ||
{ | ||
partial void PrepareClassifyArguments( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::Jina.ClassificationAPIInput request); | ||
partial void PrepareClassifyRequest( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpRequestMessage httpRequestMessage, | ||
global::Jina.ClassificationAPIInput 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); | ||
|
||
/// <summary> | ||
/// Classify<br/> | ||
/// Classify. | ||
/// </summary> | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken">The token to cancel the operation with</param> | ||
/// <exception cref="global::System.InvalidOperationException"></exception> | ||
public async global::System.Threading.Tasks.Task<global::Jina.ClassificationOutput> ClassifyAsync( | ||
global::Jina.ClassificationAPIInput request, | ||
global::System.Threading.CancellationToken cancellationToken = default) | ||
{ | ||
request = request ?? throw new global::System.ArgumentNullException(nameof(request)); | ||
|
||
PrepareArguments( | ||
client: _httpClient); | ||
PrepareClassifyArguments( | ||
httpClient: _httpClient, | ||
request: request); | ||
|
||
var __pathBuilder = new 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)); | ||
|
||
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); | ||
} | ||
} | ||
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, | ||
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); | ||
|
||
var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); | ||
|
||
ProcessResponseContent( | ||
client: _httpClient, | ||
response: response, | ||
content: ref __content); | ||
ProcessClassifyResponseContent( | ||
httpClient: _httpClient, | ||
httpResponseMessage: response, | ||
content: ref __content); | ||
|
||
try | ||
{ | ||
response.EnsureSuccessStatusCode(); | ||
} | ||
catch (global::System.Net.Http.HttpRequestException ex) | ||
{ | ||
throw new global::System.InvalidOperationException(__content, ex); | ||
} | ||
|
||
return | ||
global::Jina.ClassificationOutput.FromJson(__content, JsonSerializerContext) ?? | ||
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); | ||
} | ||
|
||
/// <summary> | ||
/// Classify<br/> | ||
/// Classify. | ||
/// </summary> | ||
/// <param name="model"> | ||
/// The identifier of the model.<br/> | ||
/// Available models and corresponding param size and dimension:<br/> | ||
/// - `jina-clip-v1`, 223M, 768<br/> | ||
/// - `jina-embeddings-v2-base-en`, 137M, 768<br/> | ||
/// - `jina-embeddings-v2-base-es`, 161M, 768<br/> | ||
/// - `jina-embeddings-v2-base-de`, 161M, 768<br/> | ||
/// - `jina-embeddings-v2-base-zh`, 161M, 768<br/> | ||
/// - `jina-embeddings-v2-base-code`, 137M, 768<br/> | ||
/// - `jina-embeddings-v3`, 570M, 1024<br/> | ||
/// For more information, please checkout our [technical blog](https://arxiv.org/abs/2307.11224). | ||
/// </param> | ||
/// <param name="classifierId"> | ||
/// The identifier of the classifier. If not provided, a new classifier will be created.<br/> | ||
/// You can provide only either `model` or `classifier_id` | ||
/// </param> | ||
/// <param name="input"> | ||
/// List of text and images or a single text and image for classification | ||
/// </param> | ||
/// <param name="labels"> | ||
/// List of labels used for classification | ||
/// </param> | ||
/// <param name="cancellationToken">The token to cancel the operation with</param> | ||
/// <exception cref="global::System.InvalidOperationException"></exception> | ||
public async global::System.Threading.Tasks.Task<global::Jina.ClassificationOutput> ClassifyAsync( | ||
global::Jina.AnyOf<global::System.Collections.Generic.IList<global::Jina.AnyOf<global::Jina.ApiSchemasClassificationTextDoc, global::Jina.ApiSchemasClassificationImageDoc, string>>, global::Jina.ApiSchemasClassificationTextDoc, global::Jina.ApiSchemasClassificationImageDoc, string> input, | ||
string? model = default, | ||
string? classifierId = default, | ||
global::System.Collections.Generic.IList<string>? labels = default, | ||
global::System.Threading.CancellationToken cancellationToken = default) | ||
{ | ||
var request = new global::Jina.ClassificationAPIInput | ||
{ | ||
Model = model, | ||
ClassifierId = classifierId, | ||
Input = input, | ||
Labels = labels, | ||
}; | ||
|
||
return await ClassifyAsync( | ||
request: request, | ||
cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
} | ||
} |
167 changes: 167 additions & 0 deletions
167
src/libs/Jina/Generated/Jina.ClassificationClient.Train.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
|
||
#nullable enable | ||
|
||
namespace Jina | ||
{ | ||
public partial class ClassificationClient | ||
{ | ||
partial void PrepareTrainArguments( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::Jina.TrainingAPIInput request); | ||
partial void PrepareTrainRequest( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpRequestMessage httpRequestMessage, | ||
global::Jina.TrainingAPIInput request); | ||
partial void ProcessTrainResponse( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpResponseMessage httpResponseMessage); | ||
|
||
partial void ProcessTrainResponseContent( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpResponseMessage httpResponseMessage, | ||
ref string content); | ||
|
||
/// <summary> | ||
/// Train<br/> | ||
/// Rank pairs. | ||
/// </summary> | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken">The token to cancel the operation with</param> | ||
/// <exception cref="global::System.InvalidOperationException"></exception> | ||
public async global::System.Threading.Tasks.Task<global::Jina.TrainingOutput> TrainAsync( | ||
global::Jina.TrainingAPIInput request, | ||
global::System.Threading.CancellationToken cancellationToken = default) | ||
{ | ||
request = request ?? throw new global::System.ArgumentNullException(nameof(request)); | ||
|
||
PrepareArguments( | ||
client: _httpClient); | ||
PrepareTrainArguments( | ||
httpClient: _httpClient, | ||
request: request); | ||
|
||
var __pathBuilder = new PathBuilder( | ||
path: "/v1/train", | ||
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)); | ||
|
||
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); | ||
} | ||
} | ||
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); | ||
PrepareTrainRequest( | ||
httpClient: _httpClient, | ||
httpRequestMessage: httpRequest, | ||
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); | ||
ProcessTrainResponse( | ||
httpClient: _httpClient, | ||
httpResponseMessage: response); | ||
|
||
var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); | ||
|
||
ProcessResponseContent( | ||
client: _httpClient, | ||
response: response, | ||
content: ref __content); | ||
ProcessTrainResponseContent( | ||
httpClient: _httpClient, | ||
httpResponseMessage: response, | ||
content: ref __content); | ||
|
||
try | ||
{ | ||
response.EnsureSuccessStatusCode(); | ||
} | ||
catch (global::System.Net.Http.HttpRequestException ex) | ||
{ | ||
throw new global::System.InvalidOperationException(__content, ex); | ||
} | ||
|
||
return | ||
global::Jina.TrainingOutput.FromJson(__content, JsonSerializerContext) ?? | ||
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); | ||
} | ||
|
||
/// <summary> | ||
/// Train<br/> | ||
/// Rank pairs. | ||
/// </summary> | ||
/// <param name="model"> | ||
/// The identifier of the model.<br/> | ||
/// Available models and corresponding param size and dimension:<br/> | ||
/// - `jina-clip-v1`, 223M, 768<br/> | ||
/// - `jina-embeddings-v2-base-en`, 137M, 768<br/> | ||
/// - `jina-embeddings-v2-base-es`, 161M, 768<br/> | ||
/// - `jina-embeddings-v2-base-de`, 161M, 768<br/> | ||
/// - `jina-embeddings-v2-base-zh`, 161M, 768<br/> | ||
/// - `jina-embeddings-v2-base-code`, 137M, 768<br/> | ||
/// For more information, please checkout our [technical blog](https://arxiv.org/abs/2307.11224).<br/> | ||
/// You can provide only either `model` or `classifier_id` | ||
/// </param> | ||
/// <param name="classifierId"> | ||
/// The identifier of the classifier. If not provided, a new classifier will be created.<br/> | ||
/// You can provide only either `model` or `classifier_id` | ||
/// </param> | ||
/// <param name="visibility"> | ||
/// The visibility of the classifier when created. Will be ignored if `classifier_id` is provided<br/> | ||
/// Default Value: public | ||
/// </param> | ||
/// <param name="input"> | ||
/// List of text and images and labels or a single text and image and label to train the classifier | ||
/// </param> | ||
/// <param name="cancellationToken">The token to cancel the operation with</param> | ||
/// <exception cref="global::System.InvalidOperationException"></exception> | ||
public async global::System.Threading.Tasks.Task<global::Jina.TrainingOutput> TrainAsync( | ||
global::Jina.AnyOf<global::System.Collections.Generic.IList<global::Jina.AnyOf<global::Jina.TextExampleDoc, global::Jina.ImageExampleDoc>>, global::Jina.TextExampleDoc, global::Jina.ImageExampleDoc> input, | ||
string? model = default, | ||
string? classifierId = default, | ||
global::Jina.TrainingAPIInputVisibility? visibility = global::Jina.TrainingAPIInputVisibility.Public, | ||
global::System.Threading.CancellationToken cancellationToken = default) | ||
{ | ||
var request = new global::Jina.TrainingAPIInput | ||
{ | ||
Model = model, | ||
ClassifierId = classifierId, | ||
Visibility = visibility, | ||
Input = input, | ||
}; | ||
|
||
return await TrainAsync( | ||
request: request, | ||
cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
} | ||
} |
Oops, something went wrong.