Skip to content

Commit ca5f37d

Browse files
committed
fix: revert changes outside scope
1 parent 0e5bfc2 commit ca5f37d

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/api/providers/bedrock.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,7 @@ export type UsageType = {
167167
export class AwsBedrockHandler extends BaseProvider implements SingleCompletionHandler {
168168
protected options: ProviderSettings
169169
private client: BedrockRuntimeClient
170-
private arnInfo: {
171-
isValid: boolean
172-
region?: string
173-
modelType?: string
174-
modelId?: string
175-
errorMessage?: string
176-
crossRegionInference?: boolean
177-
awsUseCrossRegionInference?: boolean
178-
} = { isValid: false }
170+
private arnInfo: any
179171

180172
constructor(options: ProviderSettings) {
181173
super()
@@ -202,7 +194,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
202194
throw new Error("INVALID_ARN_FORMAT:" + errorMessage)
203195
}
204196

205-
if (this.arnInfo.region && this.arnInfo.region !== this.options.awsRegion && this.arnInfo.errorMessage) {
197+
if (this.arnInfo.region && this.arnInfo.region !== this.options.awsRegion) {
206198
// Log if there's a region mismatch between the ARN and the region selected by the user
207199
// We will use the ARNs region, so execution can continue, but log an info statement.
208200
// Log a warning if there's a region mismatch between the ARN and the region selected by the user
@@ -732,7 +724,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
732724
anthropicMessages: Anthropic.Messages.MessageParam[] | { role: string; content: string }[],
733725
systemMessage?: string,
734726
usePromptCache: boolean = false,
735-
modelInfo?: ModelInfo,
727+
modelInfo?: any,
736728
conversationId?: string, // Optional conversation ID to track cache points across messages
737729
): { system: SystemContentBlock[]; messages: Message[] } {
738730
// First convert messages using shared converter for proper image handling
@@ -753,7 +745,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
753745
supportsPromptCache: modelInfo?.supportsPromptCache || false,
754746
maxCachePoints: modelInfo?.maxCachePoints || 0,
755747
minTokensPerCachePoint: modelInfo?.minTokensPerCachePoint || 50,
756-
cachableFields: (modelInfo as any)?.cachableFields || [],
748+
cachableFields: modelInfo?.cachableFields || [],
757749
}
758750

759751
// Get previous cache point placements for this conversation if available
@@ -965,7 +957,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
965957

966958
// If custom ARN is provided, use it
967959
if (this.options.awsCustomArn) {
968-
modelConfig = this.getModelById(this.arnInfo.modelId || "", this.arnInfo.modelType)
960+
modelConfig = this.getModelById(this.arnInfo.modelId, this.arnInfo.modelType)
969961

970962
//If the user entered an ARN for a foundation-model they've done the same thing as picking from our list of options.
971963
//We leave the model data matching the same as if a drop-down input method was used by not overwriting the model ID with the user input ARN
@@ -1039,12 +1031,12 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
10391031
/**
10401032
* Removes any existing cachePoint nodes from content blocks
10411033
*/
1042-
private removeCachePoints(content: ContentBlock[] | undefined): ContentBlock[] | undefined {
1034+
private removeCachePoints(content: any): any {
10431035
if (Array.isArray(content)) {
10441036
return content.map((block) => {
10451037
// Use destructuring to remove cachePoint property
10461038
const { cachePoint: _, ...rest } = block
1047-
return rest as ContentBlock
1039+
return rest
10481040
})
10491041
}
10501042

0 commit comments

Comments
 (0)