Class Llama2ChatBedrockApi
java.lang.Object
org.springframework.ai.bedrock.api.AbstractBedrockApi<Llama2ChatBedrockApi.Llama2ChatRequest,Llama2ChatBedrockApi.Llama2ChatResponse,Llama2ChatBedrockApi.Llama2ChatResponse>
org.springframework.ai.bedrock.llama2.api.Llama2ChatBedrockApi
public class Llama2ChatBedrockApi
extends AbstractBedrockApi<Llama2ChatBedrockApi.Llama2ChatRequest,Llama2ChatBedrockApi.Llama2ChatResponse,Llama2ChatBedrockApi.Llama2ChatResponse>
Java client for the Bedrock Llama2 chat model.
https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-meta.html
- Since:
- 0.8.0
- Author:
- Christian Tzolov
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Llama2 models version.static final record
Llama2ChatRequest encapsulates the request parameters for the Meta Llama2 chat model.static final record
Llama2ChatResponse encapsulates the response parameters for the Meta Llama2 chat model.Nested classes/interfaces inherited from class org.springframework.ai.bedrock.api.AbstractBedrockApi
AbstractBedrockApi.AmazonBedrockInvocationMetrics
-
Constructor Summary
ConstructorDescriptionLlama2ChatBedrockApi
(String modelId, String region) Create a new Llama2ChatBedrockApi instance using the default credentials provider chain, the default object mapper, default temperature and topP values.Llama2ChatBedrockApi
(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a new Llama2ChatBedrockApi instance using the provided credentials provider, region and object mapper. -
Method Summary
Modifier and TypeMethodDescriptionChat completion invocation.reactor.core.publisher.Flux<Llama2ChatBedrockApi.Llama2ChatResponse>
Chat completion invocation with streaming response.Methods inherited from class org.springframework.ai.bedrock.api.AbstractBedrockApi
embedding, getModelId, getRegion, internalInvocation, internalInvocationStream
-
Constructor Details
-
Llama2ChatBedrockApi
Create a new Llama2ChatBedrockApi instance using the default credentials provider chain, the default object mapper, default temperature and topP values.- Parameters:
modelId
- The model id to use. See theLlama2ChatBedrockApi.Llama2ChatModel
for the supported models.region
- The AWS region to use.
-
Llama2ChatBedrockApi
public Llama2ChatBedrockApi(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a new Llama2ChatBedrockApi instance using the provided credentials provider, region and object mapper.- Parameters:
modelId
- The model id to use. See theLlama2ChatBedrockApi.Llama2ChatModel
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 Llama2ChatBedrockApi.Llama2ChatResponse chatCompletion(Llama2ChatBedrockApi.Llama2ChatRequest request) Description copied from class:AbstractBedrockApi
Chat completion invocation.- Overrides:
chatCompletion
in classAbstractBedrockApi<Llama2ChatBedrockApi.Llama2ChatRequest,
Llama2ChatBedrockApi.Llama2ChatResponse, Llama2ChatBedrockApi.Llama2ChatResponse> - Parameters:
request
- The chat completion request.- Returns:
- The chat completion response.
-
chatCompletionStream
public reactor.core.publisher.Flux<Llama2ChatBedrockApi.Llama2ChatResponse> chatCompletionStream(Llama2ChatBedrockApi.Llama2ChatRequest request) Description copied from class:AbstractBedrockApi
Chat completion invocation with streaming response.- Overrides:
chatCompletionStream
in classAbstractBedrockApi<Llama2ChatBedrockApi.Llama2ChatRequest,
Llama2ChatBedrockApi.Llama2ChatResponse, Llama2ChatBedrockApi.Llama2ChatResponse> - Parameters:
request
- The chat completion request.- Returns:
- The chat completion response stream.
-