GenerativeModel class final
A multimodel generative model (like Gemini).
Allows generating content, creating embeddings, and counting the number of tokens in a piece of content.
- Available Extensions
Constructors
-
GenerativeModel({required String model, required String apiKey, List<
SafetySetting> safetySettings = const [], GenerationConfig? generationConfig, List<Tool> ? tools, Client? httpClient, RequestOptions? requestOptions, Content? systemInstruction, ToolConfig? toolConfig}) -
Create a GenerativeModel backed by the generative model named
model
.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(
Iterable< EmbedContentRequest> requests) → Future<BatchEmbedContentsResponse> -
Creates embeddings (list of float values) representing each content in
requests
. -
countTokens(
Iterable< Content> contents, {List<SafetySetting> ? safetySettings, GenerationConfig? generationConfig, List<Tool> ? tools, ToolConfig? toolConfig}) → Future<CountTokensResponse> -
Counts the total number of tokens in
contents
. -
embedContent(
Content content, {TaskType? taskType, String? title, int? outputDimensionality}) → Future< EmbedContentResponse> -
Creates an embedding (list of float values) representing
content
. -
generateContent(
Iterable< Content> prompt, {List<SafetySetting> ? safetySettings, GenerationConfig? generationConfig, List<Tool> ? tools, ToolConfig? toolConfig}) → Future<GenerateContentResponse> -
Generates content responding to
prompt
. -
generateContentStream(
Iterable< Content> prompt, {List<SafetySetting> ? safetySettings, GenerationConfig? generationConfig, List<Tool> ? tools, ToolConfig? toolConfig}) → Stream<GenerateContentResponse> -
Generates a stream of content responding to
prompt
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited