# Class LlmRequest

java.lang.Object
com.google.adk.JsonBaseModel
com.google.adk.models.LlmRequest

public abstract class LlmRequest extends JsonBaseModel
Represents a request to be sent to the LLM.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `LlmRequest.Builder`
  Builder for constructing `LlmRequest` instances.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LlmRequest()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static LlmRequest.Builder`
  `builder()`
  `abstract Optional<com.google.genai.types.GenerateContentConfig>`
  `config()`
  Returns the configuration for content generation.
  `abstract List<com.google.genai.types.Content>`
  `contents()`
  Returns the list of content sent to the LLM.
  `Optional<String>`
  `getFirstSystemInstruction()`
  returns the first system instruction text from the request if present.
  `com.google.common.collect.ImmutableList<String>`
  `getSystemInstructions()`
  Returns all system instruction texts from the request as an immutable list.
  `abstract com.google.genai.types.LiveConnectConfig`
  `liveConnectConfig()`
  Returns the configuration for live connections.
  `abstract Optional<String>`
  `model()`
  Returns the name of the LLM model to be used.
  `abstract LlmRequest.Builder`
  `toBuilder()`
  `abstract Map<String,BaseTool>`
  `tools()`
  Returns a map of tools available to the LLM.

  ### Methods inherited from class JsonBaseModel

  `fromJsonNode, fromJsonString, getMapper, toJson, toJsonNode, toJsonString`
  Modifier and Type
  Method
  Description
  `static <T extends JsonBaseModel>
  T`
  `fromJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> clazz)`
  Deserializes a JsonNode to an object of the given type.
  `static <T extends JsonBaseModel>
  T`
  `fromJsonString(String jsonString, Class<T> clazz)`
  Deserializes a Json string to an object of the given type.
  `static com.fasterxml.jackson.databind.ObjectMapper`
  `getMapper()`
  Returns the mutable ObjectMapper instance used by ADK.
  `String`
  `toJson()`
  Serializes this object (i.e., the ObjectMappper instance used by ADK) to a Json string.
  `protected static com.fasterxml.jackson.databind.JsonNode`
  `toJsonNode(Object object)`
  Serializes an object to a JsonNode.
  `static String`
  `toJsonString(Object object)`
  Serializes an object to a Json string.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LlmRequest

    public LlmRequest()

- ## Method Details

  - ### model

    public abstract Optional<String> model()
    Returns the name of the LLM model to be used. If not set, the default model of the LLM class will be used.
    Returns:
      An optional string representing the model name.

  - ### contents

    public abstract List<com.google.genai.types.Content> contents()
    Returns the list of content sent to the LLM.
    Returns:
      A list of `Content` objects.

  - ### config

    public abstract Optional<com.google.genai.types.GenerateContentConfig> config()
    Returns the configuration for content generation.
    Returns:
      An optional `GenerateContentConfig` object containing the generation settings.

  - ### liveConnectConfig

    public abstract com.google.genai.types.LiveConnectConfig liveConnectConfig()
    Returns the configuration for live connections. Populated using the RunConfig in the InvocationContext.
    Returns:
      An optional `LiveConnectConfig` object containing the live connection settings.

  - ### tools

    public abstract Map<String,BaseTool> tools()
    Returns a map of tools available to the LLM.
    Returns:
      A map where keys are tool names and values are `BaseTool` instances.

  - ### getFirstSystemInstruction

    public Optional<String> getFirstSystemInstruction()
    returns the first system instruction text from the request if present.

  - ### getSystemInstructions

    public com.google.common.collect.ImmutableList<String> getSystemInstructions()
    Returns all system instruction texts from the request as an immutable list.

  - ### builder

    public static LlmRequest.Builder builder()

  - ### toBuilder

    public abstract LlmRequest.Builder toBuilder()