Package-level declarations

Types

Link copied to clipboard
@Serializable
data class Blob(val mimeType: String? = null, val displayName: String? = null, val data: ByteArray? = null)

Represents binary data.

Link copied to clipboard

The reason why the prompt was blocked.

Link copied to clipboard
data class Candidate(val content: Content, val finishReason: FinishReason? = null, val finishMessage: String? = null, val citationMetadata: CitationMetadata? = null, val groundingMetadata: GroundingMetadata? = null, val avgLogprobs: Double? = null, val logprobsResult: LogprobsResult? = null)

Represents a possible response from the model.

Link copied to clipboard
@Serializable
data class Citation(val title: String? = null, val uri: String? = null, val startIndex: Int? = null, val endIndex: Int? = null)

Represents a citation to a source.

Link copied to clipboard
@Serializable
data class CitationMetadata(val citationSources: List<Citation> = emptyList())

Metadata about citations associated with the candidate.

Link copied to clipboard
@Serializable
data class Content(val role: String? = null, val parts: List<Part> = emptyList())

Represents the content of a response, including its role and parts.

Link copied to clipboard
@Serializable
data class FileData(val mimeType: String? = null, val displayName: String? = null, val fileUri: String? = null)

Represents file data.

Link copied to clipboard

The reason why the generation finished.

Link copied to clipboard
@Serializable
data class FunctionCall(val name: String = "", val args: Map<String, Any?> = emptyMap(), val id: String? = null, val partialArgs: List<PartialArg>? = null, val willContinue: Boolean? = null)

Represents a function call in a generation response.

Link copied to clipboard
data class FunctionCallingConfig(val allowedFunctionNames: List<String>? = null)

Configuration for how the model uses the provided function declarations.

Link copied to clipboard
data class FunctionDeclaration(val name: String, val description: String, val parameters: Schema? = null)

Represents a function declaration for tool calling.

Link copied to clipboard
@Serializable
data class FunctionResponse(val name: String, val response: Map<String, Any?> = emptyMap(), val id: String? = null)

Represents a function response.

Link copied to clipboard
data class GenerateContentConfig(val tools: List<Tool>? = null, val labels: Map<String, String>? = null, val systemInstruction: Content? = null, val temperature: Float? = null, val topP: Float? = null, val topK: Int? = null, val candidateCount: Int? = null, val maxOutputTokens: Int? = null, val stopSequences: List<String>? = null, val responseMimeType: String? = null, val responseSchema: Schema? = null, val thinkingConfig: ThinkingConfig? = null, val toolConfig: ToolConfig? = null, val safetySettings: List<SafetySetting>? = null, val mediaResolution: MediaResolution? = null, val serviceTier: ServiceTier? = null, val presencePenalty: Float? = null, val frequencyPenalty: Float? = null, val responseLogprobs: Boolean? = null)

Configuration for generating content.

Link copied to clipboard
data class GenerateContentResponse(val candidates: List<Candidate> = emptyList(), val promptFeedback: PromptFeedback? = null, val usageMetadata: UsageMetadata? = null, val modelVersion: String? = null)

Response from the generate content request.

Link copied to clipboard
data class GoogleMaps(val enableWidget: Boolean? = null)

Tool to retrieve knowledge from Google Maps.

Link copied to clipboard
data class GoogleSearch(val excludeDomains: List<String> = emptyList())

Represents a Google Search tool.

Link copied to clipboard
@Serializable
data class GroundingChunk(val web: GroundingChunkWeb? = null, val retrievedContext: GroundingChunkRetrievedContext? = null)

A single cited source chunk that grounds part of the model's response.

Link copied to clipboard
@Serializable
data class GroundingChunkRetrievedContext(val uri: String? = null, val title: String? = null, val text: String? = null)

A grounding chunk sourced from a retrieval (RAG) context.

Link copied to clipboard
@Serializable
data class GroundingChunkWeb(val uri: String? = null, val title: String? = null, val domain: String? = null)

A grounding chunk sourced from the open web.

Link copied to clipboard
@Serializable
data class GroundingMetadata(val imageSearchQueries: List<String> = emptyList(), val groundingChunks: List<GroundingChunk>? = null, val groundingSupports: List<GroundingSupport>? = null, val webSearchQueries: List<String>? = null, val searchEntryPoint: SearchEntryPoint? = null, val retrievalMetadata: RetrievalMetadata? = null)

Metadata returned to client when grounding is enabled.

Link copied to clipboard
@Serializable
data class GroundingSupport(val segment: Segment? = null, val groundingChunkIndices: List<Int>? = null, val confidenceScores: List<Float>? = null)

Maps a Segment of the response to the grounding chunks that support it.

Link copied to clipboard

The probability threshold at or above which content is blocked for a HarmCategory.

Link copied to clipboard

The category of a harm that a SafetySetting applies to.

Link copied to clipboard

Internal constants for LLM requests and responses.

Link copied to clipboard
@Serializable
data class LogprobsResult(val chosenCandidates: List<LogprobsResultCandidate>? = null, val topCandidates: List<LogprobsResultTopCandidates>? = null, val logProbabilitySum: Double? = null)

Detailed log probabilities for the chosen and top candidate tokens.

Link copied to clipboard
@Serializable
data class LogprobsResultCandidate(val token: String? = null, val tokenId: Int? = null, val logProbability: Double? = null)

A single token candidate and its log probability.

Link copied to clipboard
@Serializable
data class LogprobsResultTopCandidates(val candidates: List<LogprobsResultCandidate>? = null)

The top token candidates at a single decoding step.

Link copied to clipboard
@Serializable
enum MediaModality : Enum<MediaModality>

The modality that a token count applies to.

Link copied to clipboard

The resolution used when processing media inputs.

Link copied to clipboard
@Serializable
data class ModalityTokenCount(val modality: MediaModality? = null, val tokenCount: Int? = null)

A breakdown of token usage by modality.

Link copied to clipboard
@Serializable
class Part constructor(val text: String? = null, val inlineData: Blob? = null, val fileData: FileData? = null, val functionCall: FunctionCall? = null, val functionResponse: FunctionResponse? = null, val thought: Boolean? = null, val thoughtSignature: ByteArray? = null, val videoMetadata: VideoMetadata? = null, val partMetadata: Map<String, Any?>? = null, val opaqueData: Any? = null)

A part of a multi-modal prompt or response.

Link copied to clipboard
@Serializable
data class PartialArg(val value: PartialArgValue? = null, val jsonPath: String? = null, val willContinue: Boolean? = null)

Partial argument value of the function call.

Link copied to clipboard
@Serializable
sealed interface PartialArgValue

Represents one of the possible values within a PartialArg.

Link copied to clipboard
data class PromptFeedback(val blockReason: BlockedReason? = null, val blockReasonMessage: String? = null)

Feedback received from the prompt.

Link copied to clipboard
data class Retrieval(val vertexAiSearch: VertexAISearch? = null)

Defines a retrieval tool that model can call to access external knowledge.

Link copied to clipboard
@Serializable
data class RetrievalMetadata(val googleSearchDynamicRetrievalScore: Float? = null)

Metadata about the retrieval step performed for a grounded response.

Link copied to clipboard
object Role

Standard roles for content and events.

Link copied to clipboard
data class SafetySetting(val category: HarmCategory? = null, val threshold: HarmBlockThreshold? = null)

A per-request safety setting controlling the block threshold for a single HarmCategory.

Link copied to clipboard
data class Schema(val type: Type? = null, val properties: Map<String, Schema>? = null, val items: Schema? = null, val required: List<String>? = null, val description: String? = null, val enum: List<String>? = null)

Schema is used to define the format of input/output data.

Link copied to clipboard
@Serializable
data class SearchEntryPoint(val renderedContent: String? = null)

The Google Search entry point used to render search suggestions for grounded responses.

Link copied to clipboard
@Serializable
data class Segment(val startIndex: Int? = null, val endIndex: Int? = null, val partIndex: Int? = null, val text: String? = null)

A contiguous segment of the response content that a GroundingSupport refers to.

Link copied to clipboard

The service tier requested for a generate content request.

Link copied to clipboard
data class ThinkingConfig(val includeThoughts: Boolean? = null, val thinkingBudget: Int? = null, val thinkingLevel: ThinkingLevel? = null)

The thinking features configuration.

Link copied to clipboard

The number of thoughts tokens that the model should generate.

Link copied to clipboard
data class Tool(val functionDeclarations: List<FunctionDeclaration>? = null, val googleSearch: GoogleSearch? = null, val googleMaps: GoogleMaps? = null, val retrieval: Retrieval? = null, val urlContext: UrlContext? = null)

Represents a GenAI tool definition.

Link copied to clipboard
data class ToolConfig(val functionCallingConfig: FunctionCallingConfig? = null)

Configuration shared across all tools provided in a request.

Link copied to clipboard
enum Type : Enum<Type>

The value type of the schema.

Link copied to clipboard

Tool to support URL context retrieval.

Link copied to clipboard
@Serializable
data class UsageMetadata(val promptTokenCount: Int? = null, val candidatesTokenCount: Int? = null, val totalTokenCount: Int? = null, val thoughtsTokenCount: Int? = null, val toolUsePromptTokenCount: Int? = null, val cachedContentTokenCount: Int? = null, val promptTokensDetails: List<ModalityTokenCount>? = null, val candidatesTokensDetails: List<ModalityTokenCount>? = null)

Usage metadata for a generate content request.

Link copied to clipboard
data class VertexAISearch(val dataStoreSpecs: List<VertexAISearchDataStoreSpec>? = null, val datastore: String? = null, val engine: String? = null, val filter: String? = null, val maxResults: Int? = null)

Retrieve from Vertex AI Search datastore or engine for grounding. datastore and engine are mutually exclusive.

Link copied to clipboard
data class VertexAISearchDataStoreSpec(val dataStore: String? = null, val filter: String? = null)

Define data stores within engine to filter on in a search call and configurations for those data stores.

Link copied to clipboard
@Serializable
data class VideoMetadata(val startOffset: <Error class: unknown class>? = null, val endOffset: <Error class: unknown class>? = null, val fps: Double? = null)

Metadata describing how to interpret a video Part.