Class Claude
java.lang.Object
com.google.adk.models.BaseLlm
com.google.adk.models.Claude
Represents the Claude Generative AI model by Anthropic.
Live connections are not supported for Claude.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new Claude instance.Constructs a new Claude instance with a default for the maximum number of tokens to generate. -
Method Summary
Modifier and TypeMethodDescriptionstatic Claude.Builderbuilder()Returns a builder forClaude.ReportsLlmCapabilities.outputSchemaAndTools()as false: this class drops a response schema sent beside function declarations.connect(LlmRequest llmRequest) Creates a live connection to the LLM.io.reactivex.rxjava3.core.Flowable<LlmResponse> generateContent(LlmRequest llmRequest, boolean stream) Generates one content from the given LLM request and tools.
-
Constructor Details
-
Claude
Constructs a new Claude instance. Requests sent throughanthropicClientcarry ADK's usage-tracking headers, added to the ones the client already sends.- 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) Constructs a new Claude instance with a default for the maximum number of tokens to generate.- Parameters:
modelName- The name of the Claude model to use.anthropicClient- The Anthropic API client instance.maxTokens- Themax_tokenssent when the request config sets no maxOutputTokens.
-
-
Method Details
-
builder
Returns a builder forClaude. Use it for options the constructors don't take, such as reasoning effort. -
generateContent
public io.reactivex.rxjava3.core.Flowable<LlmResponse> generateContent(LlmRequest llmRequest, boolean stream) Description copied from class:BaseLlmGenerates one content from the given LLM request and tools.- Specified by:
generateContentin classBaseLlm- 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
Description copied from class:BaseLlmCreates a live connection to the LLM. -
capabilities
ReportsLlmCapabilities.outputSchemaAndTools()as false: this class drops a response schema sent beside function declarations.- Overrides:
capabilitiesin classBaseLlm
-