Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/lib/aws-server-stubs/ai-server/responses/amazon.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,16 @@ responses.set('embed text amazon token count callback response', {
}
})

responses.set('Embedding not allowed.', {
headers: {
'content-type': contentType,
'x-amzn-requestid': reqId,
'x-amzn-errortype': errValidationException
},
statusCode: 400,
body: {
message: 'Embedding not allowed for this input.'
}
})

module.exports = responses
13 changes: 13 additions & 0 deletions test/lib/aws-server-stubs/ai-server/responses/converse.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,17 @@ responses.set('text converse ultimate question error', {
}
})

responses.set('text converse ultimate question streamed error', {
headers: {
'content-type': contentType,
'x-amzn-requestid': reqId,
'x-amzn-errortype':
'InternalServerException:http://internal.amazon.com/coral/com.amazon.bedrock/'
},
statusCode: 500,
body: {
message: 'Internal server error during streaming.'
}
})

module.exports = responses
12 changes: 10 additions & 2 deletions test/versioned/aws-sdk-v3/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,18 @@ function afterEach(ctx) {
})
}

function getAiResponseServer() {
/**
* Determines whether to use the http or http2 mock server
* given the `@aws-sdk/client-bedrock-runtime` package
* version.
* @param {string} rootPath The root path to the `node_modules` folder with AWS Bedrock `package.json`.
* @returns {object} The mock AWS Bedrock server, http or http2.
*/
function getAiResponseServer(rootPath = __dirname) {
const bedrockPackagePath = path.join(rootPath, '/node_modules/@aws-sdk/client-bedrock-runtime/package.json')
const semver = require('semver')
const { version: pkgVersion } = JSON.parse(
fs.readFileSync(path.join(__dirname, '/node_modules/@aws-sdk/client-bedrock-runtime/package.json'))
fs.readFileSync(bedrockPackagePath)
)
if (semver.gte(pkgVersion, '3.798.0')) {
return require('../../lib/aws-server-stubs/ai-server/http2')
Expand Down
Loading
Loading