@cat-factory/provider-bedrock 0.7.202 → 0.7.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ModelResolver, type ProviderRegistry } from '@cat-factory/agents';
|
|
2
2
|
export interface BedrockResolverOptions {
|
|
3
3
|
/** AWS region, e.g. `us-east-1`. */
|
|
4
4
|
region?: string;
|
|
@@ -16,6 +16,12 @@ export interface BedrockResolverOptions {
|
|
|
16
16
|
}
|
|
17
17
|
/** A {@link ModelResolver} for the `bedrock` provider. */
|
|
18
18
|
export declare function bedrockResolver(opts?: BedrockResolverOptions): ModelResolver;
|
|
19
|
+
/**
|
|
20
|
+
* The remedy for a Bedrock model id outside this deployment's allow-list. Names the `BEDROCK_MODELS`
|
|
21
|
+
* env var that defines the list, echoes the models it currently permits (so the fix is either "pick
|
|
22
|
+
* one of these" or "add this id to `BEDROCK_MODELS`"), and links the model-support doc.
|
|
23
|
+
*/
|
|
24
|
+
export declare function unsupportedBedrockModelMessage(model: string, allowed: readonly string[]): string;
|
|
19
25
|
/** A {@link ProviderRegistry} contributing the `bedrock` provider, ready to mix in. */
|
|
20
26
|
export declare function bedrockRegistry(opts?: BedrockResolverOptions): ProviderRegistry;
|
|
21
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AASnG,MAAM,WAAW,sBAAsB;IACrC,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,IAAI,GAAE,sBAA2B,GAAG,aAAa,CAehF;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAQhG;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,IAAI,GAAE,sBAA2B,GAAG,gBAAgB,CAEnF"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
|
|
2
|
+
import { MODEL_SUPPORT_DOCS } from '@cat-factory/agents';
|
|
2
3
|
/** A {@link ModelResolver} for the `bedrock` provider. */
|
|
3
4
|
export function bedrockResolver(opts = {}) {
|
|
4
5
|
const provider = createAmazonBedrock({
|
|
@@ -11,11 +12,23 @@ export function bedrockResolver(opts = {}) {
|
|
|
11
12
|
const allow = opts.supportedModels ? new Set(opts.supportedModels) : null;
|
|
12
13
|
return (ref) => {
|
|
13
14
|
if (allow && !allow.has(ref.model)) {
|
|
14
|
-
throw new Error(
|
|
15
|
+
throw new Error(unsupportedBedrockModelMessage(ref.model, opts.supportedModels ?? []));
|
|
15
16
|
}
|
|
16
17
|
return provider(ref.model);
|
|
17
18
|
};
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The remedy for a Bedrock model id outside this deployment's allow-list. Names the `BEDROCK_MODELS`
|
|
22
|
+
* env var that defines the list, echoes the models it currently permits (so the fix is either "pick
|
|
23
|
+
* one of these" or "add this id to `BEDROCK_MODELS`"), and links the model-support doc.
|
|
24
|
+
*/
|
|
25
|
+
export function unsupportedBedrockModelMessage(model, allowed) {
|
|
26
|
+
const list = allowed.length ? allowed.join(', ') : '(none)';
|
|
27
|
+
return (`Unsupported Bedrock model '${model}': it is not in this deployment's BEDROCK_MODELS ` +
|
|
28
|
+
`allow-list. Fix: either request one of the allowed models (${list}), or add '${model}' ` +
|
|
29
|
+
`to the comma-separated BEDROCK_MODELS env var and restart. ` +
|
|
30
|
+
`See ${MODEL_SUPPORT_DOCS.bedrock()}`);
|
|
31
|
+
}
|
|
19
32
|
/** A {@link ProviderRegistry} contributing the `bedrock` provider, ready to mix in. */
|
|
20
33
|
export function bedrockRegistry(opts = {}) {
|
|
21
34
|
return { bedrock: bedrockResolver(opts) };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAA6C,MAAM,qBAAqB,CAAA;AAyBnG,0DAA0D;AAC1D,MAAM,UAAU,eAAe,CAAC,IAAI,GAA2B,EAAE;IAC/D,MAAM,QAAQ,GAAG,mBAAmB,CAAC;QACnC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,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AAO,EAAE,EAAE,CACtC,CAAA;AACH,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,eAAe,CAAC,IAAI,GAA2B,EAAE;IAC/D,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAA;AAC3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/provider-bedrock",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.203",
|
|
4
4
|
"description": "Opt-in AWS Bedrock model registry for the Agent Architecture Board's AI provisioning facade. Mix into a CompositeModelProvider to add the `bedrock` provider.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,14 +26,17 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@ai-sdk/amazon-bedrock": "^4.0.128",
|
|
28
28
|
"ai": "^6.0.219",
|
|
29
|
-
"@cat-factory/agents": "0.53.
|
|
29
|
+
"@cat-factory/agents": "0.53.4",
|
|
30
30
|
"@cat-factory/kernel": "0.120.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"typescript": "7.0.1-rc"
|
|
33
|
+
"typescript": "7.0.1-rc",
|
|
34
|
+
"vitest": "^4.1.9"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
36
37
|
"build": "tsc -b tsconfig.build.json",
|
|
37
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
38
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"test:run": "vitest run"
|
|
38
41
|
}
|
|
39
42
|
}
|