类名:BaseLlm
java.lang.Object
com.google.adk.models.BaseLlm
- Direct Known Subclasses:
ApigeeLlm, Claude, Gemini, LangChain4j, SpringAI
用于大型语言模型(LLMs)的抽象基类。
提供了一个通用的接口,用于与不同的大型语言模型(LLMs)进行交互。
-
构造函数概述
Constructors -
方法概述
Modifier and TypeMethodDescription返回该模型支持的功能或操作。abstract BaseLlmConnectionconnect(LlmRequest llmRequest) 创建与大型语言模型(LLM)的实时连接。abstract io.reactivex.rxjava3.core.Flowable<LlmResponse> generateContent(LlmRequest llmRequest, boolean stream) 根据给定的大型语言模型(LLM)请求及相关工具,生成一条内容。model()返回大型语言模型(LLM)的名称。
-
构造函数详细信息
-
BaseLlm
-
-
方法详细信息(Method Details)
-
model
-
generateContent
public abstract io.reactivex.rxjava3.core.Flowable<LlmResponse> generateContent(LlmRequest llmRequest, boolean stream) 根据给定的大型语言模型(LLM)请求及相关工具,生成一条内容。- 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
创建与大型语言模型(LLM)的实时连接。 -
capabilities
返回该模型支持的功能/类型等。默认情况下,……LlmCapabilities.outputSchemaAndTools()当……时,值为 `false`。ModelNameUtils.isGemini2Model(String)接受……model()名称为 “name”;值为 “true”;其他情况下则使用默认值。如果需要,可以覆盖此设置,以显示模型本身支持的功能或属性。
-