type/type library

Classes

BlobPart
Represents binary data with an associated MIME type sent to and received from requests.
Candidate
A piece of a response from the model. Contains safety ratings, citation metadata, and an optional finish reason in addition to the content of the response.
CitationMetadata
Provides citation metadata for sourcing of content provided by the model between a given start index and end index.
Content
Represents content sent to and received from the model.
ContentBuilder
Builder class for constructing Content objects.
CountTokensResponse
Represents a response measuring model input.
GenerateContentResponse
Represents a response from the model.
GenerationConfig
Represents configuration parameters used for content generation.
GenerationConfigBuilder
A builder class to construct GenerationConfig objects.
ImagePart
Represents image data sent to and received from requests.
Part
Interface representing data sent to and received from requests.
PromptFeedback
Feedback on the prompt provided in the request.
SafetyRating
Rating for a particular harm category with a provided harm probability.
SafetySetting
A configuration for a BlockThreshold of some HarmCategory allowed and blocked in responses.
TextPart
Represents text or string based data sent to and received from requests.

Enums

BlockReason
Describes why content was blocked.
BlockThreshold
Represents the threshold for some HarmCategory that is allowed and blocked by SafetySettings.
FinishReason
The reason for content finishing.
HarmCategory
Category for a given harm rating.
HarmProbability
Represents the probability that some HarmCategory is applicable in a SafetyRating.

Functions

content({String? role, required dynamic init(ContentBuilder)}) Content
Represents image data sent to and received from requests. Function to construct content sent to and received
from(dynamic cause) GoogleGenerativeAIException
Converts a dynamic to a GoogleGenerativeAIException.
generationConfig(void init(GenerationConfigBuilder)) GenerationConfig
Helper method to construct a GenerationConfig in a DSL-like manner.

Exceptions / Errors

GoogleGenerativeAIException
Parent class for any errors that occur from GenerativeModel.
InvalidStateException
Some form of state occurred that shouldn't have.
PromptBlockedException
A request was blocked for some reason.
ResponseStoppedException
A request was stopped during generation for some reason.
SerializationException
Something went wrong while trying to deserialize a response from the server.
ServerException
The server responded with a non 200 response code.
UnknownException
Catch all case for exceptions not explicitly expected.