Skip to content

Commit

Permalink
docs: add client documentation (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Jan 26, 2025
1 parent c01c605 commit 6cc5c01
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
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

0 comments on commit 6cc5c01

Please sign in to comment.