类 Claude

java.lang.Object
com.google.adk.models.BaseLlm
com.google.adk.models.Claude

public class Claude extends BaseLlm
代表 Anthropic 公司开发的 Claude 生成式 AI 模型。

Claude 不支持实时连接(live connections)。

  • 嵌套类概述

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    “Builder for”是一个用于描述某种构建工具或框架的术语。它通常表示该工具/框架用于帮助开发者或系统管理员快速、高效地创建或构建特定类型的应用程序、系统或组件。例如:“Builder for Web Applications”(用于构建Web应用程序的工具)或“Builder for Cloud Services”(用于构建云服务的工具)。 Claude.
  • 构造函数概述

    Constructors
    Constructor
    Description
    Claude(String modelName, com.anthropic.client.AnthropicClient anthropicClient)
    创建一个新的 Claude 实例。
    Claude(String modelName, com.anthropic.client.AnthropicClient anthropicClient, int maxTokens)
    创建一个新的 Claude 实例,该实例使用默认值来设置可生成的最大令牌数量。
  • 方法概述

    Modifier and Type
    Method
    Description
    返回一个用于构建某种对象的构建器(builder)。 Claude.
    报告 LlmCapabilities.outputSchemaAndTools() 当 `as false` 时:该类不会返回任何响应(即不会发送任何数据)。 模式(schema)会与函数声明一起被发送出去。
    connect(LlmRequest llmRequest)
    创建与大型语言模型(LLM)的实时连接。
    io.reactivex.rxjava3.core.Flowable<LlmResponse>
    generateContent(LlmRequest llmRequest, boolean stream)
    根据给定的大型语言模型(LLM)请求及相关工具,生成一条内容。

    Methods inherited from class BaseLlm

    model
    Modifier and Type
    Method
    Description
    返回大型语言模型(LLM)的名称。

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造函数详细信息

    • Claude

      public Claude(String modelName, com.anthropic.client.AnthropicClient anthropicClient)
      用于创建一个新的 Claude 实例。通过该实例发送的所有请求都会被处理。 anthropicClient 这些头部信息用于追踪应用程序的使用情况,会被添加到客户端已经发送的数据中。
      Parameters:
      modelName - The name of the Claude model to use (e.g., "claude-3-opus-20240229").
      anthropicClient - The Anthropic API client instance.
    • Claude

      public Claude(String modelName, com.anthropic.client.AnthropicClient anthropicClient, int maxTokens)
      创建一个新的 Claude 实例,该实例使用默认值来设置可生成的最大令牌数量。
      Parameters:
      modelName - The name of the Claude model to use.
      anthropicClient - The Anthropic API client instance.
      maxTokens - The max_tokens sent when the request config sets no maxOutputTokens.
  • 方法详细信息(Method Details)

    • builder

      public static Claude.Builder builder()
      返回一个用于构建某种对象的构建器(builder)。 Claude将其用于构造函数未提供的参数(例如 “reasoning effort”)。
    • 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
    • capabilities

      public LlmCapabilities capabilities()
      报告 LlmCapabilities.outputSchemaAndTools() 当 `as false` 时:该类不会返回任何响应(即不会发送任何数据)。 模式(schema)会与函数声明一起被发送出去。
      Overrides:
      capabilities in class BaseLlm