Class AbstractBedrockChatModel<T extends BedrockChatModelResponse>
java.lang.Object
dev.langchain4j.model.bedrock.internal.AbstractBedrockChatModel<T>
- All Implemented Interfaces:
dev.langchain4j.model.chat.ChatLanguageModel
- Direct Known Subclasses:
BedrockAI21LabsChatModel,BedrockAnthropicCompletionChatModel,BedrockAnthropicMessageChatModel,BedrockCohereChatModel,BedrockLlamaChatModel,BedrockMistralAiChatModel,BedrockStabilityAIChatModel,BedrockTitanChatModel
public abstract class AbstractBedrockChatModel<T extends BedrockChatModelResponse>
extends Object
implements dev.langchain4j.model.chat.ChatLanguageModel
Bedrock chat model
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringchatMessageToString(dev.langchain4j.data.message.ChatMessage message) Convert chat message to stringdev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage> protected abstract StringGet model idgetRequestParameters(String prompt) Get request parametersGet response class typeprotected software.amazon.awssdk.services.bedrockruntime.model.InvokeModelResponseInvoke call to the APICreate map with single entryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.model.chat.ChatLanguageModel
generate, generate, generate, generate
-
Constructor Details
-
AbstractBedrockChatModel
public AbstractBedrockChatModel()
-
-
Method Details
-
generate
public dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage> generate(List<dev.langchain4j.data.message.ChatMessage> messages) - Specified by:
generatein interfacedev.langchain4j.model.chat.ChatLanguageModel
-
chatMessageToString
Convert chat message to string- Parameters:
message- chat message- Returns:
- string
-
getRequestParameters
Get request parameters- Parameters:
prompt- prompt- Returns:
- request body
-
getModelId
Get model id- Returns:
- model id
-
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
-