Gemini class

Gemini Flutter Google Gemini SDK. Google Gemini is a set of cutting-edge large language models (LLMs) designed to be the driving force behind Google's future AI initiatives. implements GeminiInterface and GeminiInterface defines all methods of Gemini

Constructors

Gemini.init({required String apiKey, List<SafetySetting>? safetySettings, GenerationConfig? generationConfig, bool? enableDebugging, String? version})
singleton initialize Gemini.init
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(List<String> texts, {String? modelName, List<SafetySetting>? safetySettings, GenerationConfig? generationConfig}) Future
Embedding is a technique used to represent information as a list of floating point numbers in an array. With Gemini, you can represent text (words, sentences, and blocks of text) in a vectorized form, making it easier to compare and contrast embeddings. For example, two texts that share a similar subject matter or sentiment should have similar embeddings, which can be identified through mathematical comparison techniques such as cosine similarity.
chat(List<Content> chats, {String? modelName, List<SafetySetting>? safetySettings, GenerationConfig? generationConfig}) Future<Candidates?>
chat or Multi-turn conversations Using Gemini, you can build freeform conversations across multiple turns.
countTokens(String text, {String? modelName, List<SafetySetting>? safetySettings, GenerationConfig? generationConfig}) Future<int?>
countTokens When using long prompts, it might be useful to count tokens before sending any content to the model.
embedContents(String text, {String? modelName, List<SafetySetting>? safetySettings, GenerationConfig? generationConfig}) Future
embedContents description in upper comments
info({required String model}) Future<GeminiModel>
info If you GET a model's URL, the API used the get method to return information about that model such as version, display name, input token limit, etc.
listModels() Future<List<GeminiModel>>
listModels If you GET the models directory, it used the list method to list all of the models available through the API, including both the Gemini and PaLM family models.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
streamGenerateContent(String text, {String? modelName, List<SafetySetting>? safetySettings, GenerationConfig? generationConfig}) Future<Stream>
streamGenerateContent By default, the model returns a response after completing the entire generation process. You can achieve faster interactions by not waiting for the entire result, and instead use streaming to handle partial results.
text(String text, {String? modelName, List<SafetySetting>? safetySettings, GenerationConfig? generationConfig}) Future<Candidates?>
text Use the generateContent method to generate a response from the model given an input message. If the input contains only text, use the gemini-pro model.
textAndImage({required String text, required Uint8List image, String? modelName, List<SafetySetting>? safetySettings, GenerationConfig? generationConfig}) Future<Candidates?>
textAndImage If the input contains both text and image, use the gemini-pro-vision model. The following snippets help you build a request and send it to the REST API.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

enableDebugging bool
enableDebugging to see request progress
getter/setter pair
instance Gemini
singleton instance from main Gemini class
getter/setter pair