Class AnthropicClient
java.lang.Object
dev.langchain4j.model.anthropic.internal.client.AnthropicClient
- Direct Known Subclasses:
DefaultAnthropicClient
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAnthropicClient.Builder<T extends AnthropicClient, B extends AnthropicClient.Builder<T,B>> Builder class for constructingAnthropicClientinstances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AnthropicClient.Builderbuilder()cancelBatch(String batchId) countTokens(AnthropicCountTokensRequest request) createBatch(AnthropicCreateBatchRequest request) abstract AnthropicCreateMessageResponsevoidcreateMessage(AnthropicCreateMessageRequest request, AnthropicCreateMessageOptions options, StreamingChatResponseHandler handler) abstract voidcreateMessage(AnthropicCreateMessageRequest request, StreamingChatResponseHandler handler) createMessagePublisher(AnthropicCreateMessageRequest request, AnthropicCreateMessageOptions options, int bufferSize) Non-blocking reactive streaming counterpart ofcreateMessage(AnthropicCreateMessageRequest, AnthropicCreateMessageOptions, StreamingChatResponseHandler): returns aPublisherofChatModelStreamingEvents driven byhttpClient.stream(...)(nothing parked on socket reads);bufferSizebounds the back-pressure buffer, and cancelling the subscription aborts the in-flight HTTP request.Non-blocking counterpart ofcreateMessageWithRawResponse(AnthropicCreateMessageRequest): sends the request without holding a thread while the response is in flight.listBatches(Integer limit, String afterId) retrieveBatch(String batchId) retrieveBatchResults(String batchId)
-
Constructor Details
-
AnthropicClient
public AnthropicClient()
-
-
Method Details
-
createMessage
-
createMessageWithRawResponse
-
createMessageWithRawResponseAsync
public CompletableFuture<ParsedAndRawResponse> createMessageWithRawResponseAsync(AnthropicCreateMessageRequest request) Non-blocking counterpart ofcreateMessageWithRawResponse(AnthropicCreateMessageRequest): sends the request without holding a thread while the response is in flight. The default returns a failed future carryingAsyncNotSupportedExceptionto signal that this client has no native asynchronous path.- Since:
- 1.20.0
-
createMessage
public void createMessage(AnthropicCreateMessageRequest request, AnthropicCreateMessageOptions options, StreamingChatResponseHandler handler) - Since:
- 1.2.0
-
createMessage
public abstract void createMessage(AnthropicCreateMessageRequest request, StreamingChatResponseHandler handler) -
createMessagePublisher
public Flow.Publisher<ChatModelStreamingEvent> createMessagePublisher(AnthropicCreateMessageRequest request, AnthropicCreateMessageOptions options, int bufferSize) Non-blocking reactive streaming counterpart ofcreateMessage(AnthropicCreateMessageRequest, AnthropicCreateMessageOptions, StreamingChatResponseHandler): returns aPublisherofChatModelStreamingEvents driven byhttpClient.stream(...)(nothing parked on socket reads);bufferSizebounds the back-pressure buffer, and cancelling the subscription aborts the in-flight HTTP request. The default returns a failingPublishercarryingAsyncNotSupportedException.- Since:
- 1.20.0
-
countTokens
-
listModels
-
createBatch
-
retrieveBatch
-
retrieveBatchResults
-
cancelBatch
-
listBatches
-
builder
-