Class BaseLlm

java.lang.Object
com.google.adk.models.BaseLlm
Direct Known Subclasses:
Claude, Gemini

public abstract class BaseLlm extends Object
Abstract base class for Large Language Models (LLMs).

Provides a common interface for interacting with different LLMs.

  • Constructor Details

    • BaseLlm

      public BaseLlm(String model)
  • Method Details

    • model

      public String model()
      Returns the name of the LLM model.
      Returns:
      The name of the LLM model.
    • generateContent

      public abstract io.reactivex.rxjava3.core.Flowable<LlmResponse> generateContent(LlmRequest llmRequest, boolean stream)
      Generates one content from the given LLM request and tools.
      Parameters:
      llmRequest - The LLM request containing the input prompt and parameters.
      stream - A boolean flag indicating whether to stream the response.
      Returns:
      A Flowable of LlmResponses. For non-streaming calls, it will only yield one LlmResponse. For streaming calls, it may yield more than one LlmResponse, but all yielded LlmResponses should be treated as one content by merging their parts.
    • connect

      public abstract BaseLlmConnection connect(LlmRequest llmRequest)
      Creates a live connection to the LLM.