Class TitanChatBedrockApi
java.lang.Object
org.springframework.ai.bedrock.api.AbstractBedrockApi<TitanChatBedrockApi.TitanChatRequest,TitanChatBedrockApi.TitanChatResponse,TitanChatBedrockApi.TitanChatResponseChunk>
org.springframework.ai.bedrock.titan.api.TitanChatBedrockApi
public class TitanChatBedrockApi
extends AbstractBedrockApi<TitanChatBedrockApi.TitanChatRequest,TitanChatBedrockApi.TitanChatResponse,TitanChatBedrockApi.TitanChatResponseChunk>
Java client for the Bedrock Titan chat model.
https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-titan-text.html
https://docs.aws.amazon.com/bedrock/latest/userguide/titan-text-models.html
- Since:
- 0.8.0
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Titan models version.static final record
TitanChatRequest encapsulates the request parameters for the Titan chat model.static final record
TitanChatResponse encapsulates the response parameters for the Titan chat model.static final record
Titan chat model streaming response.Nested classes/interfaces inherited from class org.springframework.ai.bedrock.api.AbstractBedrockApi
AbstractBedrockApi.AmazonBedrockInvocationMetrics
-
Constructor Summary
ConstructorsConstructorDescriptionTitanChatBedrockApi
(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a new TitanChatBedrockApi instance using the provided credentials provider, region and object mapper. -
Method Summary
Modifier and TypeMethodDescriptionChat completion invocation.reactor.core.publisher.Flux
<TitanChatBedrockApi.TitanChatResponseChunk> Chat completion invocation with streaming response.Methods inherited from class org.springframework.ai.bedrock.api.AbstractBedrockApi
embedding, getModelId, getRegion, internalInvocation, internalInvocationStream
-
Constructor Details
-
TitanChatBedrockApi
public TitanChatBedrockApi(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a new TitanChatBedrockApi instance using the provided credentials provider, region and object mapper.- Parameters:
modelId
- The model id to use. See theTitanChatBedrockApi.TitanChatModel
for the supported models.credentialsProvider
- The credentials provider to connect to AWS.region
- The AWS region to use.objectMapper
- The object mapper to use for JSON serialization and deserialization.
-
-
Method Details
-
chatCompletion
public TitanChatBedrockApi.TitanChatResponse chatCompletion(TitanChatBedrockApi.TitanChatRequest request) Description copied from class:AbstractBedrockApi
Chat completion invocation.- Overrides:
chatCompletion
in classAbstractBedrockApi<TitanChatBedrockApi.TitanChatRequest,
TitanChatBedrockApi.TitanChatResponse, TitanChatBedrockApi.TitanChatResponseChunk> - Parameters:
request
- The chat completion request.- Returns:
- The chat completion response.
-
chatCompletionStream
public reactor.core.publisher.Flux<TitanChatBedrockApi.TitanChatResponseChunk> chatCompletionStream(TitanChatBedrockApi.TitanChatRequest request) Description copied from class:AbstractBedrockApi
Chat completion invocation with streaming response.- Overrides:
chatCompletionStream
in classAbstractBedrockApi<TitanChatBedrockApi.TitanChatRequest,
TitanChatBedrockApi.TitanChatResponse, TitanChatBedrockApi.TitanChatResponseChunk> - Parameters:
request
- The chat completion request.- Returns:
- The chat completion response stream.
-