LlmRequest

data class LlmRequest(val model: Model? = null, val contents: List<Content> = emptyList(), val config: GenerateContentConfig = GenerateContentConfig(), toolsDict: List<BaseTool> = emptyList(), val cacheConfig: ContextCacheConfig? = null, val cacheMetadata: CacheMetadata? = null, val cacheableContentsTokenCount: Int? = null)

LlmRequest represents a request to an LLM.

Constructors

Link copied to clipboard
constructor(model: Model? = null, contents: List<Content> = emptyList(), config: GenerateContentConfig = GenerateContentConfig(), toolsDict: List<BaseTool> = emptyList(), cacheConfig: ContextCacheConfig? = null, cacheMetadata: CacheMetadata? = null, cacheableContentsTokenCount: Int? = null)

Types

Link copied to clipboard
class Builder

Fluent builder for LlmRequest, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor. The internal toolsDict is request-processing state populated by appendTools, not a caller input, so it is not exposed.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Prompt token count from the previous request, used to gate cache creation on a minimum size.

Link copied to clipboard

Context cache configuration for this request. When null, context caching is disabled for the request.

Link copied to clipboard

Cache metadata carried over from previous requests, used to validate and reuse an existing cache.

Link copied to clipboard

The configuration for generating content.

Link copied to clipboard

The contents of the request.

Link copied to clipboard
val model: Model?

The model to use for the request.

Functions

Link copied to clipboard

Appends a content block to the request.

Link copied to clipboard

Appends instructions to the system instruction.

Link copied to clipboard

Appends tools to the request and merges any new function declarations.