googleai_dart library
Dart Client for the Google AI API (Gemini Pro, Gemini Pro Vision, embeddings, etc.).
Classes
- BatchEmbedContentsRequest
- Batch request to get embeddings from the model for a list of prompts.
- BatchEmbedContentsResponse
-
The response to a
BatchEmbedContentsRequest
. - Blob
- Raw media bytes. Text should not be sent as raw bytes, use the 'text' field.
- CancelOperationRequest
- The request message for Operations.CancelOperation.
- Candidate
- A response candidate generated from the model.
- CitationMetadata
- A collection of source attributions for a piece of content.
- CitationSource
- A citation to a source for a portion of a specific response.
- Content
-
The base structured datatype containing multi-part content of a message. A
Content
includes arole
field designating the producer of theContent
and aparts
field containing multi-part data that contains the content of the message turn. - ContentEmbedding
- A list of floats representing an embedding.
- CountTokensRequest
-
Counts the number of tokens in the
prompt
sent to a model. Models may tokenize text differently, so each model may return a differenttoken_count
. - CountTokensResponse
-
A response from
CountTokens
. It returns the model'stoken_count
for theprompt
. - CreateTunedModelMetadata
- Metadata about the state and progress of creating a tuned model returned from the long-running operation.
- EmbedContentRequest
-
Request containing the
Content
for the model to embed. - EmbedContentResponse
-
The response to an
EmbedContentRequest
. - Empty
- A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
- GenerateContentRequest
- Request to generate a completion from the model.
- GenerateContentResponse
-
Response from the model supporting multiple candidates. Note on safety ratings and content filtering. They are reported for both prompt in
GenerateContentResponse.prompt_feedback
and for each candidate infinish_reason
and insafety_ratings
. The API contract is that: - either all requested candidates are returned or no candidates at all - no candidates are returned only if there was something wrong with the prompt (seeprompt_feedback
) - feedback on each candidate is reported onfinish_reason
andsafety_ratings
. - GenerationConfig
- Configuration options for model generation and outputs. Not all parameters may be configurable for every model.
- GoogleAIClient
- Client for Google AI API (Gemini API).
- ListModelsResponse
-
Response from
ListModel
containing a paginated list of Models. - ListOperationsResponse
- The response message for Operations.ListOperations.
- Model
- Information about a Generative Language Model.
- Operation
- This resource represents a long-running operation that is the result of a network API call.
- Part
-
A datatype containing media that is part of a multi-part
Content
message. APart
consists of data which has an associated datatype. APart
can only contain one of the accepted types inPart.data
. APart
must have a fixed IANA MIME type identifying the type and subtype of the media if theinline_data
field is filled with raw bytes. - PromptFeedback
-
A set of the feedback metadata the prompt specified in
GenerateContentRequest.content
. - SafetyRating
- Safety rating for a piece of content. The safety rating contains the category of harm and the harm probability level in that category for a piece of content. Content is classified for safety across a number of harm categories and the probability of the harm classification is included here.
- SafetySetting
- Safety setting, affecting the safety-blocking behavior. Passing a safety setting for a category changes the allowed proability that content is blocked.
- Status
-
The
Status
type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. EachStatus
message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide. - TuningSnapshot
- Record for a single tuning step.
Enums
- CandidateFinishReason
- Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
- EmbedContentRequestTaskType
-
Optional. Optional task type for which the embeddings will be used. Can only be set for
models/embedding-001
or newer models. - PromptFeedbackBlockReason
- Optional. If set, the prompt was blocked and no candidates are returned. Rephrase your prompt.
- SafetyRatingCategory
- Required. The category for this rating.
- SafetyRatingProbability
- Required. The probability of harm for this content.
- SafetySettingCategory
- Required. The category for this setting.
- SafetySettingThreshold
- Required. Controls the probability threshold at which harm is blocked.
Exceptions / Errors
- GoogleAIClientException
- HTTP exception handler for GoogleAIClient