Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add client documentation #88

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ import com.anthropic.services.blocking.CompletionService
import com.anthropic.services.blocking.MessageService
import com.anthropic.services.blocking.ModelService

/**
* A client for interacting with the Anthropic REST API synchronously. You can also switch to
* asynchronous execution via the [async] method.
*
* This client performs best when you create a single instance and reuse it for all interactions
* with the REST API. This is because each client holds its own connection pool and thread pools.
* Reusing connections and threads reduces latency and saves memory. The client also handles rate
* limiting per client. This means that creating and using multiple instances at the same time will
* not respect rate limits.
*
* The threads and connections that are held will be released automatically if they remain idle. But
* if you are writing an application that needs to aggressively release unused resources, then you
* may call [close].
*/
interface AnthropicClient {

fun async(): AnthropicClientAsync
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ import com.anthropic.services.async.CompletionServiceAsync
import com.anthropic.services.async.MessageServiceAsync
import com.anthropic.services.async.ModelServiceAsync

/**
* A client for interacting with the Anthropic REST API asynchronously. You can also switch to
* synchronous execution via the [sync] method.
*
* This client performs best when you create a single instance and reuse it for all interactions
* with the REST API. This is because each client holds its own connection pool and thread pools.
* Reusing connections and threads reduces latency and saves memory. The client also handles rate
* limiting per client. This means that creating and using multiple instances at the same time will
* not respect rate limits.
*
* The threads and connections that are held will be released automatically if they remain idle. But
* if you are writing an application that needs to aggressively release unused resources, then you
* may call [close].
*/
interface AnthropicClientAsync {

fun sync(): AnthropicClient
Expand Down