PR review cleanup

This commit is contained in:
Smartsheet-JB-Brown 2025-03-13 11:12:17 -07:00
parent 613370a13b
commit 6c74e9ba7b
3 changed files with 5 additions and 23 deletions

View file

@ -1,17 +1,13 @@
// Mock the logger globally for all tests
jest.mock("../utils/logging", () => ({
logger: {
debug: jest.fn().mockImplementation((message, meta) => {
console.log(`DEBUG: ${message}`, meta ? JSON.stringify(meta) : "")
}),
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
fatal: jest.fn(),
child: jest.fn().mockReturnValue({
debug: jest.fn().mockImplementation((message, meta) => {
console.log(`DEBUG: ${message}`, meta ? JSON.stringify(meta) : "")
}),
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),

View file

@ -348,7 +348,7 @@ describe("AwsBedrockHandler", () => {
"arn:aws:bedrock:us-west-2:699475926481:inference-profile/us.meta.llama3-8b-instruct-v1:0",
)
//
//these should not be the default fall back. they should be Llama's config
expect(modelInfo.info.maxTokens).toBe(2048)
expect(modelInfo.info.contextWindow).toBe(4_000)
expect(modelInfo.info.supportsImages).toBe(false)

View file

@ -295,10 +295,6 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
if (region === "us." || region === "eu.") modelName = modelName.slice(3)
this.costModelConfig = this.getModelByName(modelName)
logger.debug("Updated modelConfig using invokedModelId from a prompt router response", {
ctx: "bedrock",
modelConfig: this.costModelConfig,
})
}
// Handle metadata events for the promptRouter.
@ -528,21 +524,17 @@ Please check:
modelData.id = this.options.awsCustomArn
if (modelData) {
logger.debug(`Matched custom ARN to model: ${modelName}`, {
ctx: "bedrock",
modelData,
})
return modelData
}
}
// An ARN was used, but no model info match found, use default values based on common patterns
let modelInfo = this.getModelByName(bedrockDefaultPromptRouterModelId)
let model = this.getModelByName(bedrockDefaultPromptRouterModelId)
// For custom ARNs, always return the specific values expected by tests
return {
id: this.options.awsCustomArn,
info: modelInfo.info,
info: model.info,
}
}
@ -556,11 +548,6 @@ Please check:
// For tests, allow any model ID (but not custom ARNs, which are handled above)
if (process.env.NODE_ENV === "test") {
logger.debug("Return defaults 4", {
ctx: "bedrock",
customArn: this.options.awsCustomArn,
})
return {
id: this.options.apiModelId,
info: {
@ -662,7 +649,6 @@ Please check:
try {
const outputStr = new TextDecoder().decode(response.output)
const output = JSON.parse(outputStr)
logger.debug("Bedrock response", { ctx: "bedrock", output: output })
if (output.content) {
return output.content
}