Claude

class Claude @JvmOverloads constructor(val name: String, client: AnthropicClient, maxTokens: Int = DEFAULT_MAX_TOKENS, effort: OutputConfig.Effort? = null) : Model

A Model backed by Anthropic's Claude models through the official Anthropic Java SDK.

Supports streaming, tool calling, extended thinking, image and PDF input, structured output, and prompt caching. Thinking needs ThinkingConfig.thinkingBudget and ignores thinkingLevel.

Parameters

client

The Anthropic SDK client that sends the requests; the caller owns and closes it.

maxTokens

The default max_tokens (8192), used when the request config sets none.

effort

How much reasoning effort Claude spends on each request; null leaves the model's default. While effort or thinking is on, temperature, topP, and topK are not sent.

构造函数(Constructors)

Link copied to clipboard
constructor(name: String, client: AnthropicClient, maxTokens: Int = DEFAULT_MAX_TOKENS, effort: OutputConfig.Effort? = null)
constructor(name: String, apiKey: String? = null, maxTokens: Int = DEFAULT_MAX_TOKENS, effort: OutputConfig.Effort? = null)

创建一个 Claude 该模型可以直接调用 Anthropic API。它生成的 SDK 客户端会在模型被垃圾回收(即被销毁)时也随之被关闭;因此,请使用您自己提供的 SDK 客户端。 AnthropicClient 为了更快地完成它(或:为了更快地关闭它)。

constructor(name: String, vertexCredentials: VertexCredentials, maxTokens: Int = DEFAULT_MAX_TOKENS, effort: OutputConfig.Effort? = null)

创建一个 Claude 该模型是通过 Vertex AI 提供的。当模型被垃圾回收(即被系统销毁)时,由该模型生成的 SDK 客户端也会被关闭;因此,请使用您自己提供的客户端来与模型进行交互。 AnthropicClient 为了更快地完成它(或:为了更快地关闭它)。

类型

Link copied to clipboard
class Builder

Fluent Builder for Claude该功能主要为 Java 语言的调用者提供支持;如果某个属性未被设置,其值将默认使用构造函数中指定的默认值。

Link copied to clipboard
object Companion

属性(Properties)

Link copied to clipboard
Link copied to clipboard
open override val name: String

Claude 模型的名称(例如: claude-sonnet-4-5).

函数

Link copied to clipboard
Link copied to clipboard
open override fun generateContent(request: LlmRequest, stream: Boolean): Flow<LlmResponse>