Class AbstractBedrockChatModel<T extends BedrockChatModelResponse>
java.lang.Object
dev.langchain4j.model.bedrock.internal.AbstractSharedBedrockChatModel
dev.langchain4j.model.bedrock.internal.AbstractBedrockChatModel<T>
- All Implemented Interfaces:
ChatLanguageModel
- Direct Known Subclasses:
BedrockAI21LabsChatModel
,BedrockAnthropicCompletionChatModel
,BedrockAnthropicMessageChatModel
,BedrockCohereChatModel
,BedrockLlamaChatModel
,BedrockMistralAiChatModel
,BedrockStabilityAIChatModel
,BedrockTitanChatModel
public abstract class AbstractBedrockChatModel<T extends BedrockChatModelResponse>
extends AbstractSharedBedrockChatModel
implements ChatLanguageModel
Bedrock chat model
-
Field Summary
Fields inherited from class dev.langchain4j.model.bedrock.internal.AbstractSharedBedrockChatModel
anthropicVersion, ASSISTANT_PROMPT, assistantPrompt, credentialsProvider, DEFAULT_ANTHROPIC_VERSION, HUMAN_PROMPT, humanPrompt, maxRetries, maxTokens, region, stopSequences, temperature, topK, topP
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate
(List<ChatMessage> messages) Generates a response from the model based on a sequence of messages.getRequestParameters
(String prompt) Get request parametersGet response class typeprotected software.amazon.awssdk.services.bedrockruntime.model.InvokeModelResponse
Invoke call to the APICreate map with single entryMethods inherited from class dev.langchain4j.model.bedrock.internal.AbstractSharedBedrockChatModel
chatMessageToString, convertMessagesToAwsBody, getModelId
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.langchain4j.model.chat.ChatLanguageModel
chat, generate, generate, generate, generate, supportedCapabilities
-
Constructor Details
-
AbstractBedrockChatModel
public AbstractBedrockChatModel()
-
-
Method Details
-
generate
Description copied from interface:ChatLanguageModel
Generates a response from the model based on a sequence of messages. Typically, the sequence contains messages in the following order: System (optional) - User - AI - User - AI - User ...- Specified by:
generate
in interfaceChatLanguageModel
- Parameters:
messages
- A list of messages.- Returns:
- The response generated by the model.
-
getRequestParameters
Get request parameters- Overrides:
getRequestParameters
in classAbstractSharedBedrockChatModel
- Parameters:
prompt
- prompt- Returns:
- request body
-
getResponseClassType
Get response class type- Returns:
- response class type
-
invoke
protected software.amazon.awssdk.services.bedrockruntime.model.InvokeModelResponse invoke(String body) Invoke call to the API- Parameters:
body
- body- Returns:
- invoke model response
-
of
Create map with single entry- Parameters:
key
- keyvalue
- value- Returns:
- map
-