Package com.tnsai.llm.providers
Class BedrockClient
java.lang.Object
com.tnsai.llm.providers.BedrockClient
- All Implemented Interfaces:
com.tnsai.llm.LLMClient
AWS Bedrock LLM client implementation.
Supports Anthropic Claude 3 models via Amazon Bedrock.
Configuration:
- AWS Credentials (via environment variables, profile, or IAM role)
- AWS_REGION - Default: us-east-1
Supported Models (tested):
- anthropic.claude-3-sonnet-20240229-v1:0
- anthropic.claude-3-haiku-20240307-v1:0
- anthropic.claude-3-opus-20240229-v1:0
-
Constructor Summary
ConstructorsConstructorDescriptionBedrockClient(String modelId) Creates a BedrockClient with the specified model ID.BedrockClient(String modelId, float temperature) BedrockClient(String modelId, float temperature, Float topP, Integer maxTokens, String region) BedrockClient(String modelId, float temperature, Integer maxTokens, String region) -
Method Summary
Modifier and TypeMethodDescriptioncom.tnsai.llm.ChatResponsechat(String message, Optional<String> systemPrompt, Optional<List<Map<String, Object>>> history, Optional<List<Map<String, Object>>> tools) getModel()floatgetTopP()streamChat(String message, Optional<String> systemPrompt, Optional<List<Map<String, Object>>> history, Optional<List<Map<String, Object>>> tools) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tnsai.llm.LLMClient
chat, chat, chat, chat, chat, getCapabilities, getProviderName, listModels, streamChat, streamChat, streamChatWithHandler, streamChatWithHandler, streamChatWithSpec, streamChatWithSpec
-
Constructor Details
-
BedrockClient
Creates a BedrockClient with the specified model ID. Uses default region (us-east-1) and standard AWS credential chain.- Parameters:
modelId- The Bedrock model ID (e.g., "anthropic.claude-3-sonnet-20240229-v1:0")
-
BedrockClient
-
BedrockClient
-
BedrockClient
-
-
Method Details
-
getModel
- Specified by:
getModelin interfacecom.tnsai.llm.LLMClient
-
getTemperature
public float getTemperature()- Specified by:
getTemperaturein interfacecom.tnsai.llm.LLMClient
-
getTopP
- Specified by:
getTopPin interfacecom.tnsai.llm.LLMClient
-
getMaxTokens
- Specified by:
getMaxTokensin interfacecom.tnsai.llm.LLMClient
-
chat
public com.tnsai.llm.ChatResponse chat(String message, Optional<String> systemPrompt, Optional<List<Map<String, Object>>> history, Optional<List<Map<String, Object>>> tools) - Specified by:
chatin interfacecom.tnsai.llm.LLMClient
-
streamChat
public Stream<String> streamChat(String message, Optional<String> systemPrompt, Optional<List<Map<String, Object>>> history, Optional<List<Map<String, Object>>> tools) - Specified by:
streamChatin interfacecom.tnsai.llm.LLMClient
-