Interface MessageServiceAsync
-
- All Implemented Interfaces:
public interface MessageServiceAsync
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceMessageServiceAsync.WithRawResponseA view of MessageServiceAsync that provides access to raw HTTP responses for each method.
-
Method Summary
Modifier and Type Method Description abstract MessageServiceAsync.WithRawResponsewithRawResponse()Returns a view of this service that provides access to raw HTTP responses for each method. abstract MessageServiceAsyncwithOptions(Consumer<ClientOptions.Builder> modifier)Returns a view of this service with the given option modifications applied. abstract BatchServiceAsyncbatches()CompletableFuture<Message>create(MessageCreateParams params)Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. abstract CompletableFuture<Message>create(MessageCreateParams params, RequestOptions requestOptions)<T extends Any> CompletableFuture<StructuredMessage<T>>create(StructuredMessageCreateParams<T> params)Creates a model response for the given message parameters. <T extends Any> CompletableFuture<StructuredMessage<T>>create(StructuredMessageCreateParams<T> params, RequestOptions requestOptions)Creates a model response for the given message parameters. AsyncStreamResponse<RawMessageStreamEvent>createStreaming(MessageCreateParams params)Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. abstract AsyncStreamResponse<RawMessageStreamEvent>createStreaming(MessageCreateParams params, RequestOptions requestOptions)AsyncStreamResponse<RawMessageStreamEvent>createStreaming(StructuredMessageCreateParams<?> params)Creates a streaming model response for the given message. AsyncStreamResponse<RawMessageStreamEvent>createStreaming(StructuredMessageCreateParams<?> params, RequestOptions requestOptions)CompletableFuture<MessageTokensCount>countTokens(MessageCountTokensParams params)Count the number of tokens in a Message. abstract CompletableFuture<MessageTokensCount>countTokens(MessageCountTokensParams params, RequestOptions requestOptions)-
-
Method Detail
-
withRawResponse
abstract MessageServiceAsync.WithRawResponse withRawResponse()
Returns a view of this service that provides access to raw HTTP responses for each method.
-
withOptions
abstract MessageServiceAsync withOptions(Consumer<ClientOptions.Builder> modifier)
Returns a view of this service with the given option modifications applied.
The original service is not modified.
-
batches
abstract BatchServiceAsync batches()
-
create
CompletableFuture<Message> create(MessageCreateParams params)
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
The Messages API can be used for either single queries or stateless multi-turn conversations.
Learn more about the Messages API in our user guide
-
create
abstract CompletableFuture<Message> create(MessageCreateParams params, RequestOptions requestOptions)
-
create
<T extends Any> CompletableFuture<StructuredMessage<T>> create(StructuredMessageCreateParams<T> params)
Creates a model response for the given message parameters. The model's structured output in JSON form will be deserialized automatically into an instance of the class
T. See the SDK documentation for more details.
-
create
<T extends Any> CompletableFuture<StructuredMessage<T>> create(StructuredMessageCreateParams<T> params, RequestOptions requestOptions)
Creates a model response for the given message parameters. The model's structured output in JSON form will be deserialized automatically into an instance of the class
T. See the SDK documentation for more details.
-
createStreaming
AsyncStreamResponse<RawMessageStreamEvent> createStreaming(MessageCreateParams params)
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
The Messages API can be used for either single queries or stateless multi-turn conversations.
Learn more about the Messages API in our user guide
-
createStreaming
abstract AsyncStreamResponse<RawMessageStreamEvent> createStreaming(MessageCreateParams params, RequestOptions requestOptions)
-
createStreaming
AsyncStreamResponse<RawMessageStreamEvent> createStreaming(StructuredMessageCreateParams<?> params)
Creates a streaming model response for the given message. The message parameters can define a JSON schema derived automatically from an arbitrary class to request a structured output in JSON form. However, that structured output is split over multiple streamed events, so it will not be deserialized automatically into an instance of that class. To deserialize the output, first use a helper class to accumulate the stream of events into a single output value. See the SDK documentation for full details.
-
createStreaming
AsyncStreamResponse<RawMessageStreamEvent> createStreaming(StructuredMessageCreateParams<?> params, RequestOptions requestOptions)
-
countTokens
CompletableFuture<MessageTokensCount> countTokens(MessageCountTokensParams params)
Count the number of tokens in a Message.
The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it.
Learn more about token counting in our user guide
-
countTokens
abstract CompletableFuture<MessageTokensCount> countTokens(MessageCountTokensParams params, RequestOptions requestOptions)
-
-
-
-