Skip to content

Commit

Permalink
chore: Fixed aws-sdk-v3 bedrock tests (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsumners-nr committed May 23, 2024
1 parent 050469e commit 0260808
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions test/versioned/aws-sdk-v3/bedrock-chat-completions.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ const createAiResponseServer = require('../../lib/aws-server-stubs/ai-server')
const { FAKE_CREDENTIALS } = require('../../lib/aws-server-stubs')
const { DESTINATIONS } = require('../../../lib/config/attribute-filter')

const pkgVersion = (function () {
try {
const { version } = require('@smithy/smithy-client/package.json')
return version
} catch {
try {
const {
version
} = require('./node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/smithy-client/package.json')
return version
} catch {}
}
/* eslint-disable-next-line */
}())
// The shim will utilize the version of `@smithy/smithy-client` that is required
// by the `@aws-sdk/client-bedrock-runtime` module to set the version string
// on metrics. So we want to require that specific version instead of the one
// in our dependency tree. We can't use `require.resolve('mod', { paths: [] })`
// here because that appends the paths to the lookup tree instead of prepending
// them. Thus, we will still occasionally resolve to the module in our tree
// instead of the one in the test suite's tree.
const {
version: pkgVersion
} = require('./node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/smithy-client/package.json')

const requests = {
ai21: (prompt, modelId) => ({
Expand Down

0 comments on commit 0260808

Please sign in to comment.