Class AbstractSharedBedrockChatModel
java.lang.Object
dev.langchain4j.model.bedrock.internal.AbstractSharedBedrockChatModel
- Direct Known Subclasses:
AbstractBedrockChatModel
,AbstractBedrockStreamingChatModel
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected static final String
protected final String
protected final software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
protected static final String
protected static final String
protected final String
protected final List
<ChatModelListener> protected final Integer
protected final int
protected final software.amazon.awssdk.regions.Region
protected final String[]
protected final double
protected final Duration
protected final int
protected final float
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
chatMessageToString
(ChatMessage message) Convert chat message to stringprotected String
convertMessagesToAwsBody
(List<ChatMessage> messages) protected ChatModelRequest
createModelListenerRequest
(software.amazon.awssdk.services.bedrockruntime.model.InvokeModelRequest invokeModelRequest, List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) protected ChatModelRequest
createModelListenerRequest
(software.amazon.awssdk.services.bedrockruntime.model.InvokeModelWithResponseStreamRequest invokeModelRequest, List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) protected ChatModelResponse
createModelListenerResponse
(String responseId, String responseModel, Response<AiMessage> response) protected abstract String
Get model idgetRequestParameters
(String prompt) protected void
listenerErrorResponse
(Throwable e, ChatModelRequest modelListenerRequest, Map<Object, Object> attributes)
-
Field Details
-
HUMAN_PROMPT
- See Also:
-
ASSISTANT_PROMPT
- See Also:
-
DEFAULT_ANTHROPIC_VERSION
- See Also:
-
humanPrompt
- See Also:
-
assistantPrompt
- See Also:
-
maxRetries
-
region
protected final software.amazon.awssdk.regions.Region region -
credentialsProvider
protected final software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider -
maxTokens
protected final int maxTokens- See Also:
-
temperature
protected final double temperature- See Also:
-
topP
protected final float topP- See Also:
-
stopSequences
-
topK
protected final int topK- See Also:
-
timeout
-
anthropicVersion
- See Also:
-
listeners
-
-
Constructor Details
-
AbstractSharedBedrockChatModel
public AbstractSharedBedrockChatModel()
-
-
Method Details
-
chatMessageToString
Convert chat message to string- Parameters:
message
- chat message- Returns:
- string
-
convertMessagesToAwsBody
-
getRequestParameters
-
listenerErrorResponse
protected void listenerErrorResponse(Throwable e, ChatModelRequest modelListenerRequest, Map<Object, Object> attributes) -
createModelListenerRequest
protected ChatModelRequest createModelListenerRequest(software.amazon.awssdk.services.bedrockruntime.model.InvokeModelRequest invokeModelRequest, List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) -
createModelListenerRequest
protected ChatModelRequest createModelListenerRequest(software.amazon.awssdk.services.bedrockruntime.model.InvokeModelWithResponseStreamRequest invokeModelRequest, List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) -
createModelListenerResponse
protected ChatModelResponse createModelListenerResponse(String responseId, String responseModel, Response<AiMessage> response) -
getModelId
Get model id- Returns:
- model id
-