-
-
Notifications
You must be signed in to change notification settings - Fork 18
refactor: simplify AmazonBedrockAiProvider by removing unused parameters #1488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,15 +6,10 @@ import { IAIProvider } from './ai-provider.interface.js'; | |||||
| export class AmazonBedrockAiProvider implements IAIProvider { | ||||||
| private readonly bedrockRuntimeClient: BedrockRuntimeClient; | ||||||
| private readonly modelId: string = 'global.anthropic.claude-sonnet-4-5-20250929-v1:0'; | ||||||
| private readonly temperature: number = 0.7; | ||||||
| private readonly maxTokens: number = 1024; | ||||||
| private readonly region: string = 'us-west-2'; | ||||||
| private readonly topP: number = 0.9; | ||||||
|
|
||||||
| constructor() { | ||||||
| this.bedrockRuntimeClient = new BedrockRuntimeClient({ | ||||||
| region: this.region, | ||||||
| }); | ||||||
| this.bedrockRuntimeClient = new BedrockRuntimeClient(); | ||||||
| } | ||||||
| public async generateResponse(prompt: string): Promise<string> { | ||||||
| const conversation = [ | ||||||
|
|
@@ -27,7 +22,7 @@ export class AmazonBedrockAiProvider implements IAIProvider { | |||||
| const command = new ConverseCommand({ | ||||||
| modelId: this.modelId, | ||||||
| messages: conversation, | ||||||
| inferenceConfig: { maxTokens: this.maxTokens, temperature: this.temperature, topP: this.topP }, | ||||||
| inferenceConfig: { maxTokens: this.maxTokens }, | ||||||
|
||||||
| inferenceConfig: { maxTokens: this.maxTokens }, | |
| inferenceConfig: { maxTokens: this.maxTokens, temperature: 0.7, topP: 0.9 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the explicit region configuration means the BedrockRuntimeClient will now rely on the AWS SDK's default region resolution mechanism (environment variables, AWS config files, or instance metadata). This could lead to inconsistent behavior across different deployment environments if the region is not explicitly configured elsewhere. Consider whether the region should remain explicit to ensure consistent behavior, or document the requirement for proper AWS configuration in deployment environments.