类名:BaseLlm

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

public abstract class BaseLlm extends Object
用于大型语言模型(LLMs)的抽象基类。

提供了一个通用的接口,用于与不同的大型语言模型(LLMs)进行交互。

  • 构造函数详细信息

    • BaseLlm

      public BaseLlm(String model)
  • 方法详细信息(Method Details)

    • model

      public String model()
      返回大型语言模型(LLM)的名称。
      Returns:
      The name of the LLM 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

      public abstract BaseLlmConnection connect(LlmRequest llmRequest)
      创建与大型语言模型(LLM)的实时连接。
    • capabilities

      public LlmCapabilities capabilities()
      返回该模型支持的功能/类型等。默认情况下,…… LlmCapabilities.outputSchemaAndTools() 当……时,值为 `false`。 ModelNameUtils.isGemini2Model(String) 接受…… model() 名称为 “name”;值为 “true”;其他情况下则使用默认值。如果需要,可以覆盖此设置,以显示模型本身支持的功能或属性。