Class GeminiTokenCountRequest
- Namespace
- Uralstech.UGemini.Models.CountTokens
Request to count tokens in given content.
public class GeminiTokenCountRequest : IGeminiPostRequest, IGeminiRequest
- Inheritance
-
GeminiTokenCountRequest
- Implements
- Extension Methods
Constructors
GeminiTokenCountRequest(GeminiModelId, bool)
Creates a new GeminiTokenCountRequest.
public GeminiTokenCountRequest(GeminiModelId model, bool useBetaApi = false)
Parameters
model
GeminiModelIdThe model to use.
useBetaApi
boolShould the request use the Beta API?
Fields
ApiVersion
The API version to use.
public string ApiVersion
Field Value
CompleteRequest
The overall input given to the model. CountTokens will count prompt, function calling, etc.
public GeminiChatRequest CompleteRequest
Field Value
Contents
The input given to the model as a prompt. This field is ignored when CompleteRequest is set.
public GeminiContent[] Contents
Field Value
Model
The model to use.
public GeminiModelId Model
Field Value
Properties
AuthMethod
The preferred authentication method.
public GeminiAuthMethod AuthMethod { get; set; }
Property Value
ContentType
The MIME type of the request content.
public string ContentType { get; }
Property Value
OAuthAccessToken
The OAuth access token to authenticate the request, if using OAuthAccessToken as AuthMethod.
public string OAuthAccessToken { get; set; }
Property Value
Methods
GetEndpointUri(GeminiRequestMetadata)
Gets the URI to the API endpoint.
public string GetEndpointUri(GeminiRequestMetadata metadata)
Parameters
metadata
GeminiRequestMetadataThe metadata of the request to be carried out on the URI.
Returns
- string
The URI.
GetUtf8EncodedData()
Converts the request object to a UTF-8 encoded string.
public string GetUtf8EncodedData()
Returns
- string
The string data.