类名:SpringAI

java.lang.Object
com.google.adk.models.BaseLlm
com.google.adk.models.springai.SpringAI

public class SpringAI extends BaseLlm
这是基于 Spring AI 的 BaseLlm 实现方案,该方案封装了 Spring AI 的 ChatModel 和 StreamingChatModel。

该适配器允许在 ADK 框架内使用 Spring AI 模型,它负责在 ADK 的 LlmRequest/LlmResponse 格式与 Spring AI 的 Prompt/ChatResponse 格式之间进行转换。

  • 构造函数详细信息

    • SpringAI

      public SpringAI(org.springframework.ai.chat.model.ChatModel chatModel)
    • SpringAI

      public SpringAI(org.springframework.ai.chat.model.ChatModel chatModel, String modelName)
    • SpringAI

      public SpringAI(org.springframework.ai.chat.model.StreamingChatModel streamingChatModel)
    • SpringAI

      public SpringAI(org.springframework.ai.chat.model.StreamingChatModel streamingChatModel, String modelName)
    • SpringAI

      public SpringAI(org.springframework.ai.chat.model.ChatModel chatModel, org.springframework.ai.chat.model.StreamingChatModel streamingChatModel, String modelName)
    • SpringAI

      public SpringAI(org.springframework.ai.chat.model.ChatModel chatModel, org.springframework.ai.chat.model.StreamingChatModel streamingChatModel, String modelName, SpringAIProperties.Observability observabilityConfig)
    • SpringAI

      public SpringAI(org.springframework.ai.chat.model.ChatModel chatModel, String modelName, SpringAIProperties.Observability observabilityConfig)
    • SpringAI

      public SpringAI(org.springframework.ai.chat.model.StreamingChatModel streamingChatModel, String modelName, SpringAIProperties.Observability observabilityConfig)
  • 方法详细信息(Method Details)

    • generateContent

      public io.reactivex.rxjava3.core.Flowable<LlmResponse> generateContent(LlmRequest llmRequest, boolean stream)
      描述内容复制自相关类: BaseLlm
      根据给定的大型语言模型(LLM)请求及相关工具,生成一条内容。
      Specified by:
      generateContent in class BaseLlm
      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 BaseLlmConnection connect(LlmRequest llmRequest)
      描述内容复制自相关类: BaseLlm
      创建与大型语言模型(LLM)的实时连接。
      Specified by:
      connect in class BaseLlm