Class BaseLlm
java.lang.Object
com.google.adk.models.BaseLlm
- Direct Known Subclasses:
ApigeeLlm, Claude, Gemini, LangChain4j, SpringAI
Abstract base class for Large Language Models (LLMs).
Provides a common interface for interacting with different LLMs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns what this model supports.abstract BaseLlmConnectionconnect(LlmRequest llmRequest) Creates a live connection to the LLM.abstract io.reactivex.rxjava3.core.Flowable<LlmResponse> generateContent(LlmRequest llmRequest, boolean stream) Generates one content from the given LLM request and tools.model()Returns the name of the LLM model.
-
Constructor Details
-
BaseLlm
-
-
Method Details
-
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
Creates a live connection to the LLM. -
capabilities
Returns what this model supports. By default,LlmCapabilities.outputSchemaAndTools()is false whenModelNameUtils.isGemini2Model(String)accepts themodel()name and true otherwise. Override it to report what the model itself supports.
-