GenerativeService class final
API for using Large Models that generate multimodal content and have additional capabilities beyond text generation.
Constructors
- GenerativeService({required Client client})
-
Creates a
GenerativeServiceusingclientfor transport. - GenerativeService.fromApiKey([String? apiKey])
-
Creates a
GenerativeServicethat does authentication through an API key.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
batchEmbedContents(
BatchEmbedContentsRequest request) → Future< BatchEmbedContentsResponse> -
Generates multiple embedding vectors from the input
Contentwhich consists of a batch of strings represented asEmbedContentRequestobjects. -
cancelOperation(
CancelOperationRequest request) → Future< void> -
Provides the
Operationsservice functionality in this service. -
close(
) → void - Closes the client and cleans up any resources associated with it.
-
countTokens(
CountTokensRequest request) → Future< CountTokensResponse> -
Runs a model's tokenizer on input
Contentand returns the token count. Refer to the tokens guide to learn more about tokens. -
deleteOperation(
DeleteOperationRequest request) → Future< void> -
Provides the
Operationsservice functionality in this service. -
embedContent(
EmbedContentRequest request) → Future< EmbedContentResponse> -
Generates a text embedding vector from the input
Contentusing the specified Gemini Embedding model. -
generateAnswer(
GenerateAnswerRequest request) → Future< GenerateAnswerResponse> -
Generates a grounded answer from the model given an input
GenerateAnswerRequest. -
generateContent(
GenerateContentRequest request) → Future< GenerateContentResponse> -
Generates a model response given an input
GenerateContentRequest. Refer to the text generation guide for detailed usage information. Input capabilities differ between models, including tuned models. Refer to the model guide and tuning guide for details. -
getOperation<
T extends ProtoMessage, S extends ProtoMessage> (Operation< T, S> request) → Future<Operation< T, S> > -
Provides the
Operationsservice functionality in this service. -
listOperations(
ListOperationsRequest request) → Future< ListOperationsResponse> -
Provides the
Operationsservice functionality in this service. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
streamGenerateContent(
GenerateContentRequest request) → Stream< GenerateContentResponse> -
Generates a streamed
response
from the model given an input
GenerateContentRequest. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited