File tree Expand file tree Collapse file tree 3 files changed +2011
-1647
lines changed
entities/ai/amazon-bedrock
shared-code/src/data-access-layer/data-access-objects Expand file tree Collapse file tree 3 files changed +2011
-1647
lines changed Original file line number Diff line number Diff line change 1- import { Injectable } from '@nestjs/common' ;
21import { BedrockRuntimeClient , ConverseCommand } from '@aws-sdk/client-bedrock-runtime' ;
2+ import { Injectable } from '@nestjs/common' ;
33import { IAIProvider } from './ai-provider.interface.js' ;
44
55@Injectable ( )
66export class AmazonBedrockAiProvider implements IAIProvider {
77 private readonly bedrockRuntimeClient : BedrockRuntimeClient ;
88 private readonly modelId : string = 'global.anthropic.claude-sonnet-4-5-20250929-v1:0' ;
9- private readonly maxTokens : number = 1024 ;
109
1110 constructor ( ) {
1211 this . bedrockRuntimeClient = new BedrockRuntimeClient ( ) ;
@@ -22,7 +21,6 @@ export class AmazonBedrockAiProvider implements IAIProvider {
2221 const command = new ConverseCommand ( {
2322 modelId : this . modelId ,
2423 messages : conversation ,
25- inferenceConfig : { maxTokens : this . maxTokens } ,
2624 } ) ;
2725 try {
2826 const response = await this . bedrockRuntimeClient . send ( command ) ;
Original file line number Diff line number Diff line change @@ -5,21 +5,21 @@ import { Messages } from '../exceptions/text/messages.js';
55
66@Injectable ( )
77export class TimeoutInterceptor implements NestInterceptor {
8- intercept ( _context : ExecutionContext , next : CallHandler ) : Observable < any > {
9- const timeoutMs = process . env . NODE_ENV !== 'test' ? 15000 : 200000 ;
10- return next . handle ( ) . pipe (
11- timeout ( timeoutMs ) ,
12- catchError ( ( err ) => {
13- if ( err instanceof TimeoutError ) {
14- return throwError (
15- ( ) =>
16- new RequestTimeoutException ( {
17- message : Messages . CONNECTION_TIMED_OUT ,
18- } ) ,
19- ) ;
20- }
21- return throwError ( ( ) => err ) ;
22- } ) ,
23- ) ;
24- }
8+ intercept ( _context : ExecutionContext , next : CallHandler ) : Observable < any > {
9+ const timeoutMs = process . env . NODE_ENV !== 'test' ? 15000 : 200000 ;
10+ return next . handle ( ) . pipe (
11+ timeout ( timeoutMs ) ,
12+ catchError ( ( err ) => {
13+ if ( err instanceof TimeoutError ) {
14+ return throwError (
15+ ( ) =>
16+ new RequestTimeoutException ( {
17+ message : Messages . CONNECTION_TIMED_OUT ,
18+ } ) ,
19+ ) ;
20+ }
21+ return throwError ( ( ) => err ) ;
22+ } ) ,
23+ ) ;
24+ }
2525}
You can’t perform that action at this time.
0 commit comments