AnthropicLLMClient

open class AnthropicLLMClient(apiKey: String, settings: AnthropicClientSettings = AnthropicClientSettings(), baseClient: HttpClient = HttpClient()) : LLMClient(source)

A client implementation for interacting with Anthropic's API in a suspendable and direct manner.

This class supports functionalities for executing text prompts and streaming interactions with the Anthropic API. It leverages Kotlin Coroutines to handle asynchronous operations and provides full support for configuring HTTP requests, including timeout handling and JSON serialization.

Parameters

apiKey

The API key required to authenticate with the Anthropic service.

settings

Configurable settings for the Anthropic client, which include the base URL and other options.

baseClient

An optional custom configuration for the underlying HTTP client, defaulting to a Ktor client.

Constructors

Link copied to clipboard
constructor(apiKey: String, settings: AnthropicClientSettings = AnthropicClientSettings(), baseClient: HttpClient = HttpClient())

Creates an instance of the AnthropicSuspendableDirectClient.

Functions

Link copied to clipboard
open suspend override fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<Message.Response>
Link copied to clipboard
open suspend override fun executeStreaming(prompt: Prompt, model: LLModel): Flow<String>