feat: Complete zCode CLI X with Telegram bot integration

- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
This commit is contained in:
admin
2026-05-05 09:01:26 +00:00
Unverified
parent 4a7035dd92
commit 875c7f9b91
24688 changed files with 3224957 additions and 221 deletions

View File

@@ -0,0 +1 @@
/home/uroma2/zcode-cli-x/~/.npm-cache/@aws-sdk/client-bedrock-runtime@3.1021.0@@@1

View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,251 @@
<!-- generated file, do not edit directly -->
# @aws-sdk/client-bedrock-runtime
## Description
AWS SDK for JavaScript BedrockRuntime Client for Node.js, Browser and React Native.
<p>Describes the API operations for running inference using Amazon Bedrock models.</p>
## Installing
To install this package, use the CLI of your favorite package manager:
- `npm install @aws-sdk/client-bedrock-runtime`
- `yarn add @aws-sdk/client-bedrock-runtime`
- `pnpm add @aws-sdk/client-bedrock-runtime`
## Getting Started
### Import
The AWS SDK is modulized by clients and commands.
To send a request, you only need to import the `BedrockRuntimeClient` and
the commands you need, for example `ListAsyncInvokesCommand`:
```js
// ES5 example
const { BedrockRuntimeClient, ListAsyncInvokesCommand } = require("@aws-sdk/client-bedrock-runtime");
```
```ts
// ES6+ example
import { BedrockRuntimeClient, ListAsyncInvokesCommand } from "@aws-sdk/client-bedrock-runtime";
```
### Usage
To send a request:
- Instantiate a client with configuration (e.g. credentials, region).
- See [docs/CLIENTS](https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md) for configuration details.
- See [@aws-sdk/config](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/config/README.md) for additional options.
- Instantiate a command with input parameters.
- Call the `send` operation on the client, providing the command object as input.
```js
const client = new BedrockRuntimeClient({ region: "REGION" });
const params = { /** input parameters */ };
const command = new ListAsyncInvokesCommand(params);
```
#### Async/await
We recommend using the [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await)
operator to wait for the promise returned by send operation as follows:
```js
// async/await.
try {
const data = await client.send(command);
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}
```
#### Promises
You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining).
```js
client
.send(command)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
})
.finally(() => {
// finally.
});
```
#### Aggregated client
The aggregated client class is exported from the same package, but without the "Client" suffix.
`BedrockRuntime` extends `BedrockRuntimeClient` and additionally supports all operations, waiters, and paginators as methods.
This style may be familiar to you from the AWS SDK for JavaScript v2.
If you are bundling the AWS SDK, we recommend using only the bare-bones client (`BedrockRuntimeClient`).
More details are in the blog post on
[modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/).
```ts
import { BedrockRuntime } from "@aws-sdk/client-bedrock-runtime";
const client = new BedrockRuntime({ region: "REGION" });
// async/await.
try {
const data = await client.listAsyncInvokes(params);
// process data.
} catch (error) {
// error handling.
}
// Promises.
client
.listAsyncInvokes(params)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
});
// callbacks (not recommended).
client.listAsyncInvokes(params, (err, data) => {
// process err and data.
});
```
### Troubleshooting
When the service returns an exception, the error will include the exception information,
as well as response metadata (e.g. request id).
```js
try {
const data = await client.send(command);
// process data.
} catch (error) {
const { requestId, cfId, extendedRequestId } = error.$metadata;
console.log({ requestId, cfId, extendedRequestId });
/**
* The keys within exceptions are also parsed.
* You can access them by specifying exception names:
* if (error.name === 'SomeServiceException') {
* const value = error.specialKeyInException;
* }
*/
}
```
See also [docs/ERROR_HANDLING](https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/ERROR_HANDLING.md).
## Getting Help
Please use these community resources for getting help.
We use GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.
- Visit the [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html)
or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html).
- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/)
on AWS Developer Blog.
- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`.
- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3).
- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose).
To test your universal JavaScript code in Node.js, browser and react-native environments,
visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests).
## Contributing
This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/client-bedrock-runtime` package is updated.
To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients).
## License
This SDK is distributed under the
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),
see LICENSE for more information.
## Client Commands (Operations List)
<details>
<summary>
ApplyGuardrail
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/ApplyGuardrailCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ApplyGuardrailCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ApplyGuardrailCommandOutput/)
</details>
<details>
<summary>
Converse
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/ConverseCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ConverseCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ConverseCommandOutput/)
</details>
<details>
<summary>
ConverseStream
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/ConverseStreamCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ConverseStreamCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ConverseStreamCommandOutput/)
</details>
<details>
<summary>
CountTokens
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/CountTokensCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/CountTokensCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/CountTokensCommandOutput/)
</details>
<details>
<summary>
GetAsyncInvoke
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/GetAsyncInvokeCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/GetAsyncInvokeCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/GetAsyncInvokeCommandOutput/)
</details>
<details>
<summary>
InvokeModel
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/InvokeModelCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelCommandOutput/)
</details>
<details>
<summary>
InvokeModelWithBidirectionalStream
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/InvokeModelWithBidirectionalStreamCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelWithBidirectionalStreamCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelWithBidirectionalStreamCommandOutput/)
</details>
<details>
<summary>
InvokeModelWithResponseStream
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/InvokeModelWithResponseStreamCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelWithResponseStreamCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelWithResponseStreamCommandOutput/)
</details>
<details>
<summary>
ListAsyncInvokes
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/ListAsyncInvokesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ListAsyncInvokesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ListAsyncInvokesCommandOutput/)
</details>
<details>
<summary>
StartAsyncInvoke
</summary>
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/StartAsyncInvokeCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/StartAsyncInvokeCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/StartAsyncInvokeCommandOutput/)
</details>

View File

@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveHttpAuthSchemeConfig = exports.defaultBedrockRuntimeHttpAuthSchemeProvider = exports.defaultBedrockRuntimeHttpAuthSchemeParametersProvider = void 0;
const httpAuthSchemes_1 = require("@aws-sdk/core/httpAuthSchemes");
const core_1 = require("@smithy/core");
const util_middleware_1 = require("@smithy/util-middleware");
const defaultBedrockRuntimeHttpAuthSchemeParametersProvider = async (config, context, input) => {
return {
operation: (0, util_middleware_1.getSmithyContext)(context).operation,
region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => {
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
})(),
};
};
exports.defaultBedrockRuntimeHttpAuthSchemeParametersProvider = defaultBedrockRuntimeHttpAuthSchemeParametersProvider;
function createAwsAuthSigv4HttpAuthOption(authParameters) {
return {
schemeId: "aws.auth#sigv4",
signingProperties: {
name: "bedrock",
region: authParameters.region,
},
propertiesExtractor: (config, context) => ({
signingProperties: {
config,
context,
},
}),
};
}
function createSmithyApiHttpBearerAuthHttpAuthOption(authParameters) {
return {
schemeId: "smithy.api#httpBearerAuth",
propertiesExtractor: ({ profile, filepath, configFilepath, ignoreCache, }, context) => ({
identityProperties: {
profile,
filepath,
configFilepath,
ignoreCache,
},
}),
};
}
const defaultBedrockRuntimeHttpAuthSchemeProvider = (authParameters) => {
const options = [];
switch (authParameters.operation) {
default: {
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters));
}
}
return options;
};
exports.defaultBedrockRuntimeHttpAuthSchemeProvider = defaultBedrockRuntimeHttpAuthSchemeProvider;
const resolveHttpAuthSchemeConfig = (config) => {
const token = (0, core_1.memoizeIdentityProvider)(config.token, core_1.isIdentityExpired, core_1.doesIdentityRequireRefresh);
const config_0 = (0, httpAuthSchemes_1.resolveAwsSdkSigV4Config)(config);
return Object.assign(config_0, {
authSchemePreference: (0, util_middleware_1.normalizeProvider)(config.authSchemePreference ?? []),
token,
});
};
exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultEndpointResolver = void 0;
const util_endpoints_1 = require("@aws-sdk/util-endpoints");
const util_endpoints_2 = require("@smithy/util-endpoints");
const ruleset_1 = require("./ruleset");
const cache = new util_endpoints_2.EndpointCache({
size: 50,
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
});
const defaultEndpointResolver = (endpointParams, context = {}) => {
return cache.get(endpointParams, () => (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, {
endpointParams: endpointParams,
logger: context.logger,
}));
};
exports.defaultEndpointResolver = defaultEndpointResolver;
util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions;

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ruleSet = void 0;
const s = "required", t = "fn", u = "argv", v = "ref";
const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = { [s]: false, "type": "string" }, i = { [s]: true, "default": false, "type": "boolean" }, j = { [v]: "Endpoint" }, k = { [t]: c, [u]: [{ [v]: "UseFIPS" }, true] }, l = { [t]: c, [u]: [{ [v]: "UseDualStack" }, true] }, m = {}, n = { [t]: "getAttr", [u]: [{ [v]: g }, "supportsFIPS"] }, o = { [t]: c, [u]: [true, { [t]: "getAttr", [u]: [{ [v]: g }, "supportsDualStack"] }] }, p = [k], q = [l], r = [{ [v]: "Region" }];
const _data = { version: "1.0", parameters: { Region: h, UseDualStack: i, UseFIPS: i, Endpoint: h }, rules: [{ conditions: [{ [t]: b, [u]: [j] }], rules: [{ conditions: p, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { rules: [{ conditions: q, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: j, properties: m, headers: m }, type: e }], type: f }], type: f }, { rules: [{ conditions: [{ [t]: b, [u]: r }], rules: [{ conditions: [{ [t]: "aws.partition", [u]: r, assign: g }], rules: [{ conditions: [k, l], rules: [{ conditions: [{ [t]: c, [u]: [a, n] }, o], rules: [{ rules: [{ endpoint: { url: "https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: p, rules: [{ conditions: [{ [t]: c, [u]: [n, a] }], rules: [{ rules: [{ endpoint: { url: "https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: q, rules: [{ conditions: [o], rules: [{ rules: [{ endpoint: { url: "https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { rules: [{ endpoint: { url: "https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }], type: f }] };
exports.ruleSet = _data;

View File

@@ -0,0 +1,608 @@
'use strict';
var middlewareEventstream = require('@aws-sdk/middleware-eventstream');
var middlewareHostHeader = require('@aws-sdk/middleware-host-header');
var middlewareLogger = require('@aws-sdk/middleware-logger');
var middlewareRecursionDetection = require('@aws-sdk/middleware-recursion-detection');
var middlewareUserAgent = require('@aws-sdk/middleware-user-agent');
var middlewareWebsocket = require('@aws-sdk/middleware-websocket');
var configResolver = require('@smithy/config-resolver');
var core = require('@smithy/core');
var schema = require('@smithy/core/schema');
var eventstreamSerdeConfigResolver = require('@smithy/eventstream-serde-config-resolver');
var middlewareContentLength = require('@smithy/middleware-content-length');
var middlewareEndpoint = require('@smithy/middleware-endpoint');
var middlewareRetry = require('@smithy/middleware-retry');
var smithyClient = require('@smithy/smithy-client');
var httpAuthSchemeProvider = require('./auth/httpAuthSchemeProvider');
var runtimeConfig = require('./runtimeConfig');
var regionConfigResolver = require('@aws-sdk/region-config-resolver');
var protocolHttp = require('@smithy/protocol-http');
var schemas_0 = require('./schemas/schemas_0');
var errors = require('./models/errors');
var BedrockRuntimeServiceException = require('./models/BedrockRuntimeServiceException');
const resolveClientEndpointParameters = (options) => {
return Object.assign(options, {
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
useFipsEndpoint: options.useFipsEndpoint ?? false,
defaultSigningName: "bedrock",
});
};
const commonParams = {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
let _credentials = runtimeConfig.credentials;
let _token = runtimeConfig.token;
return {
setHttpAuthScheme(httpAuthScheme) {
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
if (index === -1) {
_httpAuthSchemes.push(httpAuthScheme);
}
else {
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
}
},
httpAuthSchemes() {
return _httpAuthSchemes;
},
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
_httpAuthSchemeProvider = httpAuthSchemeProvider;
},
httpAuthSchemeProvider() {
return _httpAuthSchemeProvider;
},
setCredentials(credentials) {
_credentials = credentials;
},
credentials() {
return _credentials;
},
setToken(token) {
_token = token;
},
token() {
return _token;
},
};
};
const resolveHttpAuthRuntimeConfig = (config) => {
return {
httpAuthSchemes: config.httpAuthSchemes(),
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
credentials: config.credentials(),
token: config.token(),
};
};
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
const extensionConfiguration = Object.assign(regionConfigResolver.getAwsRegionExtensionConfiguration(runtimeConfig), smithyClient.getDefaultExtensionConfiguration(runtimeConfig), protocolHttp.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
extensions.forEach((extension) => extension.configure(extensionConfiguration));
return Object.assign(runtimeConfig, regionConfigResolver.resolveAwsRegionExtensionConfiguration(extensionConfiguration), smithyClient.resolveDefaultRuntimeConfig(extensionConfiguration), protocolHttp.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
};
class BedrockRuntimeClient extends smithyClient.Client {
config;
constructor(...[configuration]) {
const _config_0 = runtimeConfig.getRuntimeConfig(configuration || {});
super(_config_0);
this.initConfig = _config_0;
const _config_1 = resolveClientEndpointParameters(_config_0);
const _config_2 = middlewareUserAgent.resolveUserAgentConfig(_config_1);
const _config_3 = middlewareRetry.resolveRetryConfig(_config_2);
const _config_4 = configResolver.resolveRegionConfig(_config_3);
const _config_5 = middlewareHostHeader.resolveHostHeaderConfig(_config_4);
const _config_6 = middlewareEndpoint.resolveEndpointConfig(_config_5);
const _config_7 = eventstreamSerdeConfigResolver.resolveEventStreamSerdeConfig(_config_6);
const _config_8 = httpAuthSchemeProvider.resolveHttpAuthSchemeConfig(_config_7);
const _config_9 = middlewareEventstream.resolveEventStreamConfig(_config_8);
const _config_10 = middlewareWebsocket.resolveWebSocketConfig(_config_9);
const _config_11 = resolveRuntimeExtensions(_config_10, configuration?.extensions || []);
this.config = _config_11;
this.middlewareStack.use(schema.getSchemaSerdePlugin(this.config));
this.middlewareStack.use(middlewareUserAgent.getUserAgentPlugin(this.config));
this.middlewareStack.use(middlewareRetry.getRetryPlugin(this.config));
this.middlewareStack.use(middlewareContentLength.getContentLengthPlugin(this.config));
this.middlewareStack.use(middlewareHostHeader.getHostHeaderPlugin(this.config));
this.middlewareStack.use(middlewareLogger.getLoggerPlugin(this.config));
this.middlewareStack.use(middlewareRecursionDetection.getRecursionDetectionPlugin(this.config));
this.middlewareStack.use(core.getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
httpAuthSchemeParametersProvider: httpAuthSchemeProvider.defaultBedrockRuntimeHttpAuthSchemeParametersProvider,
identityProviderConfigProvider: async (config) => new core.DefaultIdentityProviderConfig({
"aws.auth#sigv4": config.credentials,
"smithy.api#httpBearerAuth": config.token,
}),
}));
this.middlewareStack.use(core.getHttpSigningPlugin(this.config));
}
destroy() {
super.destroy();
}
}
class ApplyGuardrailCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "ApplyGuardrail", {})
.n("BedrockRuntimeClient", "ApplyGuardrailCommand")
.sc(schemas_0.ApplyGuardrail$)
.build() {
}
class ConverseCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "Converse", {})
.n("BedrockRuntimeClient", "ConverseCommand")
.sc(schemas_0.Converse$)
.build() {
}
class ConverseStreamCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "ConverseStream", {
eventStream: {
output: true,
},
})
.n("BedrockRuntimeClient", "ConverseStreamCommand")
.sc(schemas_0.ConverseStream$)
.build() {
}
class CountTokensCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "CountTokens", {})
.n("BedrockRuntimeClient", "CountTokensCommand")
.sc(schemas_0.CountTokens$)
.build() {
}
class GetAsyncInvokeCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "GetAsyncInvoke", {})
.n("BedrockRuntimeClient", "GetAsyncInvokeCommand")
.sc(schemas_0.GetAsyncInvoke$)
.build() {
}
class InvokeModelCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "InvokeModel", {})
.n("BedrockRuntimeClient", "InvokeModelCommand")
.sc(schemas_0.InvokeModel$)
.build() {
}
class InvokeModelWithBidirectionalStreamCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [
middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
middlewareEventstream.getEventStreamPlugin(config),
middlewareWebsocket.getWebSocketPlugin(config, {
headerPrefix: 'x-amz-bedrock-',
}),
];
})
.s("AmazonBedrockFrontendService", "InvokeModelWithBidirectionalStream", {
eventStream: {
input: true,
output: true,
},
})
.n("BedrockRuntimeClient", "InvokeModelWithBidirectionalStreamCommand")
.sc(schemas_0.InvokeModelWithBidirectionalStream$)
.build() {
}
class InvokeModelWithResponseStreamCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "InvokeModelWithResponseStream", {
eventStream: {
output: true,
},
})
.n("BedrockRuntimeClient", "InvokeModelWithResponseStreamCommand")
.sc(schemas_0.InvokeModelWithResponseStream$)
.build() {
}
class ListAsyncInvokesCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "ListAsyncInvokes", {})
.n("BedrockRuntimeClient", "ListAsyncInvokesCommand")
.sc(schemas_0.ListAsyncInvokes$)
.build() {
}
class StartAsyncInvokeCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "StartAsyncInvoke", {})
.n("BedrockRuntimeClient", "StartAsyncInvokeCommand")
.sc(schemas_0.StartAsyncInvoke$)
.build() {
}
const paginateListAsyncInvokes = core.createPaginator(BedrockRuntimeClient, ListAsyncInvokesCommand, "nextToken", "nextToken", "maxResults");
const commands = {
ApplyGuardrailCommand,
ConverseCommand,
ConverseStreamCommand,
CountTokensCommand,
GetAsyncInvokeCommand,
InvokeModelCommand,
InvokeModelWithBidirectionalStreamCommand,
InvokeModelWithResponseStreamCommand,
ListAsyncInvokesCommand,
StartAsyncInvokeCommand,
};
const paginators = {
paginateListAsyncInvokes,
};
class BedrockRuntime extends BedrockRuntimeClient {
}
smithyClient.createAggregatedClient(commands, BedrockRuntime, { paginators });
const AsyncInvokeStatus = {
COMPLETED: "Completed",
FAILED: "Failed",
IN_PROGRESS: "InProgress",
};
const SortAsyncInvocationBy = {
SUBMISSION_TIME: "SubmissionTime",
};
const SortOrder = {
ASCENDING: "Ascending",
DESCENDING: "Descending",
};
const GuardrailImageFormat = {
JPEG: "jpeg",
PNG: "png",
};
const GuardrailContentQualifier = {
GROUNDING_SOURCE: "grounding_source",
GUARD_CONTENT: "guard_content",
QUERY: "query",
};
const GuardrailOutputScope = {
FULL: "FULL",
INTERVENTIONS: "INTERVENTIONS",
};
const GuardrailContentSource = {
INPUT: "INPUT",
OUTPUT: "OUTPUT",
};
const GuardrailAction = {
GUARDRAIL_INTERVENED: "GUARDRAIL_INTERVENED",
NONE: "NONE",
};
const GuardrailOrigin = {
ACCOUNT_ENFORCED: "ACCOUNT_ENFORCED",
ORGANIZATION_ENFORCED: "ORGANIZATION_ENFORCED",
REQUEST: "REQUEST",
};
const GuardrailOwnership = {
CROSS_ACCOUNT: "CROSS_ACCOUNT",
SELF: "SELF",
};
const GuardrailAutomatedReasoningLogicWarningType = {
ALWAYS_FALSE: "ALWAYS_FALSE",
ALWAYS_TRUE: "ALWAYS_TRUE",
};
const GuardrailContentPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailContentFilterConfidence = {
HIGH: "HIGH",
LOW: "LOW",
MEDIUM: "MEDIUM",
NONE: "NONE",
};
const GuardrailContentFilterStrength = {
HIGH: "HIGH",
LOW: "LOW",
MEDIUM: "MEDIUM",
NONE: "NONE",
};
const GuardrailContentFilterType = {
HATE: "HATE",
INSULTS: "INSULTS",
MISCONDUCT: "MISCONDUCT",
PROMPT_ATTACK: "PROMPT_ATTACK",
SEXUAL: "SEXUAL",
VIOLENCE: "VIOLENCE",
};
const GuardrailContextualGroundingPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailContextualGroundingFilterType = {
GROUNDING: "GROUNDING",
RELEVANCE: "RELEVANCE",
};
const GuardrailSensitiveInformationPolicyAction = {
ANONYMIZED: "ANONYMIZED",
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailPiiEntityType = {
ADDRESS: "ADDRESS",
AGE: "AGE",
AWS_ACCESS_KEY: "AWS_ACCESS_KEY",
AWS_SECRET_KEY: "AWS_SECRET_KEY",
CA_HEALTH_NUMBER: "CA_HEALTH_NUMBER",
CA_SOCIAL_INSURANCE_NUMBER: "CA_SOCIAL_INSURANCE_NUMBER",
CREDIT_DEBIT_CARD_CVV: "CREDIT_DEBIT_CARD_CVV",
CREDIT_DEBIT_CARD_EXPIRY: "CREDIT_DEBIT_CARD_EXPIRY",
CREDIT_DEBIT_CARD_NUMBER: "CREDIT_DEBIT_CARD_NUMBER",
DRIVER_ID: "DRIVER_ID",
EMAIL: "EMAIL",
INTERNATIONAL_BANK_ACCOUNT_NUMBER: "INTERNATIONAL_BANK_ACCOUNT_NUMBER",
IP_ADDRESS: "IP_ADDRESS",
LICENSE_PLATE: "LICENSE_PLATE",
MAC_ADDRESS: "MAC_ADDRESS",
NAME: "NAME",
PASSWORD: "PASSWORD",
PHONE: "PHONE",
PIN: "PIN",
SWIFT_CODE: "SWIFT_CODE",
UK_NATIONAL_HEALTH_SERVICE_NUMBER: "UK_NATIONAL_HEALTH_SERVICE_NUMBER",
UK_NATIONAL_INSURANCE_NUMBER: "UK_NATIONAL_INSURANCE_NUMBER",
UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER: "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
URL: "URL",
USERNAME: "USERNAME",
US_BANK_ACCOUNT_NUMBER: "US_BANK_ACCOUNT_NUMBER",
US_BANK_ROUTING_NUMBER: "US_BANK_ROUTING_NUMBER",
US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER: "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
US_PASSPORT_NUMBER: "US_PASSPORT_NUMBER",
US_SOCIAL_SECURITY_NUMBER: "US_SOCIAL_SECURITY_NUMBER",
VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER",
};
const GuardrailTopicPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailTopicType = {
DENY: "DENY",
};
const GuardrailWordPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailManagedWordType = {
PROFANITY: "PROFANITY",
};
const GuardrailTrace = {
DISABLED: "disabled",
ENABLED: "enabled",
ENABLED_FULL: "enabled_full",
};
const AudioFormat = {
AAC: "aac",
FLAC: "flac",
M4A: "m4a",
MKA: "mka",
MKV: "mkv",
MP3: "mp3",
MP4: "mp4",
MPEG: "mpeg",
MPGA: "mpga",
OGG: "ogg",
OPUS: "opus",
PCM: "pcm",
WAV: "wav",
WEBM: "webm",
X_AAC: "x-aac",
};
const CacheTTL = {
FIVE_MINUTES: "5m",
ONE_HOUR: "1h",
};
const CachePointType = {
DEFAULT: "default",
};
const DocumentFormat = {
CSV: "csv",
DOC: "doc",
DOCX: "docx",
HTML: "html",
MD: "md",
PDF: "pdf",
TXT: "txt",
XLS: "xls",
XLSX: "xlsx",
};
const GuardrailConverseImageFormat = {
JPEG: "jpeg",
PNG: "png",
};
const GuardrailConverseContentQualifier = {
GROUNDING_SOURCE: "grounding_source",
GUARD_CONTENT: "guard_content",
QUERY: "query",
};
const ImageFormat = {
GIF: "gif",
JPEG: "jpeg",
PNG: "png",
WEBP: "webp",
};
const VideoFormat = {
FLV: "flv",
MKV: "mkv",
MOV: "mov",
MP4: "mp4",
MPEG: "mpeg",
MPG: "mpg",
THREE_GP: "three_gp",
WEBM: "webm",
WMV: "wmv",
};
const ToolResultStatus = {
ERROR: "error",
SUCCESS: "success",
};
const ToolUseType = {
SERVER_TOOL_USE: "server_tool_use",
};
const ConversationRole = {
ASSISTANT: "assistant",
USER: "user",
};
const OutputFormatType = {
JSON_SCHEMA: "json_schema",
};
const PerformanceConfigLatency = {
OPTIMIZED: "optimized",
STANDARD: "standard",
};
const ServiceTierType = {
DEFAULT: "default",
FLEX: "flex",
PRIORITY: "priority",
RESERVED: "reserved",
};
const StopReason = {
CONTENT_FILTERED: "content_filtered",
END_TURN: "end_turn",
GUARDRAIL_INTERVENED: "guardrail_intervened",
MALFORMED_MODEL_OUTPUT: "malformed_model_output",
MALFORMED_TOOL_USE: "malformed_tool_use",
MAX_TOKENS: "max_tokens",
MODEL_CONTEXT_WINDOW_EXCEEDED: "model_context_window_exceeded",
STOP_SEQUENCE: "stop_sequence",
TOOL_USE: "tool_use",
};
const GuardrailStreamProcessingMode = {
ASYNC: "async",
SYNC: "sync",
};
const Trace = {
DISABLED: "DISABLED",
ENABLED: "ENABLED",
ENABLED_FULL: "ENABLED_FULL",
};
exports.$Command = smithyClient.Command;
exports.__Client = smithyClient.Client;
exports.BedrockRuntimeServiceException = BedrockRuntimeServiceException.BedrockRuntimeServiceException;
exports.ApplyGuardrailCommand = ApplyGuardrailCommand;
exports.AsyncInvokeStatus = AsyncInvokeStatus;
exports.AudioFormat = AudioFormat;
exports.BedrockRuntime = BedrockRuntime;
exports.BedrockRuntimeClient = BedrockRuntimeClient;
exports.CachePointType = CachePointType;
exports.CacheTTL = CacheTTL;
exports.ConversationRole = ConversationRole;
exports.ConverseCommand = ConverseCommand;
exports.ConverseStreamCommand = ConverseStreamCommand;
exports.CountTokensCommand = CountTokensCommand;
exports.DocumentFormat = DocumentFormat;
exports.GetAsyncInvokeCommand = GetAsyncInvokeCommand;
exports.GuardrailAction = GuardrailAction;
exports.GuardrailAutomatedReasoningLogicWarningType = GuardrailAutomatedReasoningLogicWarningType;
exports.GuardrailContentFilterConfidence = GuardrailContentFilterConfidence;
exports.GuardrailContentFilterStrength = GuardrailContentFilterStrength;
exports.GuardrailContentFilterType = GuardrailContentFilterType;
exports.GuardrailContentPolicyAction = GuardrailContentPolicyAction;
exports.GuardrailContentQualifier = GuardrailContentQualifier;
exports.GuardrailContentSource = GuardrailContentSource;
exports.GuardrailContextualGroundingFilterType = GuardrailContextualGroundingFilterType;
exports.GuardrailContextualGroundingPolicyAction = GuardrailContextualGroundingPolicyAction;
exports.GuardrailConverseContentQualifier = GuardrailConverseContentQualifier;
exports.GuardrailConverseImageFormat = GuardrailConverseImageFormat;
exports.GuardrailImageFormat = GuardrailImageFormat;
exports.GuardrailManagedWordType = GuardrailManagedWordType;
exports.GuardrailOrigin = GuardrailOrigin;
exports.GuardrailOutputScope = GuardrailOutputScope;
exports.GuardrailOwnership = GuardrailOwnership;
exports.GuardrailPiiEntityType = GuardrailPiiEntityType;
exports.GuardrailSensitiveInformationPolicyAction = GuardrailSensitiveInformationPolicyAction;
exports.GuardrailStreamProcessingMode = GuardrailStreamProcessingMode;
exports.GuardrailTopicPolicyAction = GuardrailTopicPolicyAction;
exports.GuardrailTopicType = GuardrailTopicType;
exports.GuardrailTrace = GuardrailTrace;
exports.GuardrailWordPolicyAction = GuardrailWordPolicyAction;
exports.ImageFormat = ImageFormat;
exports.InvokeModelCommand = InvokeModelCommand;
exports.InvokeModelWithBidirectionalStreamCommand = InvokeModelWithBidirectionalStreamCommand;
exports.InvokeModelWithResponseStreamCommand = InvokeModelWithResponseStreamCommand;
exports.ListAsyncInvokesCommand = ListAsyncInvokesCommand;
exports.OutputFormatType = OutputFormatType;
exports.PerformanceConfigLatency = PerformanceConfigLatency;
exports.ServiceTierType = ServiceTierType;
exports.SortAsyncInvocationBy = SortAsyncInvocationBy;
exports.SortOrder = SortOrder;
exports.StartAsyncInvokeCommand = StartAsyncInvokeCommand;
exports.StopReason = StopReason;
exports.ToolResultStatus = ToolResultStatus;
exports.ToolUseType = ToolUseType;
exports.Trace = Trace;
exports.VideoFormat = VideoFormat;
exports.paginateListAsyncInvokes = paginateListAsyncInvokes;
Object.prototype.hasOwnProperty.call(schemas_0, '__proto__') &&
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
Object.defineProperty(exports, '__proto__', {
enumerable: true,
value: schemas_0['__proto__']
});
Object.keys(schemas_0).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = schemas_0[k];
});
Object.prototype.hasOwnProperty.call(errors, '__proto__') &&
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
Object.defineProperty(exports, '__proto__', {
enumerable: true,
value: errors['__proto__']
});
Object.keys(errors).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = errors[k];
});

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BedrockRuntimeServiceException = exports.__ServiceException = void 0;
const smithy_client_1 = require("@smithy/smithy-client");
Object.defineProperty(exports, "__ServiceException", { enumerable: true, get: function () { return smithy_client_1.ServiceException; } });
class BedrockRuntimeServiceException extends smithy_client_1.ServiceException {
constructor(options) {
super(options);
Object.setPrototypeOf(this, BedrockRuntimeServiceException.prototype);
}
}
exports.BedrockRuntimeServiceException = BedrockRuntimeServiceException;

View File

@@ -0,0 +1,169 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModelStreamErrorException = exports.ModelTimeoutException = exports.ModelNotReadyException = exports.ModelErrorException = exports.ServiceUnavailableException = exports.ServiceQuotaExceededException = exports.ResourceNotFoundException = exports.ConflictException = exports.ValidationException = exports.ThrottlingException = exports.InternalServerException = exports.AccessDeniedException = void 0;
const BedrockRuntimeServiceException_1 = require("./BedrockRuntimeServiceException");
class AccessDeniedException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "AccessDeniedException";
$fault = "client";
constructor(opts) {
super({
name: "AccessDeniedException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, AccessDeniedException.prototype);
}
}
exports.AccessDeniedException = AccessDeniedException;
class InternalServerException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "InternalServerException";
$fault = "server";
constructor(opts) {
super({
name: "InternalServerException",
$fault: "server",
...opts,
});
Object.setPrototypeOf(this, InternalServerException.prototype);
}
}
exports.InternalServerException = InternalServerException;
class ThrottlingException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ThrottlingException";
$fault = "client";
constructor(opts) {
super({
name: "ThrottlingException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ThrottlingException.prototype);
}
}
exports.ThrottlingException = ThrottlingException;
class ValidationException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ValidationException";
$fault = "client";
constructor(opts) {
super({
name: "ValidationException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ValidationException.prototype);
}
}
exports.ValidationException = ValidationException;
class ConflictException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ConflictException";
$fault = "client";
constructor(opts) {
super({
name: "ConflictException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ConflictException.prototype);
}
}
exports.ConflictException = ConflictException;
class ResourceNotFoundException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ResourceNotFoundException";
$fault = "client";
constructor(opts) {
super({
name: "ResourceNotFoundException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
}
}
exports.ResourceNotFoundException = ResourceNotFoundException;
class ServiceQuotaExceededException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ServiceQuotaExceededException";
$fault = "client";
constructor(opts) {
super({
name: "ServiceQuotaExceededException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype);
}
}
exports.ServiceQuotaExceededException = ServiceQuotaExceededException;
class ServiceUnavailableException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ServiceUnavailableException";
$fault = "server";
constructor(opts) {
super({
name: "ServiceUnavailableException",
$fault: "server",
...opts,
});
Object.setPrototypeOf(this, ServiceUnavailableException.prototype);
}
}
exports.ServiceUnavailableException = ServiceUnavailableException;
class ModelErrorException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ModelErrorException";
$fault = "client";
originalStatusCode;
resourceName;
constructor(opts) {
super({
name: "ModelErrorException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelErrorException.prototype);
this.originalStatusCode = opts.originalStatusCode;
this.resourceName = opts.resourceName;
}
}
exports.ModelErrorException = ModelErrorException;
class ModelNotReadyException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ModelNotReadyException";
$fault = "client";
$retryable = {};
constructor(opts) {
super({
name: "ModelNotReadyException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelNotReadyException.prototype);
}
}
exports.ModelNotReadyException = ModelNotReadyException;
class ModelTimeoutException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ModelTimeoutException";
$fault = "client";
constructor(opts) {
super({
name: "ModelTimeoutException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelTimeoutException.prototype);
}
}
exports.ModelTimeoutException = ModelTimeoutException;
class ModelStreamErrorException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ModelStreamErrorException";
$fault = "client";
originalStatusCode;
originalMessage;
constructor(opts) {
super({
name: "ModelStreamErrorException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelStreamErrorException.prototype);
this.originalStatusCode = opts.originalStatusCode;
this.originalMessage = opts.originalMessage;
}
}
exports.ModelStreamErrorException = ModelStreamErrorException;

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuntimeConfig = void 0;
const tslib_1 = require("tslib");
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
const sha256_browser_1 = require("@aws-crypto/sha256-browser");
const middleware_websocket_1 = require("@aws-sdk/middleware-websocket");
const util_user_agent_browser_1 = require("@aws-sdk/util-user-agent-browser");
const config_resolver_1 = require("@smithy/config-resolver");
const eventstream_serde_browser_1 = require("@smithy/eventstream-serde-browser");
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
const invalid_dependency_1 = require("@smithy/invalid-dependency");
const smithy_client_1 = require("@smithy/smithy-client");
const util_body_length_browser_1 = require("@smithy/util-body-length-browser");
const util_defaults_mode_browser_1 = require("@smithy/util-defaults-mode-browser");
const util_retry_1 = require("@smithy/util-retry");
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
const getRuntimeConfig = (config) => {
const defaultsMode = (0, util_defaults_mode_browser_1.resolveDefaultsModeConfig)(config);
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
return {
...clientSharedValues,
...config,
runtime: "browser",
defaultsMode,
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_browser_1.calculateBodyLength,
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_browser_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? middleware_websocket_1.eventStreamPayloadHandlerProvider,
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_browser_1.eventStreamSerdeProvider,
maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
region: config?.region ?? (0, invalid_dependency_1.invalidProvider)("Region is missing"),
requestHandler: middleware_websocket_1.WebSocketFetchHandler.create(config?.requestHandler
?? defaultConfigProvider, fetch_http_handler_1.FetchHttpHandler.create(defaultConfigProvider)),
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
sha256: config?.sha256 ?? sha256_browser_1.Sha256,
streamCollector: config?.streamCollector ?? fetch_http_handler_1.streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_DUALSTACK_ENDPOINT)),
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_FIPS_ENDPOINT)),
};
};
exports.getRuntimeConfig = getRuntimeConfig;

View File

@@ -0,0 +1,83 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuntimeConfig = void 0;
const tslib_1 = require("tslib");
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
const client_1 = require("@aws-sdk/core/client");
const httpAuthSchemes_1 = require("@aws-sdk/core/httpAuthSchemes");
const credential_provider_node_1 = require("@aws-sdk/credential-provider-node");
const eventstream_handler_node_1 = require("@aws-sdk/eventstream-handler-node");
const token_providers_1 = require("@aws-sdk/token-providers");
const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
const config_resolver_1 = require("@smithy/config-resolver");
const core_1 = require("@smithy/core");
const eventstream_serde_node_1 = require("@smithy/eventstream-serde-node");
const hash_node_1 = require("@smithy/hash-node");
const middleware_retry_1 = require("@smithy/middleware-retry");
const node_config_provider_1 = require("@smithy/node-config-provider");
const node_http_handler_1 = require("@smithy/node-http-handler");
const smithy_client_1 = require("@smithy/smithy-client");
const util_body_length_node_1 = require("@smithy/util-body-length-node");
const util_defaults_mode_node_1 = require("@smithy/util-defaults-mode-node");
const util_retry_1 = require("@smithy/util-retry");
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
const getRuntimeConfig = (config) => {
(0, smithy_client_1.emitWarningIfUnsupportedVersion)(process.version);
const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
(0, client_1.emitWarningIfUnsupportedVersion)(process.version);
const loaderConfig = {
profile: config?.profile,
logger: clientSharedValues.logger,
signingName: "bedrock",
};
return {
...clientSharedValues,
...config,
runtime: "node",
defaultsMode,
authSchemePreference: config?.authSchemePreference ?? (0, node_config_provider_1.loadConfig)(httpAuthSchemes_1.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider,
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventstream_handler_node_1.eventStreamPayloadHandlerProvider,
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_node_1.eventStreamSerdeProvider,
httpAuthSchemes: config?.httpAuthSchemes ?? [
{
schemeId: "aws.auth#sigv4",
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
signer: new httpAuthSchemes_1.AwsSdkSigV4Signer(),
},
{
schemeId: "smithy.api#httpBearerAuth",
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth") || (async (idProps) => {
try {
return await (0, token_providers_1.fromEnvSigningName)({ signingName: "bedrock" })();
}
catch (error) {
return await (0, token_providers_1.nodeProvider)(idProps)(idProps);
}
}),
signer: new core_1.HttpBearerAuthSigner(),
},
],
maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, { ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
requestHandler: node_http_handler_1.NodeHttp2Handler.create(config?.requestHandler ?? (async () => ({
...await defaultConfigProvider(),
disableConcurrentStreams: true
}))),
retryMode: config?.retryMode ??
(0, node_config_provider_1.loadConfig)({
...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
}, config),
sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
userAgentAppId: config?.userAgentAppId ?? (0, node_config_provider_1.loadConfig)(util_user_agent_node_1.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
};
};
exports.getRuntimeConfig = getRuntimeConfig;

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuntimeConfig = void 0;
const sha256_js_1 = require("@aws-crypto/sha256-js");
const invalid_dependency_1 = require("@smithy/invalid-dependency");
const runtimeConfig_browser_1 = require("./runtimeConfig.browser");
const getRuntimeConfig = (config) => {
const browserDefaults = (0, runtimeConfig_browser_1.getRuntimeConfig)(config);
return {
...browserDefaults,
...config,
runtime: "react-native",
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? (() => ({
handle: (0, invalid_dependency_1.invalidFunction)("event stream request is not supported in ReactNative."),
})),
sha256: config?.sha256 ?? sha256_js_1.Sha256,
};
};
exports.getRuntimeConfig = getRuntimeConfig;

View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuntimeConfig = void 0;
const httpAuthSchemes_1 = require("@aws-sdk/core/httpAuthSchemes");
const protocols_1 = require("@aws-sdk/core/protocols");
const core_1 = require("@smithy/core");
const smithy_client_1 = require("@smithy/smithy-client");
const url_parser_1 = require("@smithy/url-parser");
const util_base64_1 = require("@smithy/util-base64");
const util_utf8_1 = require("@smithy/util-utf8");
const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
const endpointResolver_1 = require("./endpoint/endpointResolver");
const schemas_0_1 = require("./schemas/schemas_0");
const getRuntimeConfig = (config) => {
return {
apiVersion: "2023-09-30",
base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
disableHostPrefix: config?.disableHostPrefix ?? false,
endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
extensions: config?.extensions ?? [],
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultBedrockRuntimeHttpAuthSchemeProvider,
httpAuthSchemes: config?.httpAuthSchemes ?? [
{
schemeId: "aws.auth#sigv4",
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
signer: new httpAuthSchemes_1.AwsSdkSigV4Signer(),
},
{
schemeId: "smithy.api#httpBearerAuth",
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth"),
signer: new core_1.HttpBearerAuthSigner(),
},
],
logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
protocol: config?.protocol ?? protocols_1.AwsRestJsonProtocol,
protocolSettings: config?.protocolSettings ?? {
defaultNamespace: "com.amazonaws.bedrockruntime",
errorTypeRegistries: schemas_0_1.errorTypeRegistries,
version: "2023-09-30",
serviceTarget: "AmazonBedrockFrontendService",
},
serviceId: config?.serviceId ?? "Bedrock Runtime",
urlParser: config?.urlParser ?? url_parser_1.parseUrl,
utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
};
};
exports.getRuntimeConfig = getRuntimeConfig;

View File

@@ -0,0 +1,31 @@
import { createAggregatedClient } from "@smithy/smithy-client";
import { BedrockRuntimeClient } from "./BedrockRuntimeClient";
import { ApplyGuardrailCommand, } from "./commands/ApplyGuardrailCommand";
import { ConverseCommand } from "./commands/ConverseCommand";
import { ConverseStreamCommand, } from "./commands/ConverseStreamCommand";
import { CountTokensCommand, } from "./commands/CountTokensCommand";
import { GetAsyncInvokeCommand, } from "./commands/GetAsyncInvokeCommand";
import { InvokeModelCommand, } from "./commands/InvokeModelCommand";
import { InvokeModelWithBidirectionalStreamCommand, } from "./commands/InvokeModelWithBidirectionalStreamCommand";
import { InvokeModelWithResponseStreamCommand, } from "./commands/InvokeModelWithResponseStreamCommand";
import { ListAsyncInvokesCommand, } from "./commands/ListAsyncInvokesCommand";
import { StartAsyncInvokeCommand, } from "./commands/StartAsyncInvokeCommand";
import { paginateListAsyncInvokes } from "./pagination/ListAsyncInvokesPaginator";
const commands = {
ApplyGuardrailCommand,
ConverseCommand,
ConverseStreamCommand,
CountTokensCommand,
GetAsyncInvokeCommand,
InvokeModelCommand,
InvokeModelWithBidirectionalStreamCommand,
InvokeModelWithResponseStreamCommand,
ListAsyncInvokesCommand,
StartAsyncInvokeCommand,
};
const paginators = {
paginateListAsyncInvokes,
};
export class BedrockRuntime extends BedrockRuntimeClient {
}
createAggregatedClient(commands, BedrockRuntime, { paginators });

View File

@@ -0,0 +1,57 @@
import { resolveEventStreamConfig, } from "@aws-sdk/middleware-eventstream";
import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
import { resolveWebSocketConfig, } from "@aws-sdk/middleware-websocket";
import { resolveRegionConfig } from "@smithy/config-resolver";
import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
import { getSchemaSerdePlugin } from "@smithy/core/schema";
import { resolveEventStreamSerdeConfig, } from "@smithy/eventstream-serde-config-resolver";
import { getContentLengthPlugin } from "@smithy/middleware-content-length";
import { resolveEndpointConfig, } from "@smithy/middleware-endpoint";
import { getRetryPlugin, resolveRetryConfig, } from "@smithy/middleware-retry";
import { Client as __Client, } from "@smithy/smithy-client";
import { defaultBedrockRuntimeHttpAuthSchemeParametersProvider, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider";
import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
import { resolveRuntimeExtensions } from "./runtimeExtensions";
export { __Client };
export class BedrockRuntimeClient extends __Client {
config;
constructor(...[configuration]) {
const _config_0 = __getRuntimeConfig(configuration || {});
super(_config_0);
this.initConfig = _config_0;
const _config_1 = resolveClientEndpointParameters(_config_0);
const _config_2 = resolveUserAgentConfig(_config_1);
const _config_3 = resolveRetryConfig(_config_2);
const _config_4 = resolveRegionConfig(_config_3);
const _config_5 = resolveHostHeaderConfig(_config_4);
const _config_6 = resolveEndpointConfig(_config_5);
const _config_7 = resolveEventStreamSerdeConfig(_config_6);
const _config_8 = resolveHttpAuthSchemeConfig(_config_7);
const _config_9 = resolveEventStreamConfig(_config_8);
const _config_10 = resolveWebSocketConfig(_config_9);
const _config_11 = resolveRuntimeExtensions(_config_10, configuration?.extensions || []);
this.config = _config_11;
this.middlewareStack.use(getSchemaSerdePlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
this.middlewareStack.use(getRetryPlugin(this.config));
this.middlewareStack.use(getContentLengthPlugin(this.config));
this.middlewareStack.use(getHostHeaderPlugin(this.config));
this.middlewareStack.use(getLoggerPlugin(this.config));
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
httpAuthSchemeParametersProvider: defaultBedrockRuntimeHttpAuthSchemeParametersProvider,
identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({
"aws.auth#sigv4": config.credentials,
"smithy.api#httpBearerAuth": config.token,
}),
}));
this.middlewareStack.use(getHttpSigningPlugin(this.config));
}
destroy() {
super.destroy();
}
}

View File

@@ -0,0 +1,46 @@
export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
let _credentials = runtimeConfig.credentials;
let _token = runtimeConfig.token;
return {
setHttpAuthScheme(httpAuthScheme) {
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
if (index === -1) {
_httpAuthSchemes.push(httpAuthScheme);
}
else {
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
}
},
httpAuthSchemes() {
return _httpAuthSchemes;
},
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
_httpAuthSchemeProvider = httpAuthSchemeProvider;
},
httpAuthSchemeProvider() {
return _httpAuthSchemeProvider;
},
setCredentials(credentials) {
_credentials = credentials;
},
credentials() {
return _credentials;
},
setToken(token) {
_token = token;
},
token() {
return _token;
},
};
};
export const resolveHttpAuthRuntimeConfig = (config) => {
return {
httpAuthSchemes: config.httpAuthSchemes(),
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
credentials: config.credentials(),
token: config.token(),
};
};

View File

@@ -0,0 +1,57 @@
import { resolveAwsSdkSigV4Config, } from "@aws-sdk/core/httpAuthSchemes";
import { doesIdentityRequireRefresh, isIdentityExpired, memoizeIdentityProvider } from "@smithy/core";
import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
export const defaultBedrockRuntimeHttpAuthSchemeParametersProvider = async (config, context, input) => {
return {
operation: getSmithyContext(context).operation,
region: await normalizeProvider(config.region)() || (() => {
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
})(),
};
};
function createAwsAuthSigv4HttpAuthOption(authParameters) {
return {
schemeId: "aws.auth#sigv4",
signingProperties: {
name: "bedrock",
region: authParameters.region,
},
propertiesExtractor: (config, context) => ({
signingProperties: {
config,
context,
},
}),
};
}
function createSmithyApiHttpBearerAuthHttpAuthOption(authParameters) {
return {
schemeId: "smithy.api#httpBearerAuth",
propertiesExtractor: ({ profile, filepath, configFilepath, ignoreCache, }, context) => ({
identityProperties: {
profile,
filepath,
configFilepath,
ignoreCache,
},
}),
};
}
export const defaultBedrockRuntimeHttpAuthSchemeProvider = (authParameters) => {
const options = [];
switch (authParameters.operation) {
default: {
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters));
}
}
return options;
};
export const resolveHttpAuthSchemeConfig = (config) => {
const token = memoizeIdentityProvider(config.token, isIdentityExpired, doesIdentityRequireRefresh);
const config_0 = resolveAwsSdkSigV4Config(config);
return Object.assign(config_0, {
authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),
token,
});
};

View File

@@ -0,0 +1,16 @@
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { ApplyGuardrail$ } from "../schemas/schemas_0";
export { $Command };
export class ApplyGuardrailCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "ApplyGuardrail", {})
.n("BedrockRuntimeClient", "ApplyGuardrailCommand")
.sc(ApplyGuardrail$)
.build() {
}

View File

@@ -0,0 +1,16 @@
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { Converse$ } from "../schemas/schemas_0";
export { $Command };
export class ConverseCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "Converse", {})
.n("BedrockRuntimeClient", "ConverseCommand")
.sc(Converse$)
.build() {
}

View File

@@ -0,0 +1,20 @@
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { ConverseStream$ } from "../schemas/schemas_0";
export { $Command };
export class ConverseStreamCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "ConverseStream", {
eventStream: {
output: true,
},
})
.n("BedrockRuntimeClient", "ConverseStreamCommand")
.sc(ConverseStream$)
.build() {
}

View File

@@ -0,0 +1,16 @@
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { CountTokens$ } from "../schemas/schemas_0";
export { $Command };
export class CountTokensCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "CountTokens", {})
.n("BedrockRuntimeClient", "CountTokensCommand")
.sc(CountTokens$)
.build() {
}

View File

@@ -0,0 +1,16 @@
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { GetAsyncInvoke$ } from "../schemas/schemas_0";
export { $Command };
export class GetAsyncInvokeCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "GetAsyncInvoke", {})
.n("BedrockRuntimeClient", "GetAsyncInvokeCommand")
.sc(GetAsyncInvoke$)
.build() {
}

View File

@@ -0,0 +1,16 @@
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { InvokeModel$ } from "../schemas/schemas_0";
export { $Command };
export class InvokeModelCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "InvokeModel", {})
.n("BedrockRuntimeClient", "InvokeModelCommand")
.sc(InvokeModel$)
.build() {
}

View File

@@ -0,0 +1,29 @@
import { getEventStreamPlugin } from "@aws-sdk/middleware-eventstream";
import { getWebSocketPlugin } from "@aws-sdk/middleware-websocket";
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { InvokeModelWithBidirectionalStream$ } from "../schemas/schemas_0";
export { $Command };
export class InvokeModelWithBidirectionalStreamCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
getEventStreamPlugin(config),
getWebSocketPlugin(config, {
headerPrefix: 'x-amz-bedrock-',
}),
];
})
.s("AmazonBedrockFrontendService", "InvokeModelWithBidirectionalStream", {
eventStream: {
input: true,
output: true,
},
})
.n("BedrockRuntimeClient", "InvokeModelWithBidirectionalStreamCommand")
.sc(InvokeModelWithBidirectionalStream$)
.build() {
}

View File

@@ -0,0 +1,20 @@
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { InvokeModelWithResponseStream$ } from "../schemas/schemas_0";
export { $Command };
export class InvokeModelWithResponseStreamCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "InvokeModelWithResponseStream", {
eventStream: {
output: true,
},
})
.n("BedrockRuntimeClient", "InvokeModelWithResponseStreamCommand")
.sc(InvokeModelWithResponseStream$)
.build() {
}

View File

@@ -0,0 +1,16 @@
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { ListAsyncInvokes$ } from "../schemas/schemas_0";
export { $Command };
export class ListAsyncInvokesCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "ListAsyncInvokes", {})
.n("BedrockRuntimeClient", "ListAsyncInvokesCommand")
.sc(ListAsyncInvokes$)
.build() {
}

View File

@@ -0,0 +1,16 @@
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { Command as $Command } from "@smithy/smithy-client";
import { commonParams } from "../endpoint/EndpointParameters";
import { StartAsyncInvoke$ } from "../schemas/schemas_0";
export { $Command };
export class StartAsyncInvokeCommand extends $Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "StartAsyncInvoke", {})
.n("BedrockRuntimeClient", "StartAsyncInvokeCommand")
.sc(StartAsyncInvoke$)
.build() {
}

View File

@@ -0,0 +1,10 @@
export * from "./ApplyGuardrailCommand";
export * from "./ConverseCommand";
export * from "./ConverseStreamCommand";
export * from "./CountTokensCommand";
export * from "./GetAsyncInvokeCommand";
export * from "./InvokeModelCommand";
export * from "./InvokeModelWithBidirectionalStreamCommand";
export * from "./InvokeModelWithResponseStreamCommand";
export * from "./ListAsyncInvokesCommand";
export * from "./StartAsyncInvokeCommand";

View File

@@ -0,0 +1,13 @@
export const resolveClientEndpointParameters = (options) => {
return Object.assign(options, {
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
useFipsEndpoint: options.useFipsEndpoint ?? false,
defaultSigningName: "bedrock",
});
};
export const commonParams = {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};

View File

@@ -0,0 +1,14 @@
import { awsEndpointFunctions } from "@aws-sdk/util-endpoints";
import { customEndpointFunctions, EndpointCache, resolveEndpoint } from "@smithy/util-endpoints";
import { ruleSet } from "./ruleset";
const cache = new EndpointCache({
size: 50,
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
});
export const defaultEndpointResolver = (endpointParams, context = {}) => {
return cache.get(endpointParams, () => resolveEndpoint(ruleSet, {
endpointParams: endpointParams,
logger: context.logger,
}));
};
customEndpointFunctions.aws = awsEndpointFunctions;

View File

@@ -0,0 +1,4 @@
const s = "required", t = "fn", u = "argv", v = "ref";
const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = { [s]: false, "type": "string" }, i = { [s]: true, "default": false, "type": "boolean" }, j = { [v]: "Endpoint" }, k = { [t]: c, [u]: [{ [v]: "UseFIPS" }, true] }, l = { [t]: c, [u]: [{ [v]: "UseDualStack" }, true] }, m = {}, n = { [t]: "getAttr", [u]: [{ [v]: g }, "supportsFIPS"] }, o = { [t]: c, [u]: [true, { [t]: "getAttr", [u]: [{ [v]: g }, "supportsDualStack"] }] }, p = [k], q = [l], r = [{ [v]: "Region" }];
const _data = { version: "1.0", parameters: { Region: h, UseDualStack: i, UseFIPS: i, Endpoint: h }, rules: [{ conditions: [{ [t]: b, [u]: [j] }], rules: [{ conditions: p, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { rules: [{ conditions: q, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: j, properties: m, headers: m }, type: e }], type: f }], type: f }, { rules: [{ conditions: [{ [t]: b, [u]: r }], rules: [{ conditions: [{ [t]: "aws.partition", [u]: r, assign: g }], rules: [{ conditions: [k, l], rules: [{ conditions: [{ [t]: c, [u]: [a, n] }, o], rules: [{ rules: [{ endpoint: { url: "https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: p, rules: [{ conditions: [{ [t]: c, [u]: [n, a] }], rules: [{ rules: [{ endpoint: { url: "https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: q, rules: [{ conditions: [o], rules: [{ rules: [{ endpoint: { url: "https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { rules: [{ endpoint: { url: "https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }], type: f }] };
export const ruleSet = _data;

View File

@@ -0,0 +1,9 @@
export * from "./BedrockRuntimeClient";
export * from "./BedrockRuntime";
export * from "./commands";
export * from "./schemas/schemas_0";
export * from "./pagination";
export * from "./models/enums";
export * from "./models/errors";
export * from "./models/models_0";
export { BedrockRuntimeServiceException } from "./models/BedrockRuntimeServiceException";

View File

@@ -0,0 +1,8 @@
import { ServiceException as __ServiceException, } from "@smithy/smithy-client";
export { __ServiceException };
export class BedrockRuntimeServiceException extends __ServiceException {
constructor(options) {
super(options);
Object.setPrototypeOf(this, BedrockRuntimeServiceException.prototype);
}
}

View File

@@ -0,0 +1,240 @@
export const AsyncInvokeStatus = {
COMPLETED: "Completed",
FAILED: "Failed",
IN_PROGRESS: "InProgress",
};
export const SortAsyncInvocationBy = {
SUBMISSION_TIME: "SubmissionTime",
};
export const SortOrder = {
ASCENDING: "Ascending",
DESCENDING: "Descending",
};
export const GuardrailImageFormat = {
JPEG: "jpeg",
PNG: "png",
};
export const GuardrailContentQualifier = {
GROUNDING_SOURCE: "grounding_source",
GUARD_CONTENT: "guard_content",
QUERY: "query",
};
export const GuardrailOutputScope = {
FULL: "FULL",
INTERVENTIONS: "INTERVENTIONS",
};
export const GuardrailContentSource = {
INPUT: "INPUT",
OUTPUT: "OUTPUT",
};
export const GuardrailAction = {
GUARDRAIL_INTERVENED: "GUARDRAIL_INTERVENED",
NONE: "NONE",
};
export const GuardrailOrigin = {
ACCOUNT_ENFORCED: "ACCOUNT_ENFORCED",
ORGANIZATION_ENFORCED: "ORGANIZATION_ENFORCED",
REQUEST: "REQUEST",
};
export const GuardrailOwnership = {
CROSS_ACCOUNT: "CROSS_ACCOUNT",
SELF: "SELF",
};
export const GuardrailAutomatedReasoningLogicWarningType = {
ALWAYS_FALSE: "ALWAYS_FALSE",
ALWAYS_TRUE: "ALWAYS_TRUE",
};
export const GuardrailContentPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
export const GuardrailContentFilterConfidence = {
HIGH: "HIGH",
LOW: "LOW",
MEDIUM: "MEDIUM",
NONE: "NONE",
};
export const GuardrailContentFilterStrength = {
HIGH: "HIGH",
LOW: "LOW",
MEDIUM: "MEDIUM",
NONE: "NONE",
};
export const GuardrailContentFilterType = {
HATE: "HATE",
INSULTS: "INSULTS",
MISCONDUCT: "MISCONDUCT",
PROMPT_ATTACK: "PROMPT_ATTACK",
SEXUAL: "SEXUAL",
VIOLENCE: "VIOLENCE",
};
export const GuardrailContextualGroundingPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
export const GuardrailContextualGroundingFilterType = {
GROUNDING: "GROUNDING",
RELEVANCE: "RELEVANCE",
};
export const GuardrailSensitiveInformationPolicyAction = {
ANONYMIZED: "ANONYMIZED",
BLOCKED: "BLOCKED",
NONE: "NONE",
};
export const GuardrailPiiEntityType = {
ADDRESS: "ADDRESS",
AGE: "AGE",
AWS_ACCESS_KEY: "AWS_ACCESS_KEY",
AWS_SECRET_KEY: "AWS_SECRET_KEY",
CA_HEALTH_NUMBER: "CA_HEALTH_NUMBER",
CA_SOCIAL_INSURANCE_NUMBER: "CA_SOCIAL_INSURANCE_NUMBER",
CREDIT_DEBIT_CARD_CVV: "CREDIT_DEBIT_CARD_CVV",
CREDIT_DEBIT_CARD_EXPIRY: "CREDIT_DEBIT_CARD_EXPIRY",
CREDIT_DEBIT_CARD_NUMBER: "CREDIT_DEBIT_CARD_NUMBER",
DRIVER_ID: "DRIVER_ID",
EMAIL: "EMAIL",
INTERNATIONAL_BANK_ACCOUNT_NUMBER: "INTERNATIONAL_BANK_ACCOUNT_NUMBER",
IP_ADDRESS: "IP_ADDRESS",
LICENSE_PLATE: "LICENSE_PLATE",
MAC_ADDRESS: "MAC_ADDRESS",
NAME: "NAME",
PASSWORD: "PASSWORD",
PHONE: "PHONE",
PIN: "PIN",
SWIFT_CODE: "SWIFT_CODE",
UK_NATIONAL_HEALTH_SERVICE_NUMBER: "UK_NATIONAL_HEALTH_SERVICE_NUMBER",
UK_NATIONAL_INSURANCE_NUMBER: "UK_NATIONAL_INSURANCE_NUMBER",
UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER: "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
URL: "URL",
USERNAME: "USERNAME",
US_BANK_ACCOUNT_NUMBER: "US_BANK_ACCOUNT_NUMBER",
US_BANK_ROUTING_NUMBER: "US_BANK_ROUTING_NUMBER",
US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER: "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
US_PASSPORT_NUMBER: "US_PASSPORT_NUMBER",
US_SOCIAL_SECURITY_NUMBER: "US_SOCIAL_SECURITY_NUMBER",
VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER",
};
export const GuardrailTopicPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
export const GuardrailTopicType = {
DENY: "DENY",
};
export const GuardrailWordPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
export const GuardrailManagedWordType = {
PROFANITY: "PROFANITY",
};
export const GuardrailTrace = {
DISABLED: "disabled",
ENABLED: "enabled",
ENABLED_FULL: "enabled_full",
};
export const AudioFormat = {
AAC: "aac",
FLAC: "flac",
M4A: "m4a",
MKA: "mka",
MKV: "mkv",
MP3: "mp3",
MP4: "mp4",
MPEG: "mpeg",
MPGA: "mpga",
OGG: "ogg",
OPUS: "opus",
PCM: "pcm",
WAV: "wav",
WEBM: "webm",
X_AAC: "x-aac",
};
export const CacheTTL = {
FIVE_MINUTES: "5m",
ONE_HOUR: "1h",
};
export const CachePointType = {
DEFAULT: "default",
};
export const DocumentFormat = {
CSV: "csv",
DOC: "doc",
DOCX: "docx",
HTML: "html",
MD: "md",
PDF: "pdf",
TXT: "txt",
XLS: "xls",
XLSX: "xlsx",
};
export const GuardrailConverseImageFormat = {
JPEG: "jpeg",
PNG: "png",
};
export const GuardrailConverseContentQualifier = {
GROUNDING_SOURCE: "grounding_source",
GUARD_CONTENT: "guard_content",
QUERY: "query",
};
export const ImageFormat = {
GIF: "gif",
JPEG: "jpeg",
PNG: "png",
WEBP: "webp",
};
export const VideoFormat = {
FLV: "flv",
MKV: "mkv",
MOV: "mov",
MP4: "mp4",
MPEG: "mpeg",
MPG: "mpg",
THREE_GP: "three_gp",
WEBM: "webm",
WMV: "wmv",
};
export const ToolResultStatus = {
ERROR: "error",
SUCCESS: "success",
};
export const ToolUseType = {
SERVER_TOOL_USE: "server_tool_use",
};
export const ConversationRole = {
ASSISTANT: "assistant",
USER: "user",
};
export const OutputFormatType = {
JSON_SCHEMA: "json_schema",
};
export const PerformanceConfigLatency = {
OPTIMIZED: "optimized",
STANDARD: "standard",
};
export const ServiceTierType = {
DEFAULT: "default",
FLEX: "flex",
PRIORITY: "priority",
RESERVED: "reserved",
};
export const StopReason = {
CONTENT_FILTERED: "content_filtered",
END_TURN: "end_turn",
GUARDRAIL_INTERVENED: "guardrail_intervened",
MALFORMED_MODEL_OUTPUT: "malformed_model_output",
MALFORMED_TOOL_USE: "malformed_tool_use",
MAX_TOKENS: "max_tokens",
MODEL_CONTEXT_WINDOW_EXCEEDED: "model_context_window_exceeded",
STOP_SEQUENCE: "stop_sequence",
TOOL_USE: "tool_use",
};
export const GuardrailStreamProcessingMode = {
ASYNC: "async",
SYNC: "sync",
};
export const Trace = {
DISABLED: "DISABLED",
ENABLED: "ENABLED",
ENABLED_FULL: "ENABLED_FULL",
};

View File

@@ -0,0 +1,154 @@
import { BedrockRuntimeServiceException as __BaseException } from "./BedrockRuntimeServiceException";
export class AccessDeniedException extends __BaseException {
name = "AccessDeniedException";
$fault = "client";
constructor(opts) {
super({
name: "AccessDeniedException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, AccessDeniedException.prototype);
}
}
export class InternalServerException extends __BaseException {
name = "InternalServerException";
$fault = "server";
constructor(opts) {
super({
name: "InternalServerException",
$fault: "server",
...opts,
});
Object.setPrototypeOf(this, InternalServerException.prototype);
}
}
export class ThrottlingException extends __BaseException {
name = "ThrottlingException";
$fault = "client";
constructor(opts) {
super({
name: "ThrottlingException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ThrottlingException.prototype);
}
}
export class ValidationException extends __BaseException {
name = "ValidationException";
$fault = "client";
constructor(opts) {
super({
name: "ValidationException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ValidationException.prototype);
}
}
export class ConflictException extends __BaseException {
name = "ConflictException";
$fault = "client";
constructor(opts) {
super({
name: "ConflictException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ConflictException.prototype);
}
}
export class ResourceNotFoundException extends __BaseException {
name = "ResourceNotFoundException";
$fault = "client";
constructor(opts) {
super({
name: "ResourceNotFoundException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
}
}
export class ServiceQuotaExceededException extends __BaseException {
name = "ServiceQuotaExceededException";
$fault = "client";
constructor(opts) {
super({
name: "ServiceQuotaExceededException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype);
}
}
export class ServiceUnavailableException extends __BaseException {
name = "ServiceUnavailableException";
$fault = "server";
constructor(opts) {
super({
name: "ServiceUnavailableException",
$fault: "server",
...opts,
});
Object.setPrototypeOf(this, ServiceUnavailableException.prototype);
}
}
export class ModelErrorException extends __BaseException {
name = "ModelErrorException";
$fault = "client";
originalStatusCode;
resourceName;
constructor(opts) {
super({
name: "ModelErrorException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelErrorException.prototype);
this.originalStatusCode = opts.originalStatusCode;
this.resourceName = opts.resourceName;
}
}
export class ModelNotReadyException extends __BaseException {
name = "ModelNotReadyException";
$fault = "client";
$retryable = {};
constructor(opts) {
super({
name: "ModelNotReadyException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelNotReadyException.prototype);
}
}
export class ModelTimeoutException extends __BaseException {
name = "ModelTimeoutException";
$fault = "client";
constructor(opts) {
super({
name: "ModelTimeoutException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelTimeoutException.prototype);
}
}
export class ModelStreamErrorException extends __BaseException {
name = "ModelStreamErrorException";
$fault = "client";
originalStatusCode;
originalMessage;
constructor(opts) {
super({
name: "ModelStreamErrorException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelStreamErrorException.prototype);
this.originalStatusCode = opts.originalStatusCode;
this.originalMessage = opts.originalMessage;
}
}

View File

@@ -0,0 +1,4 @@
import { createPaginator } from "@smithy/core";
import { BedrockRuntimeClient } from "../BedrockRuntimeClient";
import { ListAsyncInvokesCommand, } from "../commands/ListAsyncInvokesCommand";
export const paginateListAsyncInvokes = createPaginator(BedrockRuntimeClient, ListAsyncInvokesCommand, "nextToken", "nextToken", "maxResults");

View File

@@ -0,0 +1,2 @@
export * from "./Interfaces";
export * from "./ListAsyncInvokesPaginator";

View File

@@ -0,0 +1,38 @@
import packageInfo from "../package.json";
import { Sha256 } from "@aws-crypto/sha256-browser";
import { eventStreamPayloadHandlerProvider, WebSocketFetchHandler as WebSocketRequestHandler, } from "@aws-sdk/middleware-websocket";
import { createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-browser";
import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
import { eventStreamSerdeProvider } from "@smithy/eventstream-serde-browser";
import { FetchHttpHandler as HttpRequestHandler, streamCollector } from "@smithy/fetch-http-handler";
import { invalidProvider } from "@smithy/invalid-dependency";
import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
import { calculateBodyLength } from "@smithy/util-body-length-browser";
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-browser";
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@smithy/util-retry";
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
export const getRuntimeConfig = (config) => {
const defaultsMode = resolveDefaultsModeConfig(config);
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
const clientSharedValues = getSharedRuntimeConfig(config);
return {
...clientSharedValues,
...config,
runtime: "browser",
defaultsMode,
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventStreamPayloadHandlerProvider,
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventStreamSerdeProvider,
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
region: config?.region ?? invalidProvider("Region is missing"),
requestHandler: WebSocketRequestHandler.create(config?.requestHandler
?? defaultConfigProvider, HttpRequestHandler.create(defaultConfigProvider)),
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
sha256: config?.sha256 ?? Sha256,
streamCollector: config?.streamCollector ?? streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
};
};

View File

@@ -0,0 +1,78 @@
import packageInfo from "../package.json";
import { emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core/client";
import { AwsSdkSigV4Signer, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS } from "@aws-sdk/core/httpAuthSchemes";
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
import { eventStreamPayloadHandlerProvider } from "@aws-sdk/eventstream-handler-node";
import { fromEnvSigningName, nodeProvider } from "@aws-sdk/token-providers";
import { createDefaultUserAgentProvider, NODE_APP_ID_CONFIG_OPTIONS } from "@aws-sdk/util-user-agent-node";
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
import { HttpBearerAuthSigner } from "@smithy/core";
import { eventStreamSerdeProvider } from "@smithy/eventstream-serde-node";
import { Hash } from "@smithy/hash-node";
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
import { NodeHttp2Handler as RequestHandler, streamCollector } from "@smithy/node-http-handler";
import { emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode } from "@smithy/smithy-client";
import { calculateBodyLength } from "@smithy/util-body-length-node";
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-node";
import { DEFAULT_RETRY_MODE } from "@smithy/util-retry";
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
export const getRuntimeConfig = (config) => {
emitWarningIfUnsupportedVersion(process.version);
const defaultsMode = resolveDefaultsModeConfig(config);
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
const clientSharedValues = getSharedRuntimeConfig(config);
awsCheckVersion(process.version);
const loaderConfig = {
profile: config?.profile,
logger: clientSharedValues.logger,
signingName: "bedrock",
};
return {
...clientSharedValues,
...config,
runtime: "node",
defaultsMode,
authSchemePreference: config?.authSchemePreference ?? loadNodeConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
credentialDefaultProvider: config?.credentialDefaultProvider ?? credentialDefaultProvider,
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventStreamPayloadHandlerProvider,
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventStreamSerdeProvider,
httpAuthSchemes: config?.httpAuthSchemes ?? [
{
schemeId: "aws.auth#sigv4",
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
signer: new AwsSdkSigV4Signer(),
},
{
schemeId: "smithy.api#httpBearerAuth",
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth") || (async (idProps) => {
try {
return await fromEnvSigningName({ signingName: "bedrock" })();
}
catch (error) {
return await nodeProvider(idProps)(idProps);
}
}),
signer: new HttpBearerAuthSigner(),
},
],
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
requestHandler: RequestHandler.create(config?.requestHandler ?? (async () => ({
...await defaultConfigProvider(),
disableConcurrentStreams: true
}))),
retryMode: config?.retryMode ??
loadNodeConfig({
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
}, config),
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
};
};

View File

@@ -0,0 +1,15 @@
import { Sha256 } from "@aws-crypto/sha256-js";
import { invalidFunction } from "@smithy/invalid-dependency";
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
export const getRuntimeConfig = (config) => {
const browserDefaults = getBrowserRuntimeConfig(config);
return {
...browserDefaults,
...config,
runtime: "react-native",
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? (() => ({
handle: invalidFunction("event stream request is not supported in ReactNative."),
})),
sha256: config?.sha256 ?? Sha256,
};
};

View File

@@ -0,0 +1,45 @@
import { AwsSdkSigV4Signer } from "@aws-sdk/core/httpAuthSchemes";
import { AwsRestJsonProtocol } from "@aws-sdk/core/protocols";
import { HttpBearerAuthSigner } from "@smithy/core";
import { NoOpLogger } from "@smithy/smithy-client";
import { parseUrl } from "@smithy/url-parser";
import { fromBase64, toBase64 } from "@smithy/util-base64";
import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
import { defaultBedrockRuntimeHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
import { defaultEndpointResolver } from "./endpoint/endpointResolver";
import { errorTypeRegistries } from "./schemas/schemas_0";
export const getRuntimeConfig = (config) => {
return {
apiVersion: "2023-09-30",
base64Decoder: config?.base64Decoder ?? fromBase64,
base64Encoder: config?.base64Encoder ?? toBase64,
disableHostPrefix: config?.disableHostPrefix ?? false,
endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
extensions: config?.extensions ?? [],
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultBedrockRuntimeHttpAuthSchemeProvider,
httpAuthSchemes: config?.httpAuthSchemes ?? [
{
schemeId: "aws.auth#sigv4",
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
signer: new AwsSdkSigV4Signer(),
},
{
schemeId: "smithy.api#httpBearerAuth",
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth"),
signer: new HttpBearerAuthSigner(),
},
],
logger: config?.logger ?? new NoOpLogger(),
protocol: config?.protocol ?? AwsRestJsonProtocol,
protocolSettings: config?.protocolSettings ?? {
defaultNamespace: "com.amazonaws.bedrockruntime",
errorTypeRegistries,
version: "2023-09-30",
serviceTarget: "AmazonBedrockFrontendService",
},
serviceId: config?.serviceId ?? "Bedrock Runtime",
urlParser: config?.urlParser ?? parseUrl,
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
utf8Encoder: config?.utf8Encoder ?? toUtf8,
};
};

View File

@@ -0,0 +1,9 @@
import { getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, } from "@aws-sdk/region-config-resolver";
import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http";
import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client";
import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration";
export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
const extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
extensions.forEach((extension) => extension.configure(extensionConfiguration));
return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
};

View File

@@ -0,0 +1,88 @@
import type { HttpHandlerOptions as __HttpHandlerOptions, PaginationConfiguration, Paginator } from "@smithy/types";
import { BedrockRuntimeClient } from "./BedrockRuntimeClient";
import { type ApplyGuardrailCommandInput, type ApplyGuardrailCommandOutput } from "./commands/ApplyGuardrailCommand";
import { type ConverseCommandInput, type ConverseCommandOutput } from "./commands/ConverseCommand";
import { type ConverseStreamCommandInput, type ConverseStreamCommandOutput } from "./commands/ConverseStreamCommand";
import { type CountTokensCommandInput, type CountTokensCommandOutput } from "./commands/CountTokensCommand";
import { type GetAsyncInvokeCommandInput, type GetAsyncInvokeCommandOutput } from "./commands/GetAsyncInvokeCommand";
import { type InvokeModelCommandInput, type InvokeModelCommandOutput } from "./commands/InvokeModelCommand";
import { type InvokeModelWithBidirectionalStreamCommandInput, type InvokeModelWithBidirectionalStreamCommandOutput } from "./commands/InvokeModelWithBidirectionalStreamCommand";
import { type InvokeModelWithResponseStreamCommandInput, type InvokeModelWithResponseStreamCommandOutput } from "./commands/InvokeModelWithResponseStreamCommand";
import { type ListAsyncInvokesCommandInput, type ListAsyncInvokesCommandOutput } from "./commands/ListAsyncInvokesCommand";
import { type StartAsyncInvokeCommandInput, type StartAsyncInvokeCommandOutput } from "./commands/StartAsyncInvokeCommand";
export interface BedrockRuntime {
/**
* @see {@link ApplyGuardrailCommand}
*/
applyGuardrail(args: ApplyGuardrailCommandInput, options?: __HttpHandlerOptions): Promise<ApplyGuardrailCommandOutput>;
applyGuardrail(args: ApplyGuardrailCommandInput, cb: (err: any, data?: ApplyGuardrailCommandOutput) => void): void;
applyGuardrail(args: ApplyGuardrailCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ApplyGuardrailCommandOutput) => void): void;
/**
* @see {@link ConverseCommand}
*/
converse(args: ConverseCommandInput, options?: __HttpHandlerOptions): Promise<ConverseCommandOutput>;
converse(args: ConverseCommandInput, cb: (err: any, data?: ConverseCommandOutput) => void): void;
converse(args: ConverseCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ConverseCommandOutput) => void): void;
/**
* @see {@link ConverseStreamCommand}
*/
converseStream(args: ConverseStreamCommandInput, options?: __HttpHandlerOptions): Promise<ConverseStreamCommandOutput>;
converseStream(args: ConverseStreamCommandInput, cb: (err: any, data?: ConverseStreamCommandOutput) => void): void;
converseStream(args: ConverseStreamCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ConverseStreamCommandOutput) => void): void;
/**
* @see {@link CountTokensCommand}
*/
countTokens(args: CountTokensCommandInput, options?: __HttpHandlerOptions): Promise<CountTokensCommandOutput>;
countTokens(args: CountTokensCommandInput, cb: (err: any, data?: CountTokensCommandOutput) => void): void;
countTokens(args: CountTokensCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: CountTokensCommandOutput) => void): void;
/**
* @see {@link GetAsyncInvokeCommand}
*/
getAsyncInvoke(args: GetAsyncInvokeCommandInput, options?: __HttpHandlerOptions): Promise<GetAsyncInvokeCommandOutput>;
getAsyncInvoke(args: GetAsyncInvokeCommandInput, cb: (err: any, data?: GetAsyncInvokeCommandOutput) => void): void;
getAsyncInvoke(args: GetAsyncInvokeCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetAsyncInvokeCommandOutput) => void): void;
/**
* @see {@link InvokeModelCommand}
*/
invokeModel(args: InvokeModelCommandInput, options?: __HttpHandlerOptions): Promise<InvokeModelCommandOutput>;
invokeModel(args: InvokeModelCommandInput, cb: (err: any, data?: InvokeModelCommandOutput) => void): void;
invokeModel(args: InvokeModelCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: InvokeModelCommandOutput) => void): void;
/**
* @see {@link InvokeModelWithBidirectionalStreamCommand}
*/
invokeModelWithBidirectionalStream(args: InvokeModelWithBidirectionalStreamCommandInput, options?: __HttpHandlerOptions): Promise<InvokeModelWithBidirectionalStreamCommandOutput>;
invokeModelWithBidirectionalStream(args: InvokeModelWithBidirectionalStreamCommandInput, cb: (err: any, data?: InvokeModelWithBidirectionalStreamCommandOutput) => void): void;
invokeModelWithBidirectionalStream(args: InvokeModelWithBidirectionalStreamCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: InvokeModelWithBidirectionalStreamCommandOutput) => void): void;
/**
* @see {@link InvokeModelWithResponseStreamCommand}
*/
invokeModelWithResponseStream(args: InvokeModelWithResponseStreamCommandInput, options?: __HttpHandlerOptions): Promise<InvokeModelWithResponseStreamCommandOutput>;
invokeModelWithResponseStream(args: InvokeModelWithResponseStreamCommandInput, cb: (err: any, data?: InvokeModelWithResponseStreamCommandOutput) => void): void;
invokeModelWithResponseStream(args: InvokeModelWithResponseStreamCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: InvokeModelWithResponseStreamCommandOutput) => void): void;
/**
* @see {@link ListAsyncInvokesCommand}
*/
listAsyncInvokes(): Promise<ListAsyncInvokesCommandOutput>;
listAsyncInvokes(args: ListAsyncInvokesCommandInput, options?: __HttpHandlerOptions): Promise<ListAsyncInvokesCommandOutput>;
listAsyncInvokes(args: ListAsyncInvokesCommandInput, cb: (err: any, data?: ListAsyncInvokesCommandOutput) => void): void;
listAsyncInvokes(args: ListAsyncInvokesCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ListAsyncInvokesCommandOutput) => void): void;
/**
* @see {@link StartAsyncInvokeCommand}
*/
startAsyncInvoke(args: StartAsyncInvokeCommandInput, options?: __HttpHandlerOptions): Promise<StartAsyncInvokeCommandOutput>;
startAsyncInvoke(args: StartAsyncInvokeCommandInput, cb: (err: any, data?: StartAsyncInvokeCommandOutput) => void): void;
startAsyncInvoke(args: StartAsyncInvokeCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: StartAsyncInvokeCommandOutput) => void): void;
/**
* @see {@link ListAsyncInvokesCommand}
* @param args - command input.
* @param paginationConfig - optional pagination config.
* @returns AsyncIterable of {@link ListAsyncInvokesCommandOutput}.
*/
paginateListAsyncInvokes(args?: ListAsyncInvokesCommandInput, paginationConfig?: Omit<PaginationConfiguration, "client">): Paginator<ListAsyncInvokesCommandOutput>;
}
/**
* <p>Describes the API operations for running inference using Amazon Bedrock models.</p>
* @public
*/
export declare class BedrockRuntime extends BedrockRuntimeClient implements BedrockRuntime {
}

View File

@@ -0,0 +1,210 @@
import { type EventStreamInputConfig, type EventStreamResolvedConfig } from "@aws-sdk/middleware-eventstream";
import { type HostHeaderInputConfig, type HostHeaderResolvedConfig } from "@aws-sdk/middleware-host-header";
import { type UserAgentInputConfig, type UserAgentResolvedConfig } from "@aws-sdk/middleware-user-agent";
import { type WebSocketInputConfig, type WebSocketResolvedConfig } from "@aws-sdk/middleware-websocket";
import { EventStreamPayloadHandlerProvider as __EventStreamPayloadHandlerProvider } from "@aws-sdk/types";
import { type RegionInputConfig, type RegionResolvedConfig } from "@smithy/config-resolver";
import { type EventStreamSerdeInputConfig, type EventStreamSerdeResolvedConfig } from "@smithy/eventstream-serde-config-resolver";
import { type EndpointInputConfig, type EndpointResolvedConfig } from "@smithy/middleware-endpoint";
import { type RetryInputConfig, type RetryResolvedConfig } from "@smithy/middleware-retry";
import type { HttpHandlerUserInput as __HttpHandlerUserInput } from "@smithy/protocol-http";
import { type DefaultsMode as __DefaultsMode, type SmithyConfiguration as __SmithyConfiguration, type SmithyResolvedConfiguration as __SmithyResolvedConfiguration, Client as __Client } from "@smithy/smithy-client";
import type { AwsCredentialIdentityProvider, BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, Decoder as __Decoder, Encoder as __Encoder, EventStreamSerdeProvider as __EventStreamSerdeProvider, HashConstructor as __HashConstructor, HttpHandlerOptions as __HttpHandlerOptions, Logger as __Logger, Provider as __Provider, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent } from "@smithy/types";
import { type HttpAuthSchemeInputConfig, type HttpAuthSchemeResolvedConfig } from "./auth/httpAuthSchemeProvider";
import type { ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput } from "./commands/ApplyGuardrailCommand";
import type { ConverseCommandInput, ConverseCommandOutput } from "./commands/ConverseCommand";
import type { ConverseStreamCommandInput, ConverseStreamCommandOutput } from "./commands/ConverseStreamCommand";
import type { CountTokensCommandInput, CountTokensCommandOutput } from "./commands/CountTokensCommand";
import type { GetAsyncInvokeCommandInput, GetAsyncInvokeCommandOutput } from "./commands/GetAsyncInvokeCommand";
import type { InvokeModelCommandInput, InvokeModelCommandOutput } from "./commands/InvokeModelCommand";
import type { InvokeModelWithBidirectionalStreamCommandInput, InvokeModelWithBidirectionalStreamCommandOutput } from "./commands/InvokeModelWithBidirectionalStreamCommand";
import type { InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput } from "./commands/InvokeModelWithResponseStreamCommand";
import type { ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput } from "./commands/ListAsyncInvokesCommand";
import type { StartAsyncInvokeCommandInput, StartAsyncInvokeCommandOutput } from "./commands/StartAsyncInvokeCommand";
import { type ClientInputEndpointParameters, type ClientResolvedEndpointParameters, type EndpointParameters } from "./endpoint/EndpointParameters";
import { type RuntimeExtension, type RuntimeExtensionsConfig } from "./runtimeExtensions";
export { __Client };
/**
* @public
*/
export type ServiceInputTypes = ApplyGuardrailCommandInput | ConverseCommandInput | ConverseStreamCommandInput | CountTokensCommandInput | GetAsyncInvokeCommandInput | InvokeModelCommandInput | InvokeModelWithBidirectionalStreamCommandInput | InvokeModelWithResponseStreamCommandInput | ListAsyncInvokesCommandInput | StartAsyncInvokeCommandInput;
/**
* @public
*/
export type ServiceOutputTypes = ApplyGuardrailCommandOutput | ConverseCommandOutput | ConverseStreamCommandOutput | CountTokensCommandOutput | GetAsyncInvokeCommandOutput | InvokeModelCommandOutput | InvokeModelWithBidirectionalStreamCommandOutput | InvokeModelWithResponseStreamCommandOutput | ListAsyncInvokesCommandOutput | StartAsyncInvokeCommandOutput;
/**
* @public
*/
export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHandlerOptions>> {
/**
* The HTTP handler to use or its constructor options. Fetch in browser and Https in Nodejs.
*/
requestHandler?: __HttpHandlerUserInput;
/**
* A constructor for a class implementing the {@link @smithy/types#ChecksumConstructor} interface
* that computes the SHA-256 HMAC or checksum of a string or binary buffer.
* @internal
*/
sha256?: __ChecksumConstructor | __HashConstructor;
/**
* The function that will be used to convert strings into HTTP endpoints.
* @internal
*/
urlParser?: __UrlParser;
/**
* A function that can calculate the length of a request body.
* @internal
*/
bodyLengthChecker?: __BodyLengthCalculator;
/**
* A function that converts a stream into an array of bytes.
* @internal
*/
streamCollector?: __StreamCollector;
/**
* The function that will be used to convert a base64-encoded string to a byte array.
* @internal
*/
base64Decoder?: __Decoder;
/**
* The function that will be used to convert binary data to a base64-encoded string.
* @internal
*/
base64Encoder?: __Encoder;
/**
* The function that will be used to convert a UTF8-encoded string to a byte array.
* @internal
*/
utf8Decoder?: __Decoder;
/**
* The function that will be used to convert binary data to a UTF-8 encoded string.
* @internal
*/
utf8Encoder?: __Encoder;
/**
* The runtime environment.
* @internal
*/
runtime?: string;
/**
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
/**
* Unique service identifier.
* @internal
*/
serviceId?: string;
/**
* Enables IPv6/IPv4 dualstack endpoint.
*/
useDualstackEndpoint?: boolean | __Provider<boolean>;
/**
* Enables FIPS compatible endpoints.
*/
useFipsEndpoint?: boolean | __Provider<boolean>;
/**
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;
/**
* Setting a client profile is similar to setting a value for the
* AWS_PROFILE environment variable. Setting a profile on a client
* in code only affects the single client instance, unlike AWS_PROFILE.
*
* When set, and only for environments where an AWS configuration
* file exists, fields configurable by this file will be retrieved
* from the specified profile within that file.
* Conflicting code configuration and environment variables will
* still have higher priority.
*
* For client credential resolution that involves checking the AWS
* configuration file, the client's profile (this value) will be
* used unless a different profile is set in the credential
* provider options.
*
*/
profile?: string;
/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
*/
defaultUserAgentProvider?: __Provider<__UserAgent>;
/**
* Default credentials provider; Not available in browser runtime.
* @deprecated
* @internal
*/
credentialDefaultProvider?: (input: any) => AwsCredentialIdentityProvider;
/**
* Value for how many times a request will be made at most in case of retry.
*/
maxAttempts?: number | __Provider<number>;
/**
* Specifies which retry algorithm to use.
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-smithy-util-retry/Enum/RETRY_MODES/
*
*/
retryMode?: string | __Provider<string>;
/**
* Optional logger for logging debug/info/warn/error.
*/
logger?: __Logger;
/**
* Optional extensions
*/
extensions?: RuntimeExtension[];
/**
* The function that provides necessary utilities for generating and parsing event stream
*/
eventStreamSerdeProvider?: __EventStreamSerdeProvider;
/**
* The {@link @smithy/smithy-client#DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK.
*/
defaultsMode?: __DefaultsMode | __Provider<__DefaultsMode>;
/**
* The function that provides necessary utilities for handling request event stream.
* @internal
*/
eventStreamPayloadHandlerProvider?: __EventStreamPayloadHandlerProvider;
}
/**
* @public
*/
export type BedrockRuntimeClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults & UserAgentInputConfig & RetryInputConfig & RegionInputConfig & HostHeaderInputConfig & EndpointInputConfig<EndpointParameters> & EventStreamSerdeInputConfig & HttpAuthSchemeInputConfig & EventStreamInputConfig & WebSocketInputConfig & ClientInputEndpointParameters;
/**
* @public
*
* The configuration interface of BedrockRuntimeClient class constructor that set the region, credentials and other options.
*/
export interface BedrockRuntimeClientConfig extends BedrockRuntimeClientConfigType {
}
/**
* @public
*/
export type BedrockRuntimeClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RuntimeExtensionsConfig & UserAgentResolvedConfig & RetryResolvedConfig & RegionResolvedConfig & HostHeaderResolvedConfig & EndpointResolvedConfig<EndpointParameters> & EventStreamSerdeResolvedConfig & HttpAuthSchemeResolvedConfig & EventStreamResolvedConfig & WebSocketResolvedConfig & ClientResolvedEndpointParameters;
/**
* @public
*
* The resolved configuration interface of BedrockRuntimeClient class. This is resolved and normalized from the {@link BedrockRuntimeClientConfig | constructor configuration interface}.
*/
export interface BedrockRuntimeClientResolvedConfig extends BedrockRuntimeClientResolvedConfigType {
}
/**
* <p>Describes the API operations for running inference using Amazon Bedrock models.</p>
* @public
*/
export declare class BedrockRuntimeClient extends __Client<__HttpHandlerOptions, ServiceInputTypes, ServiceOutputTypes, BedrockRuntimeClientResolvedConfig> {
/**
* The resolved configuration of BedrockRuntimeClient class. This is resolved and normalized from the {@link BedrockRuntimeClientConfig | constructor configuration interface}.
*/
readonly config: BedrockRuntimeClientResolvedConfig;
constructor(...[configuration]: __CheckOptionalClientConfig<BedrockRuntimeClientConfig>);
/**
* Destroy underlying resources, like sockets. It's usually not necessary to do this.
* However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
* Otherwise, sockets might stay open for quite a long time before the server terminates them.
*/
destroy(): void;
}

View File

@@ -0,0 +1,32 @@
import { type AwsCredentialIdentity, type AwsCredentialIdentityProvider, type HttpAuthScheme, TokenIdentity, TokenIdentityProvider } from "@smithy/types";
import type { BedrockRuntimeHttpAuthSchemeProvider } from "./httpAuthSchemeProvider";
/**
* @internal
*/
export interface HttpAuthExtensionConfiguration {
setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void;
httpAuthSchemes(): HttpAuthScheme[];
setHttpAuthSchemeProvider(httpAuthSchemeProvider: BedrockRuntimeHttpAuthSchemeProvider): void;
httpAuthSchemeProvider(): BedrockRuntimeHttpAuthSchemeProvider;
setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void;
credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined;
setToken(token: TokenIdentity | TokenIdentityProvider): void;
token(): TokenIdentity | TokenIdentityProvider | undefined;
}
/**
* @internal
*/
export type HttpAuthRuntimeConfig = Partial<{
httpAuthSchemes: HttpAuthScheme[];
httpAuthSchemeProvider: BedrockRuntimeHttpAuthSchemeProvider;
credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider;
token: TokenIdentity | TokenIdentityProvider;
}>;
/**
* @internal
*/
export declare const getHttpAuthExtensionConfiguration: (runtimeConfig: HttpAuthRuntimeConfig) => HttpAuthExtensionConfiguration;
/**
* @internal
*/
export declare const resolveHttpAuthRuntimeConfig: (config: HttpAuthExtensionConfiguration) => HttpAuthRuntimeConfig;

View File

@@ -0,0 +1,83 @@
import { AwsSdkSigV4AuthInputConfig, AwsSdkSigV4AuthResolvedConfig, AwsSdkSigV4PreviouslyResolved } from "@aws-sdk/core/httpAuthSchemes";
import { type HandlerExecutionContext, type HttpAuthScheme, type HttpAuthSchemeParameters, type HttpAuthSchemeParametersProvider, type HttpAuthSchemeProvider, type Provider, TokenIdentity, TokenIdentityProvider } from "@smithy/types";
import { type BedrockRuntimeClientResolvedConfig } from "../BedrockRuntimeClient";
/**
* @internal
*/
export interface BedrockRuntimeHttpAuthSchemeParameters extends HttpAuthSchemeParameters {
region?: string;
}
/**
* @internal
*/
export interface BedrockRuntimeHttpAuthSchemeParametersProvider extends HttpAuthSchemeParametersProvider<BedrockRuntimeClientResolvedConfig, HandlerExecutionContext, BedrockRuntimeHttpAuthSchemeParameters, object> {
}
/**
* @internal
*/
export declare const defaultBedrockRuntimeHttpAuthSchemeParametersProvider: (config: BedrockRuntimeClientResolvedConfig, context: HandlerExecutionContext, input: object) => Promise<BedrockRuntimeHttpAuthSchemeParameters>;
/**
* @internal
*/
export interface BedrockRuntimeHttpAuthSchemeProvider extends HttpAuthSchemeProvider<BedrockRuntimeHttpAuthSchemeParameters> {
}
/**
* @internal
*/
export declare const defaultBedrockRuntimeHttpAuthSchemeProvider: BedrockRuntimeHttpAuthSchemeProvider;
/**
* @public
*/
export interface HttpAuthSchemeInputConfig extends AwsSdkSigV4AuthInputConfig {
/**
* A comma-separated list of case-sensitive auth scheme names.
* An auth scheme name is a fully qualified auth scheme ID with the namespace prefix trimmed.
* For example, the auth scheme with ID aws.auth#sigv4 is named sigv4.
* @public
*/
authSchemePreference?: string[] | Provider<string[]>;
/**
* Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme.
* @internal
*/
httpAuthSchemes?: HttpAuthScheme[];
/**
* Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use.
* @internal
*/
httpAuthSchemeProvider?: BedrockRuntimeHttpAuthSchemeProvider;
/**
* The token used to authenticate requests.
*/
token?: TokenIdentity | TokenIdentityProvider;
}
/**
* @internal
*/
export interface HttpAuthSchemeResolvedConfig extends AwsSdkSigV4AuthResolvedConfig {
/**
* A comma-separated list of case-sensitive auth scheme names.
* An auth scheme name is a fully qualified auth scheme ID with the namespace prefix trimmed.
* For example, the auth scheme with ID aws.auth#sigv4 is named sigv4.
* @public
*/
readonly authSchemePreference: Provider<string[]>;
/**
* Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme.
* @internal
*/
readonly httpAuthSchemes: HttpAuthScheme[];
/**
* Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use.
* @internal
*/
readonly httpAuthSchemeProvider: BedrockRuntimeHttpAuthSchemeProvider;
/**
* The token used to authenticate requests.
*/
readonly token?: TokenIdentityProvider;
}
/**
* @internal
*/
export declare const resolveHttpAuthSchemeConfig: <T>(config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved) => T & HttpAuthSchemeResolvedConfig;

View File

@@ -0,0 +1,402 @@
import { Command as $Command } from "@smithy/smithy-client";
import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import type { ApplyGuardrailRequest, ApplyGuardrailResponse } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link ApplyGuardrailCommand}.
*/
export interface ApplyGuardrailCommandInput extends ApplyGuardrailRequest {
}
/**
* @public
*
* The output of {@link ApplyGuardrailCommand}.
*/
export interface ApplyGuardrailCommandOutput extends ApplyGuardrailResponse, __MetadataBearer {
}
declare const ApplyGuardrailCommand_base: {
new (input: ApplyGuardrailCommandInput): import("@smithy/smithy-client").CommandImpl<ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (input: ApplyGuardrailCommandInput): import("@smithy/smithy-client").CommandImpl<ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>The action to apply a guardrail.</p> <p>For troubleshooting some of the common errors you might encounter when using the <code>ApplyGuardrail</code> API, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html">Troubleshooting Amazon Bedrock API Error Codes</a> in the Amazon Bedrock User Guide</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockRuntimeClient, ApplyGuardrailCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
* // const { BedrockRuntimeClient, ApplyGuardrailCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
* // import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
* const config = {}; // type is BedrockRuntimeClientConfig
* const client = new BedrockRuntimeClient(config);
* const input = { // ApplyGuardrailRequest
* guardrailIdentifier: "STRING_VALUE", // required
* guardrailVersion: "STRING_VALUE", // required
* source: "INPUT" || "OUTPUT", // required
* content: [ // GuardrailContentBlockList // required
* { // GuardrailContentBlock Union: only one key present
* text: { // GuardrailTextBlock
* text: "STRING_VALUE", // required
* qualifiers: [ // GuardrailContentQualifierList
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: { // GuardrailImageBlock
* format: "png" || "jpeg", // required
* source: { // GuardrailImageSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* ],
* outputScope: "INTERVENTIONS" || "FULL",
* };
* const command = new ApplyGuardrailCommand(input);
* const response = await client.send(command);
* // { // ApplyGuardrailResponse
* // usage: { // GuardrailUsage
* // topicPolicyUnits: Number("int"), // required
* // contentPolicyUnits: Number("int"), // required
* // wordPolicyUnits: Number("int"), // required
* // sensitiveInformationPolicyUnits: Number("int"), // required
* // sensitiveInformationPolicyFreeUnits: Number("int"), // required
* // contextualGroundingPolicyUnits: Number("int"), // required
* // contentPolicyImageUnits: Number("int"),
* // automatedReasoningPolicyUnits: Number("int"),
* // automatedReasoningPolicies: Number("int"),
* // },
* // action: "NONE" || "GUARDRAIL_INTERVENED", // required
* // actionReason: "STRING_VALUE",
* // outputs: [ // GuardrailOutputContentList // required
* // { // GuardrailOutputContent
* // text: "STRING_VALUE",
* // },
* // ],
* // assessments: [ // GuardrailAssessmentList // required
* // { // GuardrailAssessment
* // topicPolicy: { // GuardrailTopicPolicyAssessment
* // topics: [ // GuardrailTopicList // required
* // { // GuardrailTopic
* // name: "STRING_VALUE", // required
* // type: "DENY", // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // contentPolicy: { // GuardrailContentPolicyAssessment
* // filters: [ // GuardrailContentFilterList // required
* // { // GuardrailContentFilter
* // type: "INSULTS" || "HATE" || "SEXUAL" || "VIOLENCE" || "MISCONDUCT" || "PROMPT_ATTACK", // required
* // confidence: "NONE" || "LOW" || "MEDIUM" || "HIGH", // required
* // filterStrength: "NONE" || "LOW" || "MEDIUM" || "HIGH",
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // wordPolicy: { // GuardrailWordPolicyAssessment
* // customWords: [ // GuardrailCustomWordList // required
* // { // GuardrailCustomWord
* // match: "STRING_VALUE", // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // managedWordLists: [ // GuardrailManagedWordList // required
* // { // GuardrailManagedWord
* // match: "STRING_VALUE", // required
* // type: "PROFANITY", // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // sensitiveInformationPolicy: { // GuardrailSensitiveInformationPolicyAssessment
* // piiEntities: [ // GuardrailPiiEntityFilterList // required
* // { // GuardrailPiiEntityFilter
* // match: "STRING_VALUE", // required
* // type: "ADDRESS" || "AGE" || "AWS_ACCESS_KEY" || "AWS_SECRET_KEY" || "CA_HEALTH_NUMBER" || "CA_SOCIAL_INSURANCE_NUMBER" || "CREDIT_DEBIT_CARD_CVV" || "CREDIT_DEBIT_CARD_EXPIRY" || "CREDIT_DEBIT_CARD_NUMBER" || "DRIVER_ID" || "EMAIL" || "INTERNATIONAL_BANK_ACCOUNT_NUMBER" || "IP_ADDRESS" || "LICENSE_PLATE" || "MAC_ADDRESS" || "NAME" || "PASSWORD" || "PHONE" || "PIN" || "SWIFT_CODE" || "UK_NATIONAL_HEALTH_SERVICE_NUMBER" || "UK_NATIONAL_INSURANCE_NUMBER" || "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER" || "URL" || "USERNAME" || "US_BANK_ACCOUNT_NUMBER" || "US_BANK_ROUTING_NUMBER" || "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER" || "US_PASSPORT_NUMBER" || "US_SOCIAL_SECURITY_NUMBER" || "VEHICLE_IDENTIFICATION_NUMBER", // required
* // action: "ANONYMIZED" || "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // regexes: [ // GuardrailRegexFilterList // required
* // { // GuardrailRegexFilter
* // name: "STRING_VALUE",
* // match: "STRING_VALUE",
* // regex: "STRING_VALUE",
* // action: "ANONYMIZED" || "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // contextualGroundingPolicy: { // GuardrailContextualGroundingPolicyAssessment
* // filters: [ // GuardrailContextualGroundingFilters
* // { // GuardrailContextualGroundingFilter
* // type: "GROUNDING" || "RELEVANCE", // required
* // threshold: Number("double"), // required
* // score: Number("double"), // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // automatedReasoningPolicy: { // GuardrailAutomatedReasoningPolicyAssessment
* // findings: [ // GuardrailAutomatedReasoningFindingList
* // { // GuardrailAutomatedReasoningFinding Union: only one key present
* // valid: { // GuardrailAutomatedReasoningValidFinding
* // translation: { // GuardrailAutomatedReasoningTranslation
* // premises: [ // GuardrailAutomatedReasoningStatementList
* // { // GuardrailAutomatedReasoningStatement
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // claims: [
* // {
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // untranslatedPremises: [ // GuardrailAutomatedReasoningInputTextReferenceList
* // { // GuardrailAutomatedReasoningInputTextReference
* // text: "STRING_VALUE",
* // },
* // ],
* // untranslatedClaims: [
* // {
* // text: "STRING_VALUE",
* // },
* // ],
* // confidence: Number("double"),
* // },
* // claimsTrueScenario: { // GuardrailAutomatedReasoningScenario
* // statements: [
* // {
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // },
* // supportingRules: [ // GuardrailAutomatedReasoningRuleList
* // { // GuardrailAutomatedReasoningRule
* // identifier: "STRING_VALUE",
* // policyVersionArn: "STRING_VALUE",
* // },
* // ],
* // logicWarning: { // GuardrailAutomatedReasoningLogicWarning
* // type: "ALWAYS_FALSE" || "ALWAYS_TRUE",
* // premises: [
* // {
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // claims: [
* // {
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // },
* // },
* // invalid: { // GuardrailAutomatedReasoningInvalidFinding
* // translation: {
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // untranslatedPremises: [
* // {
* // text: "STRING_VALUE",
* // },
* // ],
* // untranslatedClaims: [
* // {
* // text: "STRING_VALUE",
* // },
* // ],
* // confidence: Number("double"),
* // },
* // contradictingRules: [
* // {
* // identifier: "STRING_VALUE",
* // policyVersionArn: "STRING_VALUE",
* // },
* // ],
* // logicWarning: {
* // type: "ALWAYS_FALSE" || "ALWAYS_TRUE",
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // },
* // satisfiable: { // GuardrailAutomatedReasoningSatisfiableFinding
* // translation: {
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // untranslatedPremises: [
* // {
* // text: "STRING_VALUE",
* // },
* // ],
* // untranslatedClaims: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // confidence: Number("double"),
* // },
* // claimsTrueScenario: {
* // statements: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // claimsFalseScenario: {
* // statements: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // logicWarning: {
* // type: "ALWAYS_FALSE" || "ALWAYS_TRUE",
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // },
* // impossible: { // GuardrailAutomatedReasoningImpossibleFinding
* // translation: {
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // untranslatedPremises: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // untranslatedClaims: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // confidence: Number("double"),
* // },
* // contradictingRules: [
* // {
* // identifier: "STRING_VALUE",
* // policyVersionArn: "STRING_VALUE",
* // },
* // ],
* // logicWarning: {
* // type: "ALWAYS_FALSE" || "ALWAYS_TRUE",
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // },
* // translationAmbiguous: { // GuardrailAutomatedReasoningTranslationAmbiguousFinding
* // options: [ // GuardrailAutomatedReasoningTranslationOptionList
* // { // GuardrailAutomatedReasoningTranslationOption
* // translations: [ // GuardrailAutomatedReasoningTranslationList
* // {
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // untranslatedPremises: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // untranslatedClaims: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // confidence: Number("double"),
* // },
* // ],
* // },
* // ],
* // differenceScenarios: [ // GuardrailAutomatedReasoningDifferenceScenarioList
* // {
* // statements: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // ],
* // },
* // tooComplex: {},
* // noTranslations: {},
* // },
* // ],
* // },
* // invocationMetrics: { // GuardrailInvocationMetrics
* // guardrailProcessingLatency: Number("long"),
* // usage: {
* // topicPolicyUnits: Number("int"), // required
* // contentPolicyUnits: Number("int"), // required
* // wordPolicyUnits: Number("int"), // required
* // sensitiveInformationPolicyUnits: Number("int"), // required
* // sensitiveInformationPolicyFreeUnits: Number("int"), // required
* // contextualGroundingPolicyUnits: Number("int"), // required
* // contentPolicyImageUnits: Number("int"),
* // automatedReasoningPolicyUnits: Number("int"),
* // automatedReasoningPolicies: Number("int"),
* // },
* // guardrailCoverage: { // GuardrailCoverage
* // textCharacters: { // GuardrailTextCharactersCoverage
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: { // GuardrailImageCoverage
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // },
* // appliedGuardrailDetails: { // AppliedGuardrailDetails
* // guardrailId: "STRING_VALUE",
* // guardrailVersion: "STRING_VALUE",
* // guardrailArn: "STRING_VALUE",
* // guardrailOrigin: [ // GuardrailOriginList
* // "REQUEST" || "ACCOUNT_ENFORCED" || "ORGANIZATION_ENFORCED",
* // ],
* // guardrailOwnership: "SELF" || "CROSS_ACCOUNT",
* // },
* // },
* // ],
* // guardrailCoverage: {
* // textCharacters: {
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: {
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // };
*
* ```
*
* @param ApplyGuardrailCommandInput - {@link ApplyGuardrailCommandInput}
* @returns {@link ApplyGuardrailCommandOutput}
* @see {@link ApplyGuardrailCommandInput} for command's `input` shape.
* @see {@link ApplyGuardrailCommandOutput} for command's `response` shape.
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link BedrockRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
*
*
* @public
*/
export declare class ApplyGuardrailCommand extends ApplyGuardrailCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: ApplyGuardrailRequest;
output: ApplyGuardrailResponse;
};
sdk: {
input: ApplyGuardrailCommandInput;
output: ApplyGuardrailCommandOutput;
};
};
}

View File

@@ -0,0 +1,982 @@
import { Command as $Command } from "@smithy/smithy-client";
import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import type { ConverseStreamRequest, ConverseStreamResponse } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link ConverseStreamCommand}.
*/
export interface ConverseStreamCommandInput extends ConverseStreamRequest {
}
/**
* @public
*
* The output of {@link ConverseStreamCommand}.
*/
export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __MetadataBearer {
}
declare const ConverseStreamCommand_base: {
new (input: ConverseStreamCommandInput): import("@smithy/smithy-client").CommandImpl<ConverseStreamCommandInput, ConverseStreamCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (input: ConverseStreamCommandInput): import("@smithy/smithy-client").CommandImpl<ConverseStreamCommandInput, ConverseStreamCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>Sends messages to the specified Amazon Bedrock model and returns the response in a stream. <code>ConverseStream</code> provides a consistent API that works with all Amazon Bedrock models that support messages. This allows you to write code once and use it with different models. Should a model have unique inference parameters, you can also pass those unique parameters to the model. </p> <p>To find out if a model supports streaming, call <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetFoundationModel.html">GetFoundationModel</a> and check the <code>responseStreamingSupported</code> field in the response.</p> <note> <p>The CLI doesn't support streaming operations in Amazon Bedrock, including <code>ConverseStream</code>.</p> </note> <p>Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.</p> <p>You can submit a prompt by including it in the <code>messages</code> field, specifying the <code>modelId</code> of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.</p> <p>You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the <code>promptVariables</code> field. You can append more messages to the prompt by using the <code>messages</code> field. If you use a prompt from Prompt management, you can't include the following fields in the request: <code>additionalModelRequestFields</code>, <code>inferenceConfig</code>, <code>system</code>, or <code>toolConfig</code>. Instead, these fields must be defined through Prompt management. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-use.html">Use a prompt from Prompt management</a>.</p> <p>For information about the Converse API, see <i>Use the Converse API</i> in the <i>Amazon Bedrock User Guide</i>. To use a guardrail, see <i>Use a guardrail with the Converse API</i> in the <i>Amazon Bedrock User Guide</i>. To use a tool with a model, see <i>Tool use (Function calling)</i> in the <i>Amazon Bedrock User Guide</i> </p> <p>For example code, see <i>Conversation streaming example</i> in the <i>Amazon Bedrock User Guide</i>. </p> <p>This operation requires permission for the <code>bedrock:InvokeModelWithResponseStream</code> action.</p> <important> <p>To deny all inference access to resources that you specify in the modelId field, you need to deny access to the <code>bedrock:InvokeModel</code> and <code>bedrock:InvokeModelWithResponseStream</code> actions. Doing this also denies access to the resource through the base inference actions (<a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html">InvokeModel</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModelWithResponseStream.html">InvokeModelWithResponseStream</a>). For more information see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-deny-inference">Deny access for inference on specific models</a>. </p> </important> <p>For troubleshooting some of the common errors you might encounter when using the <code>ConverseStream</code> API, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html">Troubleshooting Amazon Bedrock API Error Codes</a> in the Amazon Bedrock User Guide</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockRuntimeClient, ConverseStreamCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
* // const { BedrockRuntimeClient, ConverseStreamCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
* // import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
* const config = {}; // type is BedrockRuntimeClientConfig
* const client = new BedrockRuntimeClient(config);
* const input = { // ConverseStreamRequest
* modelId: "STRING_VALUE", // required
* messages: [ // Messages
* { // Message
* role: "user" || "assistant", // required
* content: [ // ContentBlocks // required
* { // ContentBlock Union: only one key present
* text: "STRING_VALUE",
* image: { // ImageBlock
* format: "png" || "jpeg" || "gif" || "webp", // required
* source: { // ImageSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: { // S3Location
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* },
* error: { // ErrorBlock
* message: "STRING_VALUE",
* },
* },
* document: { // DocumentBlock
* format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md",
* name: "STRING_VALUE", // required
* source: { // DocumentSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: {
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* text: "STRING_VALUE",
* content: [ // DocumentContentBlocks
* { // DocumentContentBlock Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* },
* context: "STRING_VALUE",
* citations: { // CitationsConfig
* enabled: true || false, // required
* },
* },
* video: { // VideoBlock
* format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required
* source: { // VideoSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: {
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* },
* },
* audio: { // AudioBlock
* format: "mp3" || "opus" || "wav" || "aac" || "flac" || "mp4" || "ogg" || "mkv" || "mka" || "x-aac" || "m4a" || "mpeg" || "mpga" || "pcm" || "webm", // required
* source: { // AudioSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: {
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* },
* error: {
* message: "STRING_VALUE",
* },
* },
* toolUse: { // ToolUseBlock
* toolUseId: "STRING_VALUE", // required
* name: "STRING_VALUE", // required
* input: "DOCUMENT_VALUE", // required
* type: "server_tool_use",
* },
* toolResult: { // ToolResultBlock
* toolUseId: "STRING_VALUE", // required
* content: [ // ToolResultContentBlocks // required
* { // ToolResultContentBlock Union: only one key present
* json: "DOCUMENT_VALUE",
* text: "STRING_VALUE",
* image: {
* format: "png" || "jpeg" || "gif" || "webp", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: {
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* },
* error: {
* message: "STRING_VALUE",
* },
* },
* document: {
* format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md",
* name: "STRING_VALUE", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: "<S3Location>",
* text: "STRING_VALUE",
* content: [
* {// Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* },
* context: "STRING_VALUE",
* citations: {
* enabled: true || false, // required
* },
* },
* video: {
* format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: "<S3Location>",
* },
* },
* searchResult: { // SearchResultBlock
* source: "STRING_VALUE", // required
* title: "STRING_VALUE", // required
* content: [ // SearchResultContentBlocks // required
* { // SearchResultContentBlock
* text: "STRING_VALUE", // required
* },
* ],
* citations: {
* enabled: true || false, // required
* },
* },
* },
* ],
* status: "success" || "error",
* type: "STRING_VALUE",
* },
* guardContent: { // GuardrailConverseContentBlock Union: only one key present
* text: { // GuardrailConverseTextBlock
* text: "STRING_VALUE", // required
* qualifiers: [ // GuardrailConverseContentQualifierList
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: { // GuardrailConverseImageBlock
* format: "png" || "jpeg", // required
* source: { // GuardrailConverseImageSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* cachePoint: { // CachePointBlock
* type: "default", // required
* ttl: "5m" || "1h",
* },
* reasoningContent: { // ReasoningContentBlock Union: only one key present
* reasoningText: { // ReasoningTextBlock
* text: "STRING_VALUE", // required
* signature: "STRING_VALUE",
* },
* redactedContent: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* citationsContent: { // CitationsContentBlock
* content: [ // CitationGeneratedContentList
* { // CitationGeneratedContent Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* citations: [ // Citations
* { // Citation
* title: "STRING_VALUE",
* source: "STRING_VALUE",
* sourceContent: [ // CitationSourceContentList
* { // CitationSourceContent Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* location: { // CitationLocation Union: only one key present
* web: { // WebLocation
* url: "STRING_VALUE",
* domain: "STRING_VALUE",
* },
* documentChar: { // DocumentCharLocation
* documentIndex: Number("int"),
* start: Number("int"),
* end: Number("int"),
* },
* documentPage: { // DocumentPageLocation
* documentIndex: Number("int"),
* start: Number("int"),
* end: Number("int"),
* },
* documentChunk: { // DocumentChunkLocation
* documentIndex: Number("int"),
* start: Number("int"),
* end: Number("int"),
* },
* searchResultLocation: { // SearchResultLocation
* searchResultIndex: Number("int"),
* start: Number("int"),
* end: Number("int"),
* },
* },
* },
* ],
* },
* searchResult: {
* source: "STRING_VALUE", // required
* title: "STRING_VALUE", // required
* content: [ // required
* {
* text: "STRING_VALUE", // required
* },
* ],
* citations: {
* enabled: true || false, // required
* },
* },
* },
* ],
* },
* ],
* system: [ // SystemContentBlocks
* { // SystemContentBlock Union: only one key present
* text: "STRING_VALUE",
* guardContent: {// Union: only one key present
* text: {
* text: "STRING_VALUE", // required
* qualifiers: [
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: {
* format: "png" || "jpeg", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* cachePoint: {
* type: "default", // required
* ttl: "5m" || "1h",
* },
* },
* ],
* inferenceConfig: { // InferenceConfiguration
* maxTokens: Number("int"),
* temperature: Number("float"),
* topP: Number("float"),
* stopSequences: [ // NonEmptyStringList
* "STRING_VALUE",
* ],
* },
* toolConfig: { // ToolConfiguration
* tools: [ // Tools // required
* { // Tool Union: only one key present
* toolSpec: { // ToolSpecification
* name: "STRING_VALUE", // required
* description: "STRING_VALUE",
* inputSchema: { // ToolInputSchema Union: only one key present
* json: "DOCUMENT_VALUE",
* },
* strict: true || false,
* },
* systemTool: { // SystemTool
* name: "STRING_VALUE", // required
* },
* cachePoint: "<CachePointBlock>",
* },
* ],
* toolChoice: { // ToolChoice Union: only one key present
* auto: {},
* any: {},
* tool: { // SpecificToolChoice
* name: "STRING_VALUE", // required
* },
* },
* },
* guardrailConfig: { // GuardrailStreamConfiguration
* guardrailIdentifier: "STRING_VALUE",
* guardrailVersion: "STRING_VALUE",
* trace: "enabled" || "disabled" || "enabled_full",
* streamProcessingMode: "sync" || "async",
* },
* additionalModelRequestFields: "DOCUMENT_VALUE",
* promptVariables: { // PromptVariableMap
* "<keys>": { // PromptVariableValues Union: only one key present
* text: "STRING_VALUE",
* },
* },
* additionalModelResponseFieldPaths: [ // AdditionalModelResponseFieldPaths
* "STRING_VALUE",
* ],
* requestMetadata: { // RequestMetadata
* "<keys>": "STRING_VALUE",
* },
* performanceConfig: { // PerformanceConfiguration
* latency: "standard" || "optimized",
* },
* serviceTier: { // ServiceTier
* type: "priority" || "default" || "flex" || "reserved", // required
* },
* outputConfig: { // OutputConfig
* textFormat: { // OutputFormat
* type: "json_schema", // required
* structure: { // OutputFormatStructure Union: only one key present
* jsonSchema: { // JsonSchemaDefinition
* schema: "STRING_VALUE", // required
* name: "STRING_VALUE",
* description: "STRING_VALUE",
* },
* },
* },
* },
* };
* const command = new ConverseStreamCommand(input);
* const response = await client.send(command);
* // { // ConverseStreamResponse
* // stream: { // ConverseStreamOutput Union: only one key present
* // messageStart: { // MessageStartEvent
* // role: "user" || "assistant", // required
* // },
* // contentBlockStart: { // ContentBlockStartEvent
* // start: { // ContentBlockStart Union: only one key present
* // toolUse: { // ToolUseBlockStart
* // toolUseId: "STRING_VALUE", // required
* // name: "STRING_VALUE", // required
* // type: "server_tool_use",
* // },
* // toolResult: { // ToolResultBlockStart
* // toolUseId: "STRING_VALUE", // required
* // type: "STRING_VALUE",
* // status: "success" || "error",
* // },
* // image: { // ImageBlockStart
* // format: "png" || "jpeg" || "gif" || "webp", // required
* // },
* // },
* // contentBlockIndex: Number("int"), // required
* // },
* // contentBlockDelta: { // ContentBlockDeltaEvent
* // delta: { // ContentBlockDelta Union: only one key present
* // text: "STRING_VALUE",
* // toolUse: { // ToolUseBlockDelta
* // input: "STRING_VALUE", // required
* // },
* // toolResult: [ // ToolResultBlocksDelta
* // { // ToolResultBlockDelta Union: only one key present
* // text: "STRING_VALUE",
* // json: "DOCUMENT_VALUE",
* // },
* // ],
* // reasoningContent: { // ReasoningContentBlockDelta Union: only one key present
* // text: "STRING_VALUE",
* // redactedContent: new Uint8Array(),
* // signature: "STRING_VALUE",
* // },
* // citation: { // CitationsDelta
* // title: "STRING_VALUE",
* // source: "STRING_VALUE",
* // sourceContent: [ // CitationSourceContentListDelta
* // { // CitationSourceContentDelta
* // text: "STRING_VALUE",
* // },
* // ],
* // location: { // CitationLocation Union: only one key present
* // web: { // WebLocation
* // url: "STRING_VALUE",
* // domain: "STRING_VALUE",
* // },
* // documentChar: { // DocumentCharLocation
* // documentIndex: Number("int"),
* // start: Number("int"),
* // end: Number("int"),
* // },
* // documentPage: { // DocumentPageLocation
* // documentIndex: Number("int"),
* // start: Number("int"),
* // end: Number("int"),
* // },
* // documentChunk: { // DocumentChunkLocation
* // documentIndex: Number("int"),
* // start: Number("int"),
* // end: Number("int"),
* // },
* // searchResultLocation: { // SearchResultLocation
* // searchResultIndex: Number("int"),
* // start: Number("int"),
* // end: Number("int"),
* // },
* // },
* // },
* // image: { // ImageBlockDelta
* // source: { // ImageSource Union: only one key present
* // bytes: new Uint8Array(),
* // s3Location: { // S3Location
* // uri: "STRING_VALUE", // required
* // bucketOwner: "STRING_VALUE",
* // },
* // },
* // error: { // ErrorBlock
* // message: "STRING_VALUE",
* // },
* // },
* // },
* // contentBlockIndex: Number("int"), // required
* // },
* // contentBlockStop: { // ContentBlockStopEvent
* // contentBlockIndex: Number("int"), // required
* // },
* // messageStop: { // MessageStopEvent
* // stopReason: "end_turn" || "tool_use" || "max_tokens" || "stop_sequence" || "guardrail_intervened" || "content_filtered" || "malformed_model_output" || "malformed_tool_use" || "model_context_window_exceeded", // required
* // additionalModelResponseFields: "DOCUMENT_VALUE",
* // },
* // metadata: { // ConverseStreamMetadataEvent
* // usage: { // TokenUsage
* // inputTokens: Number("int"), // required
* // outputTokens: Number("int"), // required
* // totalTokens: Number("int"), // required
* // cacheReadInputTokens: Number("int"),
* // cacheWriteInputTokens: Number("int"),
* // cacheDetails: [ // CacheDetailsList
* // { // CacheDetail
* // ttl: "5m" || "1h", // required
* // inputTokens: Number("int"), // required
* // },
* // ],
* // },
* // metrics: { // ConverseStreamMetrics
* // latencyMs: Number("long"), // required
* // },
* // trace: { // ConverseStreamTrace
* // guardrail: { // GuardrailTraceAssessment
* // modelOutput: [ // ModelOutputs
* // "STRING_VALUE",
* // ],
* // inputAssessment: { // GuardrailAssessmentMap
* // "<keys>": { // GuardrailAssessment
* // topicPolicy: { // GuardrailTopicPolicyAssessment
* // topics: [ // GuardrailTopicList // required
* // { // GuardrailTopic
* // name: "STRING_VALUE", // required
* // type: "DENY", // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // contentPolicy: { // GuardrailContentPolicyAssessment
* // filters: [ // GuardrailContentFilterList // required
* // { // GuardrailContentFilter
* // type: "INSULTS" || "HATE" || "SEXUAL" || "VIOLENCE" || "MISCONDUCT" || "PROMPT_ATTACK", // required
* // confidence: "NONE" || "LOW" || "MEDIUM" || "HIGH", // required
* // filterStrength: "NONE" || "LOW" || "MEDIUM" || "HIGH",
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // wordPolicy: { // GuardrailWordPolicyAssessment
* // customWords: [ // GuardrailCustomWordList // required
* // { // GuardrailCustomWord
* // match: "STRING_VALUE", // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // managedWordLists: [ // GuardrailManagedWordList // required
* // { // GuardrailManagedWord
* // match: "STRING_VALUE", // required
* // type: "PROFANITY", // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // sensitiveInformationPolicy: { // GuardrailSensitiveInformationPolicyAssessment
* // piiEntities: [ // GuardrailPiiEntityFilterList // required
* // { // GuardrailPiiEntityFilter
* // match: "STRING_VALUE", // required
* // type: "ADDRESS" || "AGE" || "AWS_ACCESS_KEY" || "AWS_SECRET_KEY" || "CA_HEALTH_NUMBER" || "CA_SOCIAL_INSURANCE_NUMBER" || "CREDIT_DEBIT_CARD_CVV" || "CREDIT_DEBIT_CARD_EXPIRY" || "CREDIT_DEBIT_CARD_NUMBER" || "DRIVER_ID" || "EMAIL" || "INTERNATIONAL_BANK_ACCOUNT_NUMBER" || "IP_ADDRESS" || "LICENSE_PLATE" || "MAC_ADDRESS" || "NAME" || "PASSWORD" || "PHONE" || "PIN" || "SWIFT_CODE" || "UK_NATIONAL_HEALTH_SERVICE_NUMBER" || "UK_NATIONAL_INSURANCE_NUMBER" || "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER" || "URL" || "USERNAME" || "US_BANK_ACCOUNT_NUMBER" || "US_BANK_ROUTING_NUMBER" || "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER" || "US_PASSPORT_NUMBER" || "US_SOCIAL_SECURITY_NUMBER" || "VEHICLE_IDENTIFICATION_NUMBER", // required
* // action: "ANONYMIZED" || "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // regexes: [ // GuardrailRegexFilterList // required
* // { // GuardrailRegexFilter
* // name: "STRING_VALUE",
* // match: "STRING_VALUE",
* // regex: "STRING_VALUE",
* // action: "ANONYMIZED" || "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // contextualGroundingPolicy: { // GuardrailContextualGroundingPolicyAssessment
* // filters: [ // GuardrailContextualGroundingFilters
* // { // GuardrailContextualGroundingFilter
* // type: "GROUNDING" || "RELEVANCE", // required
* // threshold: Number("double"), // required
* // score: Number("double"), // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // automatedReasoningPolicy: { // GuardrailAutomatedReasoningPolicyAssessment
* // findings: [ // GuardrailAutomatedReasoningFindingList
* // { // GuardrailAutomatedReasoningFinding Union: only one key present
* // valid: { // GuardrailAutomatedReasoningValidFinding
* // translation: { // GuardrailAutomatedReasoningTranslation
* // premises: [ // GuardrailAutomatedReasoningStatementList
* // { // GuardrailAutomatedReasoningStatement
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // claims: [
* // {
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // untranslatedPremises: [ // GuardrailAutomatedReasoningInputTextReferenceList
* // { // GuardrailAutomatedReasoningInputTextReference
* // text: "STRING_VALUE",
* // },
* // ],
* // untranslatedClaims: [
* // {
* // text: "STRING_VALUE",
* // },
* // ],
* // confidence: Number("double"),
* // },
* // claimsTrueScenario: { // GuardrailAutomatedReasoningScenario
* // statements: [
* // {
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // },
* // supportingRules: [ // GuardrailAutomatedReasoningRuleList
* // { // GuardrailAutomatedReasoningRule
* // identifier: "STRING_VALUE",
* // policyVersionArn: "STRING_VALUE",
* // },
* // ],
* // logicWarning: { // GuardrailAutomatedReasoningLogicWarning
* // type: "ALWAYS_FALSE" || "ALWAYS_TRUE",
* // premises: [
* // {
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // claims: [
* // {
* // logic: "STRING_VALUE",
* // naturalLanguage: "STRING_VALUE",
* // },
* // ],
* // },
* // },
* // invalid: { // GuardrailAutomatedReasoningInvalidFinding
* // translation: {
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // untranslatedPremises: [
* // {
* // text: "STRING_VALUE",
* // },
* // ],
* // untranslatedClaims: [
* // {
* // text: "STRING_VALUE",
* // },
* // ],
* // confidence: Number("double"),
* // },
* // contradictingRules: [
* // {
* // identifier: "STRING_VALUE",
* // policyVersionArn: "STRING_VALUE",
* // },
* // ],
* // logicWarning: {
* // type: "ALWAYS_FALSE" || "ALWAYS_TRUE",
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // },
* // satisfiable: { // GuardrailAutomatedReasoningSatisfiableFinding
* // translation: {
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // untranslatedPremises: [
* // {
* // text: "STRING_VALUE",
* // },
* // ],
* // untranslatedClaims: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // confidence: Number("double"),
* // },
* // claimsTrueScenario: {
* // statements: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // claimsFalseScenario: {
* // statements: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // logicWarning: {
* // type: "ALWAYS_FALSE" || "ALWAYS_TRUE",
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // },
* // impossible: { // GuardrailAutomatedReasoningImpossibleFinding
* // translation: {
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // untranslatedPremises: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // untranslatedClaims: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // confidence: Number("double"),
* // },
* // contradictingRules: [
* // {
* // identifier: "STRING_VALUE",
* // policyVersionArn: "STRING_VALUE",
* // },
* // ],
* // logicWarning: {
* // type: "ALWAYS_FALSE" || "ALWAYS_TRUE",
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // },
* // translationAmbiguous: { // GuardrailAutomatedReasoningTranslationAmbiguousFinding
* // options: [ // GuardrailAutomatedReasoningTranslationOptionList
* // { // GuardrailAutomatedReasoningTranslationOption
* // translations: [ // GuardrailAutomatedReasoningTranslationList
* // {
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // untranslatedPremises: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // untranslatedClaims: "<GuardrailAutomatedReasoningInputTextReferenceList>",
* // confidence: Number("double"),
* // },
* // ],
* // },
* // ],
* // differenceScenarios: [ // GuardrailAutomatedReasoningDifferenceScenarioList
* // {
* // statements: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // ],
* // },
* // tooComplex: {},
* // noTranslations: {},
* // },
* // ],
* // },
* // invocationMetrics: { // GuardrailInvocationMetrics
* // guardrailProcessingLatency: Number("long"),
* // usage: { // GuardrailUsage
* // topicPolicyUnits: Number("int"), // required
* // contentPolicyUnits: Number("int"), // required
* // wordPolicyUnits: Number("int"), // required
* // sensitiveInformationPolicyUnits: Number("int"), // required
* // sensitiveInformationPolicyFreeUnits: Number("int"), // required
* // contextualGroundingPolicyUnits: Number("int"), // required
* // contentPolicyImageUnits: Number("int"),
* // automatedReasoningPolicyUnits: Number("int"),
* // automatedReasoningPolicies: Number("int"),
* // },
* // guardrailCoverage: { // GuardrailCoverage
* // textCharacters: { // GuardrailTextCharactersCoverage
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: { // GuardrailImageCoverage
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // },
* // appliedGuardrailDetails: { // AppliedGuardrailDetails
* // guardrailId: "STRING_VALUE",
* // guardrailVersion: "STRING_VALUE",
* // guardrailArn: "STRING_VALUE",
* // guardrailOrigin: [ // GuardrailOriginList
* // "REQUEST" || "ACCOUNT_ENFORCED" || "ORGANIZATION_ENFORCED",
* // ],
* // guardrailOwnership: "SELF" || "CROSS_ACCOUNT",
* // },
* // },
* // },
* // outputAssessments: { // GuardrailAssessmentListMap
* // "<keys>": [ // GuardrailAssessmentList
* // {
* // topicPolicy: {
* // topics: [ // required
* // {
* // name: "STRING_VALUE", // required
* // type: "DENY", // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // contentPolicy: {
* // filters: [ // required
* // {
* // type: "INSULTS" || "HATE" || "SEXUAL" || "VIOLENCE" || "MISCONDUCT" || "PROMPT_ATTACK", // required
* // confidence: "NONE" || "LOW" || "MEDIUM" || "HIGH", // required
* // filterStrength: "NONE" || "LOW" || "MEDIUM" || "HIGH",
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // wordPolicy: {
* // customWords: [ // required
* // {
* // match: "STRING_VALUE", // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // managedWordLists: [ // required
* // {
* // match: "STRING_VALUE", // required
* // type: "PROFANITY", // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // sensitiveInformationPolicy: {
* // piiEntities: [ // required
* // {
* // match: "STRING_VALUE", // required
* // type: "ADDRESS" || "AGE" || "AWS_ACCESS_KEY" || "AWS_SECRET_KEY" || "CA_HEALTH_NUMBER" || "CA_SOCIAL_INSURANCE_NUMBER" || "CREDIT_DEBIT_CARD_CVV" || "CREDIT_DEBIT_CARD_EXPIRY" || "CREDIT_DEBIT_CARD_NUMBER" || "DRIVER_ID" || "EMAIL" || "INTERNATIONAL_BANK_ACCOUNT_NUMBER" || "IP_ADDRESS" || "LICENSE_PLATE" || "MAC_ADDRESS" || "NAME" || "PASSWORD" || "PHONE" || "PIN" || "SWIFT_CODE" || "UK_NATIONAL_HEALTH_SERVICE_NUMBER" || "UK_NATIONAL_INSURANCE_NUMBER" || "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER" || "URL" || "USERNAME" || "US_BANK_ACCOUNT_NUMBER" || "US_BANK_ROUTING_NUMBER" || "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER" || "US_PASSPORT_NUMBER" || "US_SOCIAL_SECURITY_NUMBER" || "VEHICLE_IDENTIFICATION_NUMBER", // required
* // action: "ANONYMIZED" || "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // regexes: [ // required
* // {
* // name: "STRING_VALUE",
* // match: "STRING_VALUE",
* // regex: "STRING_VALUE",
* // action: "ANONYMIZED" || "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // contextualGroundingPolicy: {
* // filters: [
* // {
* // type: "GROUNDING" || "RELEVANCE", // required
* // threshold: Number("double"), // required
* // score: Number("double"), // required
* // action: "BLOCKED" || "NONE", // required
* // detected: true || false,
* // },
* // ],
* // },
* // automatedReasoningPolicy: {
* // findings: [
* // {// Union: only one key present
* // valid: {
* // translation: "<GuardrailAutomatedReasoningTranslation>",
* // claimsTrueScenario: {
* // statements: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // supportingRules: [
* // {
* // identifier: "STRING_VALUE",
* // policyVersionArn: "STRING_VALUE",
* // },
* // ],
* // logicWarning: {
* // type: "ALWAYS_FALSE" || "ALWAYS_TRUE",
* // premises: "<GuardrailAutomatedReasoningStatementList>",
* // claims: "<GuardrailAutomatedReasoningStatementList>",
* // },
* // },
* // invalid: {
* // translation: "<GuardrailAutomatedReasoningTranslation>",
* // contradictingRules: [
* // {
* // identifier: "STRING_VALUE",
* // policyVersionArn: "STRING_VALUE",
* // },
* // ],
* // logicWarning: "<GuardrailAutomatedReasoningLogicWarning>",
* // },
* // satisfiable: {
* // translation: "<GuardrailAutomatedReasoningTranslation>",
* // claimsTrueScenario: "<GuardrailAutomatedReasoningScenario>",
* // claimsFalseScenario: "<GuardrailAutomatedReasoningScenario>",
* // logicWarning: "<GuardrailAutomatedReasoningLogicWarning>",
* // },
* // impossible: {
* // translation: "<GuardrailAutomatedReasoningTranslation>",
* // contradictingRules: "<GuardrailAutomatedReasoningRuleList>",
* // logicWarning: "<GuardrailAutomatedReasoningLogicWarning>",
* // },
* // translationAmbiguous: {
* // options: [
* // {
* // translations: [
* // "<GuardrailAutomatedReasoningTranslation>",
* // ],
* // },
* // ],
* // differenceScenarios: [
* // "<GuardrailAutomatedReasoningScenario>",
* // ],
* // },
* // tooComplex: {},
* // noTranslations: {},
* // },
* // ],
* // },
* // invocationMetrics: {
* // guardrailProcessingLatency: Number("long"),
* // usage: {
* // topicPolicyUnits: Number("int"), // required
* // contentPolicyUnits: Number("int"), // required
* // wordPolicyUnits: Number("int"), // required
* // sensitiveInformationPolicyUnits: Number("int"), // required
* // sensitiveInformationPolicyFreeUnits: Number("int"), // required
* // contextualGroundingPolicyUnits: Number("int"), // required
* // contentPolicyImageUnits: Number("int"),
* // automatedReasoningPolicyUnits: Number("int"),
* // automatedReasoningPolicies: Number("int"),
* // },
* // guardrailCoverage: {
* // textCharacters: {
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: {
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // },
* // appliedGuardrailDetails: {
* // guardrailId: "STRING_VALUE",
* // guardrailVersion: "STRING_VALUE",
* // guardrailArn: "STRING_VALUE",
* // guardrailOrigin: [
* // "REQUEST" || "ACCOUNT_ENFORCED" || "ORGANIZATION_ENFORCED",
* // ],
* // guardrailOwnership: "SELF" || "CROSS_ACCOUNT",
* // },
* // },
* // ],
* // },
* // actionReason: "STRING_VALUE",
* // },
* // promptRouter: { // PromptRouterTrace
* // invokedModelId: "STRING_VALUE",
* // },
* // },
* // performanceConfig: { // PerformanceConfiguration
* // latency: "standard" || "optimized",
* // },
* // serviceTier: { // ServiceTier
* // type: "priority" || "default" || "flex" || "reserved", // required
* // },
* // },
* // internalServerException: { // InternalServerException
* // message: "STRING_VALUE",
* // },
* // modelStreamErrorException: { // ModelStreamErrorException
* // message: "STRING_VALUE",
* // originalStatusCode: Number("int"),
* // originalMessage: "STRING_VALUE",
* // },
* // validationException: { // ValidationException
* // message: "STRING_VALUE",
* // },
* // throttlingException: { // ThrottlingException
* // message: "STRING_VALUE",
* // },
* // serviceUnavailableException: { // ServiceUnavailableException
* // message: "STRING_VALUE",
* // },
* // },
* // };
*
* ```
*
* @param ConverseStreamCommandInput - {@link ConverseStreamCommandInput}
* @returns {@link ConverseStreamCommandOutput}
* @see {@link ConverseStreamCommandInput} for command's `input` shape.
* @see {@link ConverseStreamCommandOutput} for command's `response` shape.
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ModelErrorException} (client fault)
* <p>The request failed due to an error while processing the model.</p>
*
* @throws {@link ModelNotReadyException} (client fault)
* <p>The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see <a href="https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html">Retry behavior</a> in the <i>AWS SDKs and Tools</i> reference guide.</p>
*
* @throws {@link ModelTimeoutException} (client fault)
* <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link BedrockRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
*
*
* @public
*/
export declare class ConverseStreamCommand extends ConverseStreamCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: ConverseStreamRequest;
output: ConverseStreamResponse;
};
sdk: {
input: ConverseStreamCommandInput;
output: ConverseStreamCommandOutput;
};
};
}

View File

@@ -0,0 +1,363 @@
import { Command as $Command } from "@smithy/smithy-client";
import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import type { CountTokensRequest, CountTokensResponse } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link CountTokensCommand}.
*/
export interface CountTokensCommandInput extends CountTokensRequest {
}
/**
* @public
*
* The output of {@link CountTokensCommand}.
*/
export interface CountTokensCommandOutput extends CountTokensResponse, __MetadataBearer {
}
declare const CountTokensCommand_base: {
new (input: CountTokensCommandInput): import("@smithy/smithy-client").CommandImpl<CountTokensCommandInput, CountTokensCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (input: CountTokensCommandInput): import("@smithy/smithy-client").CommandImpl<CountTokensCommandInput, CountTokensCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>Returns the token count for a given inference request. This operation helps you estimate token usage before sending requests to foundation models by returning the token count that would be used if the same input were sent to the model in an inference request.</p> <p>Token counting is model-specific because different models use different tokenization strategies. The token count returned by this operation will match the token count that would be charged if the same input were sent to the model in an <code>InvokeModel</code> or <code>Converse</code> request.</p> <p>You can use this operation to:</p> <ul> <li> <p>Estimate costs before sending inference requests.</p> </li> <li> <p>Optimize prompts to fit within token limits.</p> </li> <li> <p>Plan for token usage in your applications.</p> </li> </ul> <p>This operation accepts the same input formats as <code>InvokeModel</code> and <code>Converse</code>, allowing you to count tokens for both raw text inputs and structured conversation formats.</p> <p>The following operations are related to <code>CountTokens</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/bedrock/latest/API/API_runtime_InvokeModel.html">InvokeModel</a> - Sends inference requests to foundation models</p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock/latest/API/API_runtime_Converse.html">Converse</a> - Sends conversation-based inference requests to foundation models</p> </li> </ul>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockRuntimeClient, CountTokensCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
* // const { BedrockRuntimeClient, CountTokensCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
* // import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
* const config = {}; // type is BedrockRuntimeClientConfig
* const client = new BedrockRuntimeClient(config);
* const input = { // CountTokensRequest
* modelId: "STRING_VALUE", // required
* input: { // CountTokensInput Union: only one key present
* invokeModel: { // InvokeModelTokensRequest
* body: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") // required
* },
* converse: { // ConverseTokensRequest
* messages: [ // Messages
* { // Message
* role: "user" || "assistant", // required
* content: [ // ContentBlocks // required
* { // ContentBlock Union: only one key present
* text: "STRING_VALUE",
* image: { // ImageBlock
* format: "png" || "jpeg" || "gif" || "webp", // required
* source: { // ImageSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: { // S3Location
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* },
* error: { // ErrorBlock
* message: "STRING_VALUE",
* },
* },
* document: { // DocumentBlock
* format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md",
* name: "STRING_VALUE", // required
* source: { // DocumentSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: {
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* text: "STRING_VALUE",
* content: [ // DocumentContentBlocks
* { // DocumentContentBlock Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* },
* context: "STRING_VALUE",
* citations: { // CitationsConfig
* enabled: true || false, // required
* },
* },
* video: { // VideoBlock
* format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required
* source: { // VideoSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: {
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* },
* },
* audio: { // AudioBlock
* format: "mp3" || "opus" || "wav" || "aac" || "flac" || "mp4" || "ogg" || "mkv" || "mka" || "x-aac" || "m4a" || "mpeg" || "mpga" || "pcm" || "webm", // required
* source: { // AudioSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: {
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* },
* error: {
* message: "STRING_VALUE",
* },
* },
* toolUse: { // ToolUseBlock
* toolUseId: "STRING_VALUE", // required
* name: "STRING_VALUE", // required
* input: "DOCUMENT_VALUE", // required
* type: "server_tool_use",
* },
* toolResult: { // ToolResultBlock
* toolUseId: "STRING_VALUE", // required
* content: [ // ToolResultContentBlocks // required
* { // ToolResultContentBlock Union: only one key present
* json: "DOCUMENT_VALUE",
* text: "STRING_VALUE",
* image: {
* format: "png" || "jpeg" || "gif" || "webp", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: {
* uri: "STRING_VALUE", // required
* bucketOwner: "STRING_VALUE",
* },
* },
* error: {
* message: "STRING_VALUE",
* },
* },
* document: {
* format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md",
* name: "STRING_VALUE", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: "<S3Location>",
* text: "STRING_VALUE",
* content: [
* {// Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* },
* context: "STRING_VALUE",
* citations: {
* enabled: true || false, // required
* },
* },
* video: {
* format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* s3Location: "<S3Location>",
* },
* },
* searchResult: { // SearchResultBlock
* source: "STRING_VALUE", // required
* title: "STRING_VALUE", // required
* content: [ // SearchResultContentBlocks // required
* { // SearchResultContentBlock
* text: "STRING_VALUE", // required
* },
* ],
* citations: {
* enabled: true || false, // required
* },
* },
* },
* ],
* status: "success" || "error",
* type: "STRING_VALUE",
* },
* guardContent: { // GuardrailConverseContentBlock Union: only one key present
* text: { // GuardrailConverseTextBlock
* text: "STRING_VALUE", // required
* qualifiers: [ // GuardrailConverseContentQualifierList
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: { // GuardrailConverseImageBlock
* format: "png" || "jpeg", // required
* source: { // GuardrailConverseImageSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* cachePoint: { // CachePointBlock
* type: "default", // required
* ttl: "5m" || "1h",
* },
* reasoningContent: { // ReasoningContentBlock Union: only one key present
* reasoningText: { // ReasoningTextBlock
* text: "STRING_VALUE", // required
* signature: "STRING_VALUE",
* },
* redactedContent: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* citationsContent: { // CitationsContentBlock
* content: [ // CitationGeneratedContentList
* { // CitationGeneratedContent Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* citations: [ // Citations
* { // Citation
* title: "STRING_VALUE",
* source: "STRING_VALUE",
* sourceContent: [ // CitationSourceContentList
* { // CitationSourceContent Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* location: { // CitationLocation Union: only one key present
* web: { // WebLocation
* url: "STRING_VALUE",
* domain: "STRING_VALUE",
* },
* documentChar: { // DocumentCharLocation
* documentIndex: Number("int"),
* start: Number("int"),
* end: Number("int"),
* },
* documentPage: { // DocumentPageLocation
* documentIndex: Number("int"),
* start: Number("int"),
* end: Number("int"),
* },
* documentChunk: { // DocumentChunkLocation
* documentIndex: Number("int"),
* start: Number("int"),
* end: Number("int"),
* },
* searchResultLocation: { // SearchResultLocation
* searchResultIndex: Number("int"),
* start: Number("int"),
* end: Number("int"),
* },
* },
* },
* ],
* },
* searchResult: {
* source: "STRING_VALUE", // required
* title: "STRING_VALUE", // required
* content: [ // required
* {
* text: "STRING_VALUE", // required
* },
* ],
* citations: {
* enabled: true || false, // required
* },
* },
* },
* ],
* },
* ],
* system: [ // SystemContentBlocks
* { // SystemContentBlock Union: only one key present
* text: "STRING_VALUE",
* guardContent: {// Union: only one key present
* text: {
* text: "STRING_VALUE", // required
* qualifiers: [
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: {
* format: "png" || "jpeg", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* cachePoint: {
* type: "default", // required
* ttl: "5m" || "1h",
* },
* },
* ],
* toolConfig: { // ToolConfiguration
* tools: [ // Tools // required
* { // Tool Union: only one key present
* toolSpec: { // ToolSpecification
* name: "STRING_VALUE", // required
* description: "STRING_VALUE",
* inputSchema: { // ToolInputSchema Union: only one key present
* json: "DOCUMENT_VALUE",
* },
* strict: true || false,
* },
* systemTool: { // SystemTool
* name: "STRING_VALUE", // required
* },
* cachePoint: "<CachePointBlock>",
* },
* ],
* toolChoice: { // ToolChoice Union: only one key present
* auto: {},
* any: {},
* tool: { // SpecificToolChoice
* name: "STRING_VALUE", // required
* },
* },
* },
* additionalModelRequestFields: "DOCUMENT_VALUE",
* },
* },
* };
* const command = new CountTokensCommand(input);
* const response = await client.send(command);
* // { // CountTokensResponse
* // inputTokens: Number("int"), // required
* // };
*
* ```
*
* @param CountTokensCommandInput - {@link CountTokensCommandInput}
* @returns {@link CountTokensCommandOutput}
* @see {@link CountTokensCommandInput} for command's `input` shape.
* @see {@link CountTokensCommandOutput} for command's `response` shape.
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link BedrockRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
*
*
* @public
*/
export declare class CountTokensCommand extends CountTokensCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: CountTokensRequest;
output: CountTokensResponse;
};
sdk: {
input: CountTokensCommandInput;
output: CountTokensCommandOutput;
};
};
}

View File

@@ -0,0 +1,100 @@
import { Command as $Command } from "@smithy/smithy-client";
import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import type { GetAsyncInvokeRequest, GetAsyncInvokeResponse } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link GetAsyncInvokeCommand}.
*/
export interface GetAsyncInvokeCommandInput extends GetAsyncInvokeRequest {
}
/**
* @public
*
* The output of {@link GetAsyncInvokeCommand}.
*/
export interface GetAsyncInvokeCommandOutput extends GetAsyncInvokeResponse, __MetadataBearer {
}
declare const GetAsyncInvokeCommand_base: {
new (input: GetAsyncInvokeCommandInput): import("@smithy/smithy-client").CommandImpl<GetAsyncInvokeCommandInput, GetAsyncInvokeCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (input: GetAsyncInvokeCommandInput): import("@smithy/smithy-client").CommandImpl<GetAsyncInvokeCommandInput, GetAsyncInvokeCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>Retrieve information about an asynchronous invocation.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockRuntimeClient, GetAsyncInvokeCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
* // const { BedrockRuntimeClient, GetAsyncInvokeCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
* // import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
* const config = {}; // type is BedrockRuntimeClientConfig
* const client = new BedrockRuntimeClient(config);
* const input = { // GetAsyncInvokeRequest
* invocationArn: "STRING_VALUE", // required
* };
* const command = new GetAsyncInvokeCommand(input);
* const response = await client.send(command);
* // { // GetAsyncInvokeResponse
* // invocationArn: "STRING_VALUE", // required
* // modelArn: "STRING_VALUE", // required
* // clientRequestToken: "STRING_VALUE",
* // status: "InProgress" || "Completed" || "Failed", // required
* // failureMessage: "STRING_VALUE",
* // submitTime: new Date("TIMESTAMP"), // required
* // lastModifiedTime: new Date("TIMESTAMP"),
* // endTime: new Date("TIMESTAMP"),
* // outputDataConfig: { // AsyncInvokeOutputDataConfig Union: only one key present
* // s3OutputDataConfig: { // AsyncInvokeS3OutputDataConfig
* // s3Uri: "STRING_VALUE", // required
* // kmsKeyId: "STRING_VALUE",
* // bucketOwner: "STRING_VALUE",
* // },
* // },
* // };
*
* ```
*
* @param GetAsyncInvokeCommandInput - {@link GetAsyncInvokeCommandInput}
* @returns {@link GetAsyncInvokeCommandOutput}
* @see {@link GetAsyncInvokeCommandInput} for command's `input` shape.
* @see {@link GetAsyncInvokeCommandOutput} for command's `response` shape.
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link BedrockRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
*
*
* @public
*/
export declare class GetAsyncInvokeCommand extends GetAsyncInvokeCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: GetAsyncInvokeRequest;
output: GetAsyncInvokeResponse;
};
sdk: {
input: GetAsyncInvokeCommandInput;
output: GetAsyncInvokeCommandOutput;
};
};
}

View File

@@ -0,0 +1,128 @@
import { Command as $Command } from "@smithy/smithy-client";
import type { BlobPayloadInputTypes, MetadataBearer as __MetadataBearer } from "@smithy/types";
import { Uint8ArrayBlobAdapter } from "@smithy/util-stream";
import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import type { InvokeModelRequest, InvokeModelResponse } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*/
export type InvokeModelCommandInputType = Omit<InvokeModelRequest, "body"> & {
body?: BlobPayloadInputTypes;
};
/**
* @public
*
* The input for {@link InvokeModelCommand}.
*/
export interface InvokeModelCommandInput extends InvokeModelCommandInputType {
}
/**
* @public
*/
export type InvokeModelCommandOutputType = Omit<InvokeModelResponse, "body"> & {
body: Uint8ArrayBlobAdapter;
};
/**
* @public
*
* The output of {@link InvokeModelCommand}.
*/
export interface InvokeModelCommandOutput extends InvokeModelCommandOutputType, __MetadataBearer {
}
declare const InvokeModelCommand_base: {
new (input: InvokeModelCommandInput): import("@smithy/smithy-client").CommandImpl<InvokeModelCommandInput, InvokeModelCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (input: InvokeModelCommandInput): import("@smithy/smithy-client").CommandImpl<InvokeModelCommandInput, InvokeModelCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. You use model inference to generate text, images, and embeddings.</p> <p>For example code, see <i>Invoke model code examples</i> in the <i>Amazon Bedrock User Guide</i>. </p> <p>This operation requires permission for the <code>bedrock:InvokeModel</code> action.</p> <important> <p>To deny all inference access to resources that you specify in the modelId field, you need to deny access to the <code>bedrock:InvokeModel</code> and <code>bedrock:InvokeModelWithResponseStream</code> actions. Doing this also denies access to the resource through the Converse API actions (<a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a>). For more information see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-deny-inference">Deny access for inference on specific models</a>. </p> </important> <p>For troubleshooting some of the common errors you might encounter when using the <code>InvokeModel</code> API, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html">Troubleshooting Amazon Bedrock API Error Codes</a> in the Amazon Bedrock User Guide</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
* // const { BedrockRuntimeClient, InvokeModelCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
* // import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
* const config = {}; // type is BedrockRuntimeClientConfig
* const client = new BedrockRuntimeClient(config);
* const input = { // InvokeModelRequest
* body: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* contentType: "STRING_VALUE",
* accept: "STRING_VALUE",
* modelId: "STRING_VALUE", // required
* trace: "ENABLED" || "DISABLED" || "ENABLED_FULL",
* guardrailIdentifier: "STRING_VALUE",
* guardrailVersion: "STRING_VALUE",
* performanceConfigLatency: "standard" || "optimized",
* serviceTier: "priority" || "default" || "flex" || "reserved",
* };
* const command = new InvokeModelCommand(input);
* const response = await client.send(command);
* // { // InvokeModelResponse
* // body: new Uint8Array(), // required
* // contentType: "STRING_VALUE", // required
* // performanceConfigLatency: "standard" || "optimized",
* // serviceTier: "priority" || "default" || "flex" || "reserved",
* // };
*
* ```
*
* @param InvokeModelCommandInput - {@link InvokeModelCommandInput}
* @returns {@link InvokeModelCommandOutput}
* @see {@link InvokeModelCommandInput} for command's `input` shape.
* @see {@link InvokeModelCommandOutput} for command's `response` shape.
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ModelErrorException} (client fault)
* <p>The request failed due to an error while processing the model.</p>
*
* @throws {@link ModelNotReadyException} (client fault)
* <p>The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see <a href="https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html">Retry behavior</a> in the <i>AWS SDKs and Tools</i> reference guide.</p>
*
* @throws {@link ModelTimeoutException} (client fault)
* <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link BedrockRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
*
*
* @public
*/
export declare class InvokeModelCommand extends InvokeModelCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: InvokeModelRequest;
output: InvokeModelResponse;
};
sdk: {
input: InvokeModelCommandInput;
output: InvokeModelCommandOutput;
};
};
}

View File

@@ -0,0 +1,136 @@
import { Command as $Command } from "@smithy/smithy-client";
import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import type { InvokeModelWithBidirectionalStreamRequest, InvokeModelWithBidirectionalStreamResponse } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link InvokeModelWithBidirectionalStreamCommand}.
*/
export interface InvokeModelWithBidirectionalStreamCommandInput extends InvokeModelWithBidirectionalStreamRequest {
}
/**
* @public
*
* The output of {@link InvokeModelWithBidirectionalStreamCommand}.
*/
export interface InvokeModelWithBidirectionalStreamCommandOutput extends InvokeModelWithBidirectionalStreamResponse, __MetadataBearer {
}
declare const InvokeModelWithBidirectionalStreamCommand_base: {
new (input: InvokeModelWithBidirectionalStreamCommandInput): import("@smithy/smithy-client").CommandImpl<InvokeModelWithBidirectionalStreamCommandInput, InvokeModelWithBidirectionalStreamCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (input: InvokeModelWithBidirectionalStreamCommandInput): import("@smithy/smithy-client").CommandImpl<InvokeModelWithBidirectionalStreamCommandInput, InvokeModelWithBidirectionalStreamCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>Invoke the specified Amazon Bedrock model to run inference using the bidirectional stream. The response is returned in a stream that remains open for 8 minutes. A single session can contain multiple prompts and responses from the model. The prompts to the model are provided as audio files and the model's responses are spoken back to the user and transcribed.</p> <p>It is possible for users to interrupt the model's response with a new prompt, which will halt the response speech. The model will retain contextual awareness of the conversation while pivoting to respond to the new prompt.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockRuntimeClient, InvokeModelWithBidirectionalStreamCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
* // const { BedrockRuntimeClient, InvokeModelWithBidirectionalStreamCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
* // import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
* const config = {}; // type is BedrockRuntimeClientConfig
* const client = new BedrockRuntimeClient(config);
* const input = { // InvokeModelWithBidirectionalStreamRequest
* modelId: "STRING_VALUE", // required
* body: { // InvokeModelWithBidirectionalStreamInput Union: only one key present
* chunk: { // BidirectionalInputPayloadPart
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* };
* const command = new InvokeModelWithBidirectionalStreamCommand(input);
* const response = await client.send(command);
* // { // InvokeModelWithBidirectionalStreamResponse
* // body: { // InvokeModelWithBidirectionalStreamOutput Union: only one key present
* // chunk: { // BidirectionalOutputPayloadPart
* // bytes: new Uint8Array(),
* // },
* // internalServerException: { // InternalServerException
* // message: "STRING_VALUE",
* // },
* // modelStreamErrorException: { // ModelStreamErrorException
* // message: "STRING_VALUE",
* // originalStatusCode: Number("int"),
* // originalMessage: "STRING_VALUE",
* // },
* // validationException: { // ValidationException
* // message: "STRING_VALUE",
* // },
* // throttlingException: { // ThrottlingException
* // message: "STRING_VALUE",
* // },
* // modelTimeoutException: { // ModelTimeoutException
* // message: "STRING_VALUE",
* // },
* // serviceUnavailableException: { // ServiceUnavailableException
* // message: "STRING_VALUE",
* // },
* // },
* // };
*
* ```
*
* @param InvokeModelWithBidirectionalStreamCommandInput - {@link InvokeModelWithBidirectionalStreamCommandInput}
* @returns {@link InvokeModelWithBidirectionalStreamCommandOutput}
* @see {@link InvokeModelWithBidirectionalStreamCommandInput} for command's `input` shape.
* @see {@link InvokeModelWithBidirectionalStreamCommandOutput} for command's `response` shape.
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ModelErrorException} (client fault)
* <p>The request failed due to an error while processing the model.</p>
*
* @throws {@link ModelNotReadyException} (client fault)
* <p>The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see <a href="https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html">Retry behavior</a> in the <i>AWS SDKs and Tools</i> reference guide.</p>
*
* @throws {@link ModelStreamErrorException} (client fault)
* <p>An error occurred while streaming the response. Retry your request.</p>
*
* @throws {@link ModelTimeoutException} (client fault)
* <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link BedrockRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
*
*
* @public
*/
export declare class InvokeModelWithBidirectionalStreamCommand extends InvokeModelWithBidirectionalStreamCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: InvokeModelWithBidirectionalStreamRequest;
output: InvokeModelWithBidirectionalStreamResponse;
};
sdk: {
input: InvokeModelWithBidirectionalStreamCommandInput;
output: InvokeModelWithBidirectionalStreamCommandOutput;
};
};
}

View File

@@ -0,0 +1,148 @@
import { Command as $Command } from "@smithy/smithy-client";
import type { BlobPayloadInputTypes, MetadataBearer as __MetadataBearer } from "@smithy/types";
import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import type { InvokeModelWithResponseStreamRequest, InvokeModelWithResponseStreamResponse } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*/
export type InvokeModelWithResponseStreamCommandInputType = Omit<InvokeModelWithResponseStreamRequest, "body"> & {
body?: BlobPayloadInputTypes;
};
/**
* @public
*
* The input for {@link InvokeModelWithResponseStreamCommand}.
*/
export interface InvokeModelWithResponseStreamCommandInput extends InvokeModelWithResponseStreamCommandInputType {
}
/**
* @public
*
* The output of {@link InvokeModelWithResponseStreamCommand}.
*/
export interface InvokeModelWithResponseStreamCommandOutput extends InvokeModelWithResponseStreamResponse, __MetadataBearer {
}
declare const InvokeModelWithResponseStreamCommand_base: {
new (input: InvokeModelWithResponseStreamCommandInput): import("@smithy/smithy-client").CommandImpl<InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (input: InvokeModelWithResponseStreamCommandInput): import("@smithy/smithy-client").CommandImpl<InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>Invoke the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. The response is returned in a stream.</p> <p>To see if a model supports streaming, call <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetFoundationModel.html">GetFoundationModel</a> and check the <code>responseStreamingSupported</code> field in the response.</p> <note> <p>The CLI doesn't support streaming operations in Amazon Bedrock, including <code>InvokeModelWithResponseStream</code>.</p> </note> <p>For example code, see <i>Invoke model with streaming code example</i> in the <i>Amazon Bedrock User Guide</i>. </p> <p>This operation requires permissions to perform the <code>bedrock:InvokeModelWithResponseStream</code> action. </p> <important> <p>To deny all inference access to resources that you specify in the modelId field, you need to deny access to the <code>bedrock:InvokeModel</code> and <code>bedrock:InvokeModelWithResponseStream</code> actions. Doing this also denies access to the resource through the Converse API actions (<a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a>). For more information see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-deny-inference">Deny access for inference on specific models</a>. </p> </important> <p>For troubleshooting some of the common errors you might encounter when using the <code>InvokeModelWithResponseStream</code> API, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html">Troubleshooting Amazon Bedrock API Error Codes</a> in the Amazon Bedrock User Guide</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockRuntimeClient, InvokeModelWithResponseStreamCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
* // const { BedrockRuntimeClient, InvokeModelWithResponseStreamCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
* // import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
* const config = {}; // type is BedrockRuntimeClientConfig
* const client = new BedrockRuntimeClient(config);
* const input = { // InvokeModelWithResponseStreamRequest
* body: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* contentType: "STRING_VALUE",
* accept: "STRING_VALUE",
* modelId: "STRING_VALUE", // required
* trace: "ENABLED" || "DISABLED" || "ENABLED_FULL",
* guardrailIdentifier: "STRING_VALUE",
* guardrailVersion: "STRING_VALUE",
* performanceConfigLatency: "standard" || "optimized",
* serviceTier: "priority" || "default" || "flex" || "reserved",
* };
* const command = new InvokeModelWithResponseStreamCommand(input);
* const response = await client.send(command);
* // { // InvokeModelWithResponseStreamResponse
* // body: { // ResponseStream Union: only one key present
* // chunk: { // PayloadPart
* // bytes: new Uint8Array(),
* // },
* // internalServerException: { // InternalServerException
* // message: "STRING_VALUE",
* // },
* // modelStreamErrorException: { // ModelStreamErrorException
* // message: "STRING_VALUE",
* // originalStatusCode: Number("int"),
* // originalMessage: "STRING_VALUE",
* // },
* // validationException: { // ValidationException
* // message: "STRING_VALUE",
* // },
* // throttlingException: { // ThrottlingException
* // message: "STRING_VALUE",
* // },
* // modelTimeoutException: { // ModelTimeoutException
* // message: "STRING_VALUE",
* // },
* // serviceUnavailableException: { // ServiceUnavailableException
* // message: "STRING_VALUE",
* // },
* // },
* // contentType: "STRING_VALUE", // required
* // performanceConfigLatency: "standard" || "optimized",
* // serviceTier: "priority" || "default" || "flex" || "reserved",
* // };
*
* ```
*
* @param InvokeModelWithResponseStreamCommandInput - {@link InvokeModelWithResponseStreamCommandInput}
* @returns {@link InvokeModelWithResponseStreamCommandOutput}
* @see {@link InvokeModelWithResponseStreamCommandInput} for command's `input` shape.
* @see {@link InvokeModelWithResponseStreamCommandOutput} for command's `response` shape.
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ModelErrorException} (client fault)
* <p>The request failed due to an error while processing the model.</p>
*
* @throws {@link ModelNotReadyException} (client fault)
* <p>The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see <a href="https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html">Retry behavior</a> in the <i>AWS SDKs and Tools</i> reference guide.</p>
*
* @throws {@link ModelStreamErrorException} (client fault)
* <p>An error occurred while streaming the response. Retry your request.</p>
*
* @throws {@link ModelTimeoutException} (client fault)
* <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link BedrockRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
*
*
* @public
*/
export declare class InvokeModelWithResponseStreamCommand extends InvokeModelWithResponseStreamCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: InvokeModelWithResponseStreamRequest;
output: InvokeModelWithResponseStreamResponse;
};
sdk: {
input: InvokeModelWithResponseStreamCommandInput;
output: InvokeModelWithResponseStreamCommandOutput;
};
};
}

View File

@@ -0,0 +1,111 @@
import { Command as $Command } from "@smithy/smithy-client";
import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import type { ListAsyncInvokesRequest, ListAsyncInvokesResponse } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link ListAsyncInvokesCommand}.
*/
export interface ListAsyncInvokesCommandInput extends ListAsyncInvokesRequest {
}
/**
* @public
*
* The output of {@link ListAsyncInvokesCommand}.
*/
export interface ListAsyncInvokesCommandOutput extends ListAsyncInvokesResponse, __MetadataBearer {
}
declare const ListAsyncInvokesCommand_base: {
new (input: ListAsyncInvokesCommandInput): import("@smithy/smithy-client").CommandImpl<ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (...[input]: [] | [ListAsyncInvokesCommandInput]): import("@smithy/smithy-client").CommandImpl<ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>Lists asynchronous invocations.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockRuntimeClient, ListAsyncInvokesCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
* // const { BedrockRuntimeClient, ListAsyncInvokesCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
* // import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
* const config = {}; // type is BedrockRuntimeClientConfig
* const client = new BedrockRuntimeClient(config);
* const input = { // ListAsyncInvokesRequest
* submitTimeAfter: new Date("TIMESTAMP"),
* submitTimeBefore: new Date("TIMESTAMP"),
* statusEquals: "InProgress" || "Completed" || "Failed",
* maxResults: Number("int"),
* nextToken: "STRING_VALUE",
* sortBy: "SubmissionTime",
* sortOrder: "Ascending" || "Descending",
* };
* const command = new ListAsyncInvokesCommand(input);
* const response = await client.send(command);
* // { // ListAsyncInvokesResponse
* // nextToken: "STRING_VALUE",
* // asyncInvokeSummaries: [ // AsyncInvokeSummaries
* // { // AsyncInvokeSummary
* // invocationArn: "STRING_VALUE", // required
* // modelArn: "STRING_VALUE", // required
* // clientRequestToken: "STRING_VALUE",
* // status: "InProgress" || "Completed" || "Failed",
* // failureMessage: "STRING_VALUE",
* // submitTime: new Date("TIMESTAMP"), // required
* // lastModifiedTime: new Date("TIMESTAMP"),
* // endTime: new Date("TIMESTAMP"),
* // outputDataConfig: { // AsyncInvokeOutputDataConfig Union: only one key present
* // s3OutputDataConfig: { // AsyncInvokeS3OutputDataConfig
* // s3Uri: "STRING_VALUE", // required
* // kmsKeyId: "STRING_VALUE",
* // bucketOwner: "STRING_VALUE",
* // },
* // },
* // },
* // ],
* // };
*
* ```
*
* @param ListAsyncInvokesCommandInput - {@link ListAsyncInvokesCommandInput}
* @returns {@link ListAsyncInvokesCommandOutput}
* @see {@link ListAsyncInvokesCommandInput} for command's `input` shape.
* @see {@link ListAsyncInvokesCommandOutput} for command's `response` shape.
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link BedrockRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
*
*
* @public
*/
export declare class ListAsyncInvokesCommand extends ListAsyncInvokesCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: ListAsyncInvokesRequest;
output: ListAsyncInvokesResponse;
};
sdk: {
input: ListAsyncInvokesCommandInput;
output: ListAsyncInvokesCommandOutput;
};
};
}

View File

@@ -0,0 +1,113 @@
import { Command as $Command } from "@smithy/smithy-client";
import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import type { StartAsyncInvokeRequest, StartAsyncInvokeResponse } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link StartAsyncInvokeCommand}.
*/
export interface StartAsyncInvokeCommandInput extends StartAsyncInvokeRequest {
}
/**
* @public
*
* The output of {@link StartAsyncInvokeCommand}.
*/
export interface StartAsyncInvokeCommandOutput extends StartAsyncInvokeResponse, __MetadataBearer {
}
declare const StartAsyncInvokeCommand_base: {
new (input: StartAsyncInvokeCommandInput): import("@smithy/smithy-client").CommandImpl<StartAsyncInvokeCommandInput, StartAsyncInvokeCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (input: StartAsyncInvokeCommandInput): import("@smithy/smithy-client").CommandImpl<StartAsyncInvokeCommandInput, StartAsyncInvokeCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>Starts an asynchronous invocation.</p> <p>This operation requires permission for the <code>bedrock:InvokeModel</code> action.</p> <important> <p>To deny all inference access to resources that you specify in the modelId field, you need to deny access to the <code>bedrock:InvokeModel</code> and <code>bedrock:InvokeModelWithResponseStream</code> actions. Doing this also denies access to the resource through the Converse API actions (<a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a>). For more information see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-deny-inference">Deny access for inference on specific models</a>. </p> </important>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockRuntimeClient, StartAsyncInvokeCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
* // const { BedrockRuntimeClient, StartAsyncInvokeCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
* // import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
* const config = {}; // type is BedrockRuntimeClientConfig
* const client = new BedrockRuntimeClient(config);
* const input = { // StartAsyncInvokeRequest
* clientRequestToken: "STRING_VALUE",
* modelId: "STRING_VALUE", // required
* modelInput: "DOCUMENT_VALUE", // required
* outputDataConfig: { // AsyncInvokeOutputDataConfig Union: only one key present
* s3OutputDataConfig: { // AsyncInvokeS3OutputDataConfig
* s3Uri: "STRING_VALUE", // required
* kmsKeyId: "STRING_VALUE",
* bucketOwner: "STRING_VALUE",
* },
* },
* tags: [ // TagList
* { // Tag
* key: "STRING_VALUE", // required
* value: "STRING_VALUE", // required
* },
* ],
* };
* const command = new StartAsyncInvokeCommand(input);
* const response = await client.send(command);
* // { // StartAsyncInvokeResponse
* // invocationArn: "STRING_VALUE", // required
* // };
*
* ```
*
* @param StartAsyncInvokeCommandInput - {@link StartAsyncInvokeCommandInput}
* @returns {@link StartAsyncInvokeCommandOutput}
* @see {@link StartAsyncInvokeCommandInput} for command's `input` shape.
* @see {@link StartAsyncInvokeCommandOutput} for command's `response` shape.
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ConflictException} (client fault)
* <p>Error occurred because of a conflict while performing an operation.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
*
* @throws {@link BedrockRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
*
*
* @public
*/
export declare class StartAsyncInvokeCommand extends StartAsyncInvokeCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: StartAsyncInvokeRequest;
output: StartAsyncInvokeResponse;
};
sdk: {
input: StartAsyncInvokeCommandInput;
output: StartAsyncInvokeCommandOutput;
};
};
}

View File

@@ -0,0 +1,10 @@
export * from "./ApplyGuardrailCommand";
export * from "./ConverseCommand";
export * from "./ConverseStreamCommand";
export * from "./CountTokensCommand";
export * from "./GetAsyncInvokeCommand";
export * from "./InvokeModelCommand";
export * from "./InvokeModelWithBidirectionalStreamCommand";
export * from "./InvokeModelWithResponseStreamCommand";
export * from "./ListAsyncInvokesCommand";
export * from "./StartAsyncInvokeCommand";

View File

@@ -0,0 +1,50 @@
import type { Endpoint, EndpointParameters as __EndpointParameters, EndpointV2, Provider } from "@smithy/types";
/**
* @public
*/
export interface ClientInputEndpointParameters {
region?: string | undefined | Provider<string | undefined>;
useDualstackEndpoint?: boolean | undefined | Provider<boolean | undefined>;
useFipsEndpoint?: boolean | undefined | Provider<boolean | undefined>;
endpoint?: string | Provider<string> | Endpoint | Provider<Endpoint> | EndpointV2 | Provider<EndpointV2>;
}
/**
* @public
*/
export type ClientResolvedEndpointParameters = Omit<ClientInputEndpointParameters, "endpoint"> & {
defaultSigningName: string;
};
/**
* @internal
*/
export declare const resolveClientEndpointParameters: <T>(options: T & ClientInputEndpointParameters) => T & ClientResolvedEndpointParameters;
/**
* @internal
*/
export declare const commonParams: {
readonly UseFIPS: {
readonly type: "builtInParams";
readonly name: "useFipsEndpoint";
};
readonly Endpoint: {
readonly type: "builtInParams";
readonly name: "endpoint";
};
readonly Region: {
readonly type: "builtInParams";
readonly name: "region";
};
readonly UseDualStack: {
readonly type: "builtInParams";
readonly name: "useDualstackEndpoint";
};
};
/**
* @internal
*/
export interface EndpointParameters extends __EndpointParameters {
Region?: string | undefined;
UseDualStack?: boolean | undefined;
UseFIPS?: boolean | undefined;
Endpoint?: string | undefined;
}

View File

@@ -0,0 +1,8 @@
import type { EndpointV2, Logger } from "@smithy/types";
import type { EndpointParameters } from "./EndpointParameters";
/**
* @internal
*/
export declare const defaultEndpointResolver: (endpointParams: EndpointParameters, context?: {
logger?: Logger;
}) => EndpointV2;

View File

@@ -0,0 +1,2 @@
import { RuleSetObject } from "@smithy/types";
export declare const ruleSet: RuleSetObject;

View File

@@ -0,0 +1,9 @@
import type { AwsRegionExtensionConfiguration } from "@aws-sdk/types";
import type { HttpHandlerExtensionConfiguration } from "@smithy/protocol-http";
import type { DefaultExtensionConfiguration } from "@smithy/types";
import type { HttpAuthExtensionConfiguration } from "./auth/httpAuthExtensionConfiguration";
/**
* @internal
*/
export interface BedrockRuntimeExtensionConfiguration extends HttpHandlerExtensionConfiguration, DefaultExtensionConfiguration, AwsRegionExtensionConfiguration, HttpAuthExtensionConfiguration {
}

View File

@@ -0,0 +1,17 @@
/**
* <p>Describes the API operations for running inference using Amazon Bedrock models.</p>
*
* @packageDocumentation
*/
export * from "./BedrockRuntimeClient";
export * from "./BedrockRuntime";
export type { ClientInputEndpointParameters } from "./endpoint/EndpointParameters";
export type { RuntimeExtension } from "./runtimeExtensions";
export type { BedrockRuntimeExtensionConfiguration } from "./extensionConfiguration";
export * from "./commands";
export * from "./schemas/schemas_0";
export * from "./pagination";
export * from "./models/enums";
export * from "./models/errors";
export * from "./models/models_0";
export { BedrockRuntimeServiceException } from "./models/BedrockRuntimeServiceException";

View File

@@ -0,0 +1,14 @@
import { type ServiceExceptionOptions as __ServiceExceptionOptions, ServiceException as __ServiceException } from "@smithy/smithy-client";
export type { __ServiceExceptionOptions };
export { __ServiceException };
/**
* @public
*
* Base exception class for all service exceptions from BedrockRuntime service.
*/
export declare class BedrockRuntimeServiceException extends __ServiceException {
/**
* @internal
*/
constructor(options: __ServiceExceptionOptions);
}

View File

@@ -0,0 +1,568 @@
/**
* @public
* @enum
*/
export declare const AsyncInvokeStatus: {
readonly COMPLETED: "Completed";
readonly FAILED: "Failed";
readonly IN_PROGRESS: "InProgress";
};
/**
* @public
*/
export type AsyncInvokeStatus = (typeof AsyncInvokeStatus)[keyof typeof AsyncInvokeStatus];
/**
* @public
* @enum
*/
export declare const SortAsyncInvocationBy: {
readonly SUBMISSION_TIME: "SubmissionTime";
};
/**
* @public
*/
export type SortAsyncInvocationBy = (typeof SortAsyncInvocationBy)[keyof typeof SortAsyncInvocationBy];
/**
* @public
* @enum
*/
export declare const SortOrder: {
readonly ASCENDING: "Ascending";
readonly DESCENDING: "Descending";
};
/**
* @public
*/
export type SortOrder = (typeof SortOrder)[keyof typeof SortOrder];
/**
* @public
* @enum
*/
export declare const GuardrailImageFormat: {
readonly JPEG: "jpeg";
readonly PNG: "png";
};
/**
* @public
*/
export type GuardrailImageFormat = (typeof GuardrailImageFormat)[keyof typeof GuardrailImageFormat];
/**
* @public
* @enum
*/
export declare const GuardrailContentQualifier: {
readonly GROUNDING_SOURCE: "grounding_source";
readonly GUARD_CONTENT: "guard_content";
readonly QUERY: "query";
};
/**
* @public
*/
export type GuardrailContentQualifier = (typeof GuardrailContentQualifier)[keyof typeof GuardrailContentQualifier];
/**
* @public
* @enum
*/
export declare const GuardrailOutputScope: {
readonly FULL: "FULL";
readonly INTERVENTIONS: "INTERVENTIONS";
};
/**
* @public
*/
export type GuardrailOutputScope = (typeof GuardrailOutputScope)[keyof typeof GuardrailOutputScope];
/**
* @public
* @enum
*/
export declare const GuardrailContentSource: {
readonly INPUT: "INPUT";
readonly OUTPUT: "OUTPUT";
};
/**
* @public
*/
export type GuardrailContentSource = (typeof GuardrailContentSource)[keyof typeof GuardrailContentSource];
/**
* @public
* @enum
*/
export declare const GuardrailAction: {
readonly GUARDRAIL_INTERVENED: "GUARDRAIL_INTERVENED";
readonly NONE: "NONE";
};
/**
* @public
*/
export type GuardrailAction = (typeof GuardrailAction)[keyof typeof GuardrailAction];
/**
* @public
* @enum
*/
export declare const GuardrailOrigin: {
readonly ACCOUNT_ENFORCED: "ACCOUNT_ENFORCED";
readonly ORGANIZATION_ENFORCED: "ORGANIZATION_ENFORCED";
readonly REQUEST: "REQUEST";
};
/**
* @public
*/
export type GuardrailOrigin = (typeof GuardrailOrigin)[keyof typeof GuardrailOrigin];
/**
* @public
* @enum
*/
export declare const GuardrailOwnership: {
readonly CROSS_ACCOUNT: "CROSS_ACCOUNT";
readonly SELF: "SELF";
};
/**
* @public
*/
export type GuardrailOwnership = (typeof GuardrailOwnership)[keyof typeof GuardrailOwnership];
/**
* @public
* @enum
*/
export declare const GuardrailAutomatedReasoningLogicWarningType: {
readonly ALWAYS_FALSE: "ALWAYS_FALSE";
readonly ALWAYS_TRUE: "ALWAYS_TRUE";
};
/**
* @public
*/
export type GuardrailAutomatedReasoningLogicWarningType = (typeof GuardrailAutomatedReasoningLogicWarningType)[keyof typeof GuardrailAutomatedReasoningLogicWarningType];
/**
* @public
* @enum
*/
export declare const GuardrailContentPolicyAction: {
readonly BLOCKED: "BLOCKED";
readonly NONE: "NONE";
};
/**
* @public
*/
export type GuardrailContentPolicyAction = (typeof GuardrailContentPolicyAction)[keyof typeof GuardrailContentPolicyAction];
/**
* @public
* @enum
*/
export declare const GuardrailContentFilterConfidence: {
readonly HIGH: "HIGH";
readonly LOW: "LOW";
readonly MEDIUM: "MEDIUM";
readonly NONE: "NONE";
};
/**
* @public
*/
export type GuardrailContentFilterConfidence = (typeof GuardrailContentFilterConfidence)[keyof typeof GuardrailContentFilterConfidence];
/**
* @public
* @enum
*/
export declare const GuardrailContentFilterStrength: {
readonly HIGH: "HIGH";
readonly LOW: "LOW";
readonly MEDIUM: "MEDIUM";
readonly NONE: "NONE";
};
/**
* @public
*/
export type GuardrailContentFilterStrength = (typeof GuardrailContentFilterStrength)[keyof typeof GuardrailContentFilterStrength];
/**
* @public
* @enum
*/
export declare const GuardrailContentFilterType: {
readonly HATE: "HATE";
readonly INSULTS: "INSULTS";
readonly MISCONDUCT: "MISCONDUCT";
readonly PROMPT_ATTACK: "PROMPT_ATTACK";
readonly SEXUAL: "SEXUAL";
readonly VIOLENCE: "VIOLENCE";
};
/**
* @public
*/
export type GuardrailContentFilterType = (typeof GuardrailContentFilterType)[keyof typeof GuardrailContentFilterType];
/**
* @public
* @enum
*/
export declare const GuardrailContextualGroundingPolicyAction: {
readonly BLOCKED: "BLOCKED";
readonly NONE: "NONE";
};
/**
* @public
*/
export type GuardrailContextualGroundingPolicyAction = (typeof GuardrailContextualGroundingPolicyAction)[keyof typeof GuardrailContextualGroundingPolicyAction];
/**
* @public
* @enum
*/
export declare const GuardrailContextualGroundingFilterType: {
readonly GROUNDING: "GROUNDING";
readonly RELEVANCE: "RELEVANCE";
};
/**
* @public
*/
export type GuardrailContextualGroundingFilterType = (typeof GuardrailContextualGroundingFilterType)[keyof typeof GuardrailContextualGroundingFilterType];
/**
* @public
* @enum
*/
export declare const GuardrailSensitiveInformationPolicyAction: {
readonly ANONYMIZED: "ANONYMIZED";
readonly BLOCKED: "BLOCKED";
readonly NONE: "NONE";
};
/**
* @public
*/
export type GuardrailSensitiveInformationPolicyAction = (typeof GuardrailSensitiveInformationPolicyAction)[keyof typeof GuardrailSensitiveInformationPolicyAction];
/**
* @public
* @enum
*/
export declare const GuardrailPiiEntityType: {
readonly ADDRESS: "ADDRESS";
readonly AGE: "AGE";
readonly AWS_ACCESS_KEY: "AWS_ACCESS_KEY";
readonly AWS_SECRET_KEY: "AWS_SECRET_KEY";
readonly CA_HEALTH_NUMBER: "CA_HEALTH_NUMBER";
readonly CA_SOCIAL_INSURANCE_NUMBER: "CA_SOCIAL_INSURANCE_NUMBER";
readonly CREDIT_DEBIT_CARD_CVV: "CREDIT_DEBIT_CARD_CVV";
readonly CREDIT_DEBIT_CARD_EXPIRY: "CREDIT_DEBIT_CARD_EXPIRY";
readonly CREDIT_DEBIT_CARD_NUMBER: "CREDIT_DEBIT_CARD_NUMBER";
readonly DRIVER_ID: "DRIVER_ID";
readonly EMAIL: "EMAIL";
readonly INTERNATIONAL_BANK_ACCOUNT_NUMBER: "INTERNATIONAL_BANK_ACCOUNT_NUMBER";
readonly IP_ADDRESS: "IP_ADDRESS";
readonly LICENSE_PLATE: "LICENSE_PLATE";
readonly MAC_ADDRESS: "MAC_ADDRESS";
readonly NAME: "NAME";
readonly PASSWORD: "PASSWORD";
readonly PHONE: "PHONE";
readonly PIN: "PIN";
readonly SWIFT_CODE: "SWIFT_CODE";
readonly UK_NATIONAL_HEALTH_SERVICE_NUMBER: "UK_NATIONAL_HEALTH_SERVICE_NUMBER";
readonly UK_NATIONAL_INSURANCE_NUMBER: "UK_NATIONAL_INSURANCE_NUMBER";
readonly UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER: "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER";
readonly URL: "URL";
readonly USERNAME: "USERNAME";
readonly US_BANK_ACCOUNT_NUMBER: "US_BANK_ACCOUNT_NUMBER";
readonly US_BANK_ROUTING_NUMBER: "US_BANK_ROUTING_NUMBER";
readonly US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER: "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER";
readonly US_PASSPORT_NUMBER: "US_PASSPORT_NUMBER";
readonly US_SOCIAL_SECURITY_NUMBER: "US_SOCIAL_SECURITY_NUMBER";
readonly VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER";
};
/**
* @public
*/
export type GuardrailPiiEntityType = (typeof GuardrailPiiEntityType)[keyof typeof GuardrailPiiEntityType];
/**
* @public
* @enum
*/
export declare const GuardrailTopicPolicyAction: {
readonly BLOCKED: "BLOCKED";
readonly NONE: "NONE";
};
/**
* @public
*/
export type GuardrailTopicPolicyAction = (typeof GuardrailTopicPolicyAction)[keyof typeof GuardrailTopicPolicyAction];
/**
* @public
* @enum
*/
export declare const GuardrailTopicType: {
readonly DENY: "DENY";
};
/**
* @public
*/
export type GuardrailTopicType = (typeof GuardrailTopicType)[keyof typeof GuardrailTopicType];
/**
* @public
* @enum
*/
export declare const GuardrailWordPolicyAction: {
readonly BLOCKED: "BLOCKED";
readonly NONE: "NONE";
};
/**
* @public
*/
export type GuardrailWordPolicyAction = (typeof GuardrailWordPolicyAction)[keyof typeof GuardrailWordPolicyAction];
/**
* @public
* @enum
*/
export declare const GuardrailManagedWordType: {
readonly PROFANITY: "PROFANITY";
};
/**
* @public
*/
export type GuardrailManagedWordType = (typeof GuardrailManagedWordType)[keyof typeof GuardrailManagedWordType];
/**
* @public
* @enum
*/
export declare const GuardrailTrace: {
readonly DISABLED: "disabled";
readonly ENABLED: "enabled";
readonly ENABLED_FULL: "enabled_full";
};
/**
* @public
*/
export type GuardrailTrace = (typeof GuardrailTrace)[keyof typeof GuardrailTrace];
/**
* @public
* @enum
*/
export declare const AudioFormat: {
readonly AAC: "aac";
readonly FLAC: "flac";
readonly M4A: "m4a";
readonly MKA: "mka";
readonly MKV: "mkv";
readonly MP3: "mp3";
readonly MP4: "mp4";
readonly MPEG: "mpeg";
readonly MPGA: "mpga";
readonly OGG: "ogg";
readonly OPUS: "opus";
readonly PCM: "pcm";
readonly WAV: "wav";
readonly WEBM: "webm";
readonly X_AAC: "x-aac";
};
/**
* @public
*/
export type AudioFormat = (typeof AudioFormat)[keyof typeof AudioFormat];
/**
* @public
* @enum
*/
export declare const CacheTTL: {
readonly FIVE_MINUTES: "5m";
readonly ONE_HOUR: "1h";
};
/**
* @public
*/
export type CacheTTL = (typeof CacheTTL)[keyof typeof CacheTTL];
/**
* @public
* @enum
*/
export declare const CachePointType: {
readonly DEFAULT: "default";
};
/**
* @public
*/
export type CachePointType = (typeof CachePointType)[keyof typeof CachePointType];
/**
* @public
* @enum
*/
export declare const DocumentFormat: {
readonly CSV: "csv";
readonly DOC: "doc";
readonly DOCX: "docx";
readonly HTML: "html";
readonly MD: "md";
readonly PDF: "pdf";
readonly TXT: "txt";
readonly XLS: "xls";
readonly XLSX: "xlsx";
};
/**
* @public
*/
export type DocumentFormat = (typeof DocumentFormat)[keyof typeof DocumentFormat];
/**
* @public
* @enum
*/
export declare const GuardrailConverseImageFormat: {
readonly JPEG: "jpeg";
readonly PNG: "png";
};
/**
* @public
*/
export type GuardrailConverseImageFormat = (typeof GuardrailConverseImageFormat)[keyof typeof GuardrailConverseImageFormat];
/**
* @public
* @enum
*/
export declare const GuardrailConverseContentQualifier: {
readonly GROUNDING_SOURCE: "grounding_source";
readonly GUARD_CONTENT: "guard_content";
readonly QUERY: "query";
};
/**
* @public
*/
export type GuardrailConverseContentQualifier = (typeof GuardrailConverseContentQualifier)[keyof typeof GuardrailConverseContentQualifier];
/**
* @public
* @enum
*/
export declare const ImageFormat: {
readonly GIF: "gif";
readonly JPEG: "jpeg";
readonly PNG: "png";
readonly WEBP: "webp";
};
/**
* @public
*/
export type ImageFormat = (typeof ImageFormat)[keyof typeof ImageFormat];
/**
* @public
* @enum
*/
export declare const VideoFormat: {
readonly FLV: "flv";
readonly MKV: "mkv";
readonly MOV: "mov";
readonly MP4: "mp4";
readonly MPEG: "mpeg";
readonly MPG: "mpg";
readonly THREE_GP: "three_gp";
readonly WEBM: "webm";
readonly WMV: "wmv";
};
/**
* @public
*/
export type VideoFormat = (typeof VideoFormat)[keyof typeof VideoFormat];
/**
* @public
* @enum
*/
export declare const ToolResultStatus: {
readonly ERROR: "error";
readonly SUCCESS: "success";
};
/**
* @public
*/
export type ToolResultStatus = (typeof ToolResultStatus)[keyof typeof ToolResultStatus];
/**
* @public
* @enum
*/
export declare const ToolUseType: {
readonly SERVER_TOOL_USE: "server_tool_use";
};
/**
* @public
*/
export type ToolUseType = (typeof ToolUseType)[keyof typeof ToolUseType];
/**
* @public
* @enum
*/
export declare const ConversationRole: {
readonly ASSISTANT: "assistant";
readonly USER: "user";
};
/**
* @public
*/
export type ConversationRole = (typeof ConversationRole)[keyof typeof ConversationRole];
/**
* @public
* @enum
*/
export declare const OutputFormatType: {
readonly JSON_SCHEMA: "json_schema";
};
/**
* @public
*/
export type OutputFormatType = (typeof OutputFormatType)[keyof typeof OutputFormatType];
/**
* @public
* @enum
*/
export declare const PerformanceConfigLatency: {
readonly OPTIMIZED: "optimized";
readonly STANDARD: "standard";
};
/**
* @public
*/
export type PerformanceConfigLatency = (typeof PerformanceConfigLatency)[keyof typeof PerformanceConfigLatency];
/**
* @public
* @enum
*/
export declare const ServiceTierType: {
readonly DEFAULT: "default";
readonly FLEX: "flex";
readonly PRIORITY: "priority";
readonly RESERVED: "reserved";
};
/**
* @public
*/
export type ServiceTierType = (typeof ServiceTierType)[keyof typeof ServiceTierType];
/**
* @public
* @enum
*/
export declare const StopReason: {
readonly CONTENT_FILTERED: "content_filtered";
readonly END_TURN: "end_turn";
readonly GUARDRAIL_INTERVENED: "guardrail_intervened";
readonly MALFORMED_MODEL_OUTPUT: "malformed_model_output";
readonly MALFORMED_TOOL_USE: "malformed_tool_use";
readonly MAX_TOKENS: "max_tokens";
readonly MODEL_CONTEXT_WINDOW_EXCEEDED: "model_context_window_exceeded";
readonly STOP_SEQUENCE: "stop_sequence";
readonly TOOL_USE: "tool_use";
};
/**
* @public
*/
export type StopReason = (typeof StopReason)[keyof typeof StopReason];
/**
* @public
* @enum
*/
export declare const GuardrailStreamProcessingMode: {
readonly ASYNC: "async";
readonly SYNC: "sync";
};
/**
* @public
*/
export type GuardrailStreamProcessingMode = (typeof GuardrailStreamProcessingMode)[keyof typeof GuardrailStreamProcessingMode];
/**
* @public
* @enum
*/
export declare const Trace: {
readonly DISABLED: "DISABLED";
readonly ENABLED: "ENABLED";
readonly ENABLED_FULL: "ENABLED_FULL";
};
/**
* @public
*/
export type Trace = (typeof Trace)[keyof typeof Trace];

View File

@@ -0,0 +1,167 @@
import type { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-client";
import { BedrockRuntimeServiceException as __BaseException } from "./BedrockRuntimeServiceException";
/**
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
* @public
*/
export declare class AccessDeniedException extends __BaseException {
readonly name: "AccessDeniedException";
readonly $fault: "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<AccessDeniedException, __BaseException>);
}
/**
* <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
* @public
*/
export declare class InternalServerException extends __BaseException {
readonly name: "InternalServerException";
readonly $fault: "server";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<InternalServerException, __BaseException>);
}
/**
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
* @public
*/
export declare class ThrottlingException extends __BaseException {
readonly name: "ThrottlingException";
readonly $fault: "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ThrottlingException, __BaseException>);
}
/**
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
* @public
*/
export declare class ValidationException extends __BaseException {
readonly name: "ValidationException";
readonly $fault: "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ValidationException, __BaseException>);
}
/**
* <p>Error occurred because of a conflict while performing an operation.</p>
* @public
*/
export declare class ConflictException extends __BaseException {
readonly name: "ConflictException";
readonly $fault: "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ConflictException, __BaseException>);
}
/**
* <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
* @public
*/
export declare class ResourceNotFoundException extends __BaseException {
readonly name: "ResourceNotFoundException";
readonly $fault: "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ResourceNotFoundException, __BaseException>);
}
/**
* <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
* @public
*/
export declare class ServiceQuotaExceededException extends __BaseException {
readonly name: "ServiceQuotaExceededException";
readonly $fault: "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ServiceQuotaExceededException, __BaseException>);
}
/**
* <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
* @public
*/
export declare class ServiceUnavailableException extends __BaseException {
readonly name: "ServiceUnavailableException";
readonly $fault: "server";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ServiceUnavailableException, __BaseException>);
}
/**
* <p>The request failed due to an error while processing the model.</p>
* @public
*/
export declare class ModelErrorException extends __BaseException {
readonly name: "ModelErrorException";
readonly $fault: "client";
/**
* <p>The original status code.</p>
* @public
*/
originalStatusCode?: number | undefined;
/**
* <p>The resource name.</p>
* @public
*/
resourceName?: string | undefined;
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ModelErrorException, __BaseException>);
}
/**
* <p>The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see <a href="https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html">Retry behavior</a> in the <i>AWS SDKs and Tools</i> reference guide.</p>
* @public
*/
export declare class ModelNotReadyException extends __BaseException {
readonly name: "ModelNotReadyException";
readonly $fault: "client";
$retryable: {};
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ModelNotReadyException, __BaseException>);
}
/**
* <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
* @public
*/
export declare class ModelTimeoutException extends __BaseException {
readonly name: "ModelTimeoutException";
readonly $fault: "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ModelTimeoutException, __BaseException>);
}
/**
* <p>An error occurred while streaming the response. Retry your request.</p>
* @public
*/
export declare class ModelStreamErrorException extends __BaseException {
readonly name: "ModelStreamErrorException";
readonly $fault: "client";
/**
* <p>The original status code.</p>
* @public
*/
originalStatusCode?: number | undefined;
/**
* <p>The original message.</p>
* @public
*/
originalMessage?: string | undefined;
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ModelStreamErrorException, __BaseException>);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
import type { PaginationConfiguration } from "@smithy/types";
import { BedrockRuntimeClient } from "../BedrockRuntimeClient";
/**
* @public
*/
export interface BedrockRuntimePaginationConfiguration extends PaginationConfiguration {
client: BedrockRuntimeClient;
}

View File

@@ -0,0 +1,7 @@
import type { Paginator } from "@smithy/types";
import { ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput } from "../commands/ListAsyncInvokesCommand";
import type { BedrockRuntimePaginationConfiguration } from "./Interfaces";
/**
* @public
*/
export declare const paginateListAsyncInvokes: (config: BedrockRuntimePaginationConfiguration, input: ListAsyncInvokesCommandInput, ...rest: any[]) => Paginator<ListAsyncInvokesCommandOutput>;

View File

@@ -0,0 +1,2 @@
export * from "./Interfaces";
export * from "./ListAsyncInvokesPaginator";

View File

@@ -0,0 +1,66 @@
import { WebSocketFetchHandler as WebSocketRequestHandler } from "@aws-sdk/middleware-websocket";
import type { BedrockRuntimeClientConfig } from "./BedrockRuntimeClient";
/**
* @internal
*/
export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
runtime: string;
defaultsMode: import("@smithy/types").Provider<import("@smithy/smithy-client").ResolvedDefaultsMode>;
bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
credentialDefaultProvider: ((input: any) => import("@smithy/types").AwsCredentialIdentityProvider) | ((_: unknown) => () => Promise<import("@smithy/types").AwsCredentialIdentity>);
defaultUserAgentProvider: (config?: import("@aws-sdk/util-user-agent-browser").PreviouslyResolved) => Promise<import("@smithy/types").UserAgent>;
eventStreamPayloadHandlerProvider: import("@smithy/types").EventStreamPayloadHandlerProvider;
eventStreamSerdeProvider: import("@smithy/types").EventStreamSerdeProvider;
maxAttempts: number | import("@smithy/types").Provider<number>;
region: string | import("@smithy/types").Provider<any>;
requestHandler: WebSocketRequestHandler;
retryMode: string | import("@smithy/types").Provider<string>;
sha256: import("@smithy/types").HashConstructor;
streamCollector: import("@smithy/types").StreamCollector;
useDualstackEndpoint: (boolean | import("@smithy/types").Provider<boolean>) & (boolean | import("@smithy/types").Provider<boolean | undefined>);
useFipsEndpoint: (boolean | import("@smithy/types").Provider<boolean>) & (boolean | import("@smithy/types").Provider<boolean | undefined>);
cacheMiddleware?: boolean | undefined;
protocol: import("@smithy/types").ClientProtocol<any, any> | import("@smithy/types").ClientProtocolCtor<any, any> | typeof import("@aws-sdk/core/protocols").AwsRestJsonProtocol;
protocolSettings: {
defaultNamespace?: string;
[setting: string]: unknown;
};
apiVersion: string;
urlParser: import("@smithy/types").UrlParser;
base64Decoder: import("@smithy/types").Decoder;
base64Encoder: (_input: Uint8Array | string) => string;
utf8Decoder: import("@smithy/types").Decoder;
utf8Encoder: (input: Uint8Array | string) => string;
disableHostPrefix: boolean;
serviceId: string;
profile?: string;
logger: import("@smithy/types").Logger;
extensions: import("./runtimeExtensions").RuntimeExtension[];
customUserAgent?: string | import("@smithy/types").UserAgent;
userAgentAppId?: string | undefined | import("@smithy/types").Provider<string | undefined>;
retryStrategy?: import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2;
endpoint?: ((string | import("@smithy/types").Endpoint | import("@smithy/types").Provider<import("@smithy/types").Endpoint> | import("@smithy/types").EndpointV2 | import("@smithy/types").Provider<import("@smithy/types").EndpointV2>) & (string | import("@smithy/types").Provider<string> | import("@smithy/types").Endpoint | import("@smithy/types").Provider<import("@smithy/types").Endpoint> | import("@smithy/types").EndpointV2 | import("@smithy/types").Provider<import("@smithy/types").EndpointV2>)) | undefined;
endpointProvider: (endpointParams: import("./endpoint/EndpointParameters").EndpointParameters, context?: {
logger?: import("@smithy/types").Logger;
}) => import("@smithy/types").EndpointV2;
tls?: boolean;
serviceConfiguredEndpoint?: never;
authSchemePreference?: string[] | import("@smithy/types").Provider<string[]>;
httpAuthSchemes: ({
schemeId: string;
identityProvider: (ipc: import("@smithy/types").IdentityProviderConfig) => import("@smithy/types").IdentityProvider<import("@smithy/types").Identity> | undefined;
signer: import("@aws-sdk/core/httpAuthSchemes").AwsSdkSigV4Signer;
} | {
schemeId: string;
identityProvider: (ipc: import("@smithy/types").IdentityProviderConfig) => import("@smithy/types").IdentityProvider<import("@smithy/types").Identity> | undefined;
signer: import("@smithy/core").HttpBearerAuthSigner;
})[];
httpAuthSchemeProvider: import("./auth/httpAuthSchemeProvider").BedrockRuntimeHttpAuthSchemeProvider;
token?: import("@smithy/types").TokenIdentity | import("@smithy/types").TokenIdentityProvider;
credentials?: import("@smithy/types").AwsCredentialIdentity | import("@smithy/types").AwsCredentialIdentityProvider;
signer?: import("@smithy/types").RequestSigner | ((authScheme?: import("@smithy/types").AuthScheme) => Promise<import("@smithy/types").RequestSigner>);
signingEscapePath?: boolean;
systemClockOffset?: number;
signingRegion?: string;
signerConstructor?: new (options: import("@smithy/signature-v4").SignatureV4Init & import("@smithy/signature-v4").SignatureV4CryptoInit) => import("@smithy/types").RequestSigner;
};

View File

@@ -0,0 +1,69 @@
import { AwsSdkSigV4Signer } from "@aws-sdk/core/httpAuthSchemes";
import { HttpBearerAuthSigner } from "@smithy/core";
import { NodeHttp2Handler as RequestHandler } from "@smithy/node-http-handler";
import type { IdentityProviderConfig } from "@smithy/types";
import type { BedrockRuntimeClientConfig } from "./BedrockRuntimeClient";
/**
* @internal
*/
export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
runtime: string;
defaultsMode: import("@smithy/types").Provider<import("@smithy/smithy-client").ResolvedDefaultsMode>;
authSchemePreference: string[] | import("@smithy/types").Provider<string[]>;
bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
credentialDefaultProvider: ((input: any) => import("@smithy/types").AwsCredentialIdentityProvider) | ((init?: import("@aws-sdk/credential-provider-node").DefaultProviderInit) => import("@aws-sdk/credential-provider-node/dist-types/runtime/memoize-chain").MemoizedRuntimeConfigAwsCredentialIdentityProvider);
defaultUserAgentProvider: (config?: import("@aws-sdk/util-user-agent-node").PreviouslyResolved) => Promise<import("@smithy/types").UserAgent>;
eventStreamPayloadHandlerProvider: import("@smithy/types").EventStreamPayloadHandlerProvider;
eventStreamSerdeProvider: import("@smithy/types").EventStreamSerdeProvider;
httpAuthSchemes: import("@smithy/types").HttpAuthScheme[] | ({
schemeId: string;
identityProvider: (ipc: IdentityProviderConfig) => import("@smithy/types").IdentityProvider<import("@smithy/types").Identity> | undefined;
signer: AwsSdkSigV4Signer;
} | {
schemeId: string;
identityProvider: (ipc: IdentityProviderConfig) => import("@smithy/types").IdentityProvider<import("@smithy/types").Identity>;
signer: HttpBearerAuthSigner;
})[];
maxAttempts: number | import("@smithy/types").Provider<number>;
region: string | import("@smithy/types").Provider<string>;
requestHandler: RequestHandler | import("@smithy/protocol-http").HttpHandler<any>;
retryMode: string | import("@smithy/types").Provider<string>;
sha256: import("@smithy/types").HashConstructor;
streamCollector: import("@smithy/types").StreamCollector;
useDualstackEndpoint: boolean | import("@smithy/types").Provider<boolean>;
useFipsEndpoint: boolean | import("@smithy/types").Provider<boolean>;
userAgentAppId: string | import("@smithy/types").Provider<string | undefined>;
cacheMiddleware?: boolean | undefined;
protocol: import("@smithy/types").ClientProtocol<any, any> | import("@smithy/types").ClientProtocolCtor<any, any> | typeof import("@aws-sdk/core/protocols").AwsRestJsonProtocol;
protocolSettings: {
defaultNamespace?: string;
[setting: string]: unknown;
};
apiVersion: string;
urlParser: import("@smithy/types").UrlParser;
base64Decoder: import("@smithy/types").Decoder;
base64Encoder: (_input: Uint8Array | string) => string;
utf8Decoder: import("@smithy/types").Decoder;
utf8Encoder: (input: Uint8Array | string) => string;
disableHostPrefix: boolean;
serviceId: string;
profile?: string;
logger: import("@smithy/types").Logger;
extensions: import("./runtimeExtensions").RuntimeExtension[];
customUserAgent?: string | import("@smithy/types").UserAgent;
retryStrategy?: import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2;
endpoint?: ((string | import("@smithy/types").Endpoint | import("@smithy/types").Provider<import("@smithy/types").Endpoint> | import("@smithy/types").EndpointV2 | import("@smithy/types").Provider<import("@smithy/types").EndpointV2>) & (string | import("@smithy/types").Provider<string> | import("@smithy/types").Endpoint | import("@smithy/types").Provider<import("@smithy/types").Endpoint> | import("@smithy/types").EndpointV2 | import("@smithy/types").Provider<import("@smithy/types").EndpointV2>)) | undefined;
endpointProvider: (endpointParams: import("./endpoint/EndpointParameters").EndpointParameters, context?: {
logger?: import("@smithy/types").Logger;
}) => import("@smithy/types").EndpointV2;
tls?: boolean;
serviceConfiguredEndpoint?: never;
httpAuthSchemeProvider: import("./auth/httpAuthSchemeProvider").BedrockRuntimeHttpAuthSchemeProvider;
token?: import("@smithy/types").TokenIdentity | import("@smithy/types").TokenIdentityProvider;
credentials?: import("@smithy/types").AwsCredentialIdentity | import("@smithy/types").AwsCredentialIdentityProvider;
signer?: import("@smithy/types").RequestSigner | ((authScheme?: import("@smithy/types").AuthScheme) => Promise<import("@smithy/types").RequestSigner>);
signingEscapePath?: boolean;
systemClockOffset?: number;
signingRegion?: string;
signerConstructor?: new (options: import("@smithy/signature-v4").SignatureV4Init & import("@smithy/signature-v4").SignatureV4CryptoInit) => import("@smithy/types").RequestSigner;
};

View File

@@ -0,0 +1,68 @@
import type { BedrockRuntimeClientConfig } from "./BedrockRuntimeClient";
/**
* @internal
*/
export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
runtime: string;
eventStreamPayloadHandlerProvider: import("@smithy/types").EventStreamPayloadHandlerProvider;
sha256: import("@smithy/types").HashConstructor;
requestHandler: import("@smithy/types").NodeHttpHandlerOptions | import("@smithy/types").FetchHttpHandlerOptions | Record<string, unknown> | (import("@smithy/types").RequestHandler<any, any, import("@smithy/types").HttpHandlerOptions> & import("@smithy/types").RequestHandler<import("@smithy/protocol-http").HttpRequest, import("@smithy/protocol-http").HttpResponse, import("@smithy/types").HttpHandlerOptions> & {
updateHttpClientConfig(key: never, value: never): void;
httpHandlerConfigs(): {};
}) | import("@aws-sdk/middleware-websocket").WebSocketFetchHandler;
cacheMiddleware?: boolean;
protocol: import("@smithy/types").ClientProtocol<any, any> | import("@smithy/types").ClientProtocolCtor<any, any> | typeof import("@aws-sdk/core/protocols").AwsRestJsonProtocol;
protocolSettings: {
defaultNamespace?: string;
[setting: string]: unknown;
};
apiVersion: string;
urlParser: import("@smithy/types").UrlParser;
bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
streamCollector: import("@smithy/types").StreamCollector;
base64Decoder: import("@smithy/types").Decoder;
base64Encoder: (_input: Uint8Array | string) => string;
utf8Decoder: import("@smithy/types").Decoder;
utf8Encoder: (input: Uint8Array | string) => string;
disableHostPrefix: boolean;
serviceId: string;
useDualstackEndpoint: (boolean | import("@smithy/types").Provider<boolean>) & (boolean | import("@smithy/types").Provider<boolean | undefined>);
useFipsEndpoint: (boolean | import("@smithy/types").Provider<boolean>) & (boolean | import("@smithy/types").Provider<boolean | undefined>);
region: string | import("@smithy/types").Provider<any>;
profile?: string;
defaultUserAgentProvider: (config?: import("@aws-sdk/util-user-agent-browser").PreviouslyResolved) => Promise<import("@smithy/types").UserAgent>;
credentialDefaultProvider: ((input: any) => import("@smithy/types").AwsCredentialIdentityProvider) | ((_: unknown) => () => Promise<import("@smithy/types").AwsCredentialIdentity>);
maxAttempts: number | import("@smithy/types").Provider<number>;
retryMode: string | import("@smithy/types").Provider<string>;
logger: import("@smithy/types").Logger;
extensions: import("./runtimeExtensions").RuntimeExtension[];
eventStreamSerdeProvider: import("@smithy/types").EventStreamSerdeProvider;
defaultsMode: import("@smithy/smithy-client").DefaultsMode | import("@smithy/types").Provider<import("@smithy/smithy-client").DefaultsMode>;
customUserAgent?: string | import("@smithy/types").UserAgent;
userAgentAppId?: string | undefined | import("@smithy/types").Provider<string | undefined>;
retryStrategy?: import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2;
endpoint?: ((string | import("@smithy/types").Endpoint | import("@smithy/types").Provider<import("@smithy/types").Endpoint> | import("@smithy/types").EndpointV2 | import("@smithy/types").Provider<import("@smithy/types").EndpointV2>) & (string | import("@smithy/types").Provider<string> | import("@smithy/types").Endpoint | import("@smithy/types").Provider<import("@smithy/types").Endpoint> | import("@smithy/types").EndpointV2 | import("@smithy/types").Provider<import("@smithy/types").EndpointV2>)) | undefined;
endpointProvider: (endpointParams: import("./endpoint/EndpointParameters").EndpointParameters, context?: {
logger?: import("@smithy/types").Logger;
}) => import("@smithy/types").EndpointV2;
tls?: boolean;
serviceConfiguredEndpoint?: never;
authSchemePreference?: string[] | import("@smithy/types").Provider<string[]>;
httpAuthSchemes: ({
schemeId: string;
identityProvider: (ipc: import("@smithy/types").IdentityProviderConfig) => import("@smithy/types").IdentityProvider<import("@smithy/types").Identity> | undefined;
signer: import("@aws-sdk/core/httpAuthSchemes").AwsSdkSigV4Signer;
} | {
schemeId: string;
identityProvider: (ipc: import("@smithy/types").IdentityProviderConfig) => import("@smithy/types").IdentityProvider<import("@smithy/types").Identity> | undefined;
signer: import("@smithy/core").HttpBearerAuthSigner;
})[];
httpAuthSchemeProvider: import("./auth/httpAuthSchemeProvider").BedrockRuntimeHttpAuthSchemeProvider;
token?: import("@smithy/types").TokenIdentity | import("@smithy/types").TokenIdentityProvider;
credentials?: import("@smithy/types").AwsCredentialIdentity | import("@smithy/types").AwsCredentialIdentityProvider;
signer?: import("@smithy/types").RequestSigner | ((authScheme?: import("@smithy/types").AuthScheme) => Promise<import("@smithy/types").RequestSigner>);
signingEscapePath?: boolean;
systemClockOffset?: number;
signingRegion?: string;
signerConstructor?: new (options: import("@smithy/signature-v4").SignatureV4Init & import("@smithy/signature-v4").SignatureV4CryptoInit) => import("@smithy/types").RequestSigner;
};

View File

@@ -0,0 +1,38 @@
import { AwsSdkSigV4Signer } from "@aws-sdk/core/httpAuthSchemes";
import { AwsRestJsonProtocol } from "@aws-sdk/core/protocols";
import { HttpBearerAuthSigner } from "@smithy/core";
import type { IdentityProviderConfig } from "@smithy/types";
import type { BedrockRuntimeClientConfig } from "./BedrockRuntimeClient";
/**
* @internal
*/
export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
apiVersion: string;
base64Decoder: import("@smithy/types").Decoder;
base64Encoder: (_input: Uint8Array | string) => string;
disableHostPrefix: boolean;
endpointProvider: (endpointParams: import("./endpoint/EndpointParameters").EndpointParameters, context?: {
logger?: import("@smithy/types").Logger;
}) => import("@smithy/types").EndpointV2;
extensions: import("./runtimeExtensions").RuntimeExtension[];
httpAuthSchemeProvider: import("./auth/httpAuthSchemeProvider").BedrockRuntimeHttpAuthSchemeProvider;
httpAuthSchemes: ({
schemeId: string;
identityProvider: (ipc: IdentityProviderConfig) => import("@smithy/types").IdentityProvider<import("@smithy/types").Identity> | undefined;
signer: AwsSdkSigV4Signer;
} | {
schemeId: string;
identityProvider: (ipc: IdentityProviderConfig) => import("@smithy/types").IdentityProvider<import("@smithy/types").Identity> | undefined;
signer: HttpBearerAuthSigner;
})[];
logger: import("@smithy/types").Logger;
protocol: import("@smithy/types").ClientProtocol<any, any> | import("@smithy/types").ClientProtocolCtor<any, any> | typeof AwsRestJsonProtocol;
protocolSettings: {
[setting: string]: unknown;
defaultNamespace?: string;
};
serviceId: string;
urlParser: import("@smithy/types").UrlParser;
utf8Decoder: import("@smithy/types").Decoder;
utf8Encoder: (input: Uint8Array | string) => string;
};

View File

@@ -0,0 +1,17 @@
import type { BedrockRuntimeExtensionConfiguration } from "./extensionConfiguration";
/**
* @public
*/
export interface RuntimeExtension {
configure(extensionConfiguration: BedrockRuntimeExtensionConfiguration): void;
}
/**
* @public
*/
export interface RuntimeExtensionsConfig {
extensions: RuntimeExtension[];
}
/**
* @internal
*/
export declare const resolveRuntimeExtensions: (runtimeConfig: any, extensions: RuntimeExtension[]) => any;

View File

@@ -0,0 +1,187 @@
import { TypeRegistry } from "@smithy/core/schema";
import type { StaticErrorSchema, StaticOperationSchema, StaticStructureSchema, StaticUnionSchema } from "@smithy/types";
export declare var BedrockRuntimeServiceException$: StaticErrorSchema;
export declare var AccessDeniedException$: StaticErrorSchema;
export declare var ConflictException$: StaticErrorSchema;
export declare var InternalServerException$: StaticErrorSchema;
export declare var ModelErrorException$: StaticErrorSchema;
export declare var ModelNotReadyException$: StaticErrorSchema;
export declare var ModelStreamErrorException$: StaticErrorSchema;
export declare var ModelTimeoutException$: StaticErrorSchema;
export declare var ResourceNotFoundException$: StaticErrorSchema;
export declare var ServiceQuotaExceededException$: StaticErrorSchema;
export declare var ServiceUnavailableException$: StaticErrorSchema;
export declare var ThrottlingException$: StaticErrorSchema;
export declare var ValidationException$: StaticErrorSchema;
/**
* TypeRegistry instances containing modeled errors.
* @internal
*
*/
export declare const errorTypeRegistries: TypeRegistry[];
export declare var AnyToolChoice$: StaticStructureSchema;
export declare var AppliedGuardrailDetails$: StaticStructureSchema;
export declare var ApplyGuardrailRequest$: StaticStructureSchema;
export declare var ApplyGuardrailResponse$: StaticStructureSchema;
export declare var AsyncInvokeS3OutputDataConfig$: StaticStructureSchema;
export declare var AsyncInvokeSummary$: StaticStructureSchema;
export declare var AudioBlock$: StaticStructureSchema;
export declare var AutoToolChoice$: StaticStructureSchema;
export declare var BidirectionalInputPayloadPart$: StaticStructureSchema;
export declare var BidirectionalOutputPayloadPart$: StaticStructureSchema;
export declare var CacheDetail$: StaticStructureSchema;
export declare var CachePointBlock$: StaticStructureSchema;
export declare var Citation$: StaticStructureSchema;
export declare var CitationsConfig$: StaticStructureSchema;
export declare var CitationsContentBlock$: StaticStructureSchema;
export declare var CitationsDelta$: StaticStructureSchema;
export declare var CitationSourceContentDelta$: StaticStructureSchema;
export declare var ContentBlockDeltaEvent$: StaticStructureSchema;
export declare var ContentBlockStartEvent$: StaticStructureSchema;
export declare var ContentBlockStopEvent$: StaticStructureSchema;
export declare var ConverseMetrics$: StaticStructureSchema;
export declare var ConverseRequest$: StaticStructureSchema;
export declare var ConverseResponse$: StaticStructureSchema;
export declare var ConverseStreamMetadataEvent$: StaticStructureSchema;
export declare var ConverseStreamMetrics$: StaticStructureSchema;
export declare var ConverseStreamRequest$: StaticStructureSchema;
export declare var ConverseStreamResponse$: StaticStructureSchema;
export declare var ConverseStreamTrace$: StaticStructureSchema;
export declare var ConverseTokensRequest$: StaticStructureSchema;
export declare var ConverseTrace$: StaticStructureSchema;
export declare var CountTokensRequest$: StaticStructureSchema;
export declare var CountTokensResponse$: StaticStructureSchema;
export declare var DocumentBlock$: StaticStructureSchema;
export declare var DocumentCharLocation$: StaticStructureSchema;
export declare var DocumentChunkLocation$: StaticStructureSchema;
export declare var DocumentPageLocation$: StaticStructureSchema;
export declare var ErrorBlock$: StaticStructureSchema;
export declare var GetAsyncInvokeRequest$: StaticStructureSchema;
export declare var GetAsyncInvokeResponse$: StaticStructureSchema;
export declare var GuardrailAssessment$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningImpossibleFinding$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningInputTextReference$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningInvalidFinding$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningLogicWarning$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningNoTranslationsFinding$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningPolicyAssessment$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningRule$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningSatisfiableFinding$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningScenario$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningStatement$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningTooComplexFinding$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningTranslation$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningTranslationAmbiguousFinding$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningTranslationOption$: StaticStructureSchema;
export declare var GuardrailAutomatedReasoningValidFinding$: StaticStructureSchema;
export declare var GuardrailConfiguration$: StaticStructureSchema;
export declare var GuardrailContentFilter$: StaticStructureSchema;
export declare var GuardrailContentPolicyAssessment$: StaticStructureSchema;
export declare var GuardrailContextualGroundingFilter$: StaticStructureSchema;
export declare var GuardrailContextualGroundingPolicyAssessment$: StaticStructureSchema;
export declare var GuardrailConverseImageBlock$: StaticStructureSchema;
export declare var GuardrailConverseTextBlock$: StaticStructureSchema;
export declare var GuardrailCoverage$: StaticStructureSchema;
export declare var GuardrailCustomWord$: StaticStructureSchema;
export declare var GuardrailImageBlock$: StaticStructureSchema;
export declare var GuardrailImageCoverage$: StaticStructureSchema;
export declare var GuardrailInvocationMetrics$: StaticStructureSchema;
export declare var GuardrailManagedWord$: StaticStructureSchema;
export declare var GuardrailOutputContent$: StaticStructureSchema;
export declare var GuardrailPiiEntityFilter$: StaticStructureSchema;
export declare var GuardrailRegexFilter$: StaticStructureSchema;
export declare var GuardrailSensitiveInformationPolicyAssessment$: StaticStructureSchema;
export declare var GuardrailStreamConfiguration$: StaticStructureSchema;
export declare var GuardrailTextBlock$: StaticStructureSchema;
export declare var GuardrailTextCharactersCoverage$: StaticStructureSchema;
export declare var GuardrailTopic$: StaticStructureSchema;
export declare var GuardrailTopicPolicyAssessment$: StaticStructureSchema;
export declare var GuardrailTraceAssessment$: StaticStructureSchema;
export declare var GuardrailUsage$: StaticStructureSchema;
export declare var GuardrailWordPolicyAssessment$: StaticStructureSchema;
export declare var ImageBlock$: StaticStructureSchema;
export declare var ImageBlockDelta$: StaticStructureSchema;
export declare var ImageBlockStart$: StaticStructureSchema;
export declare var InferenceConfiguration$: StaticStructureSchema;
export declare var InvokeModelRequest$: StaticStructureSchema;
export declare var InvokeModelResponse$: StaticStructureSchema;
export declare var InvokeModelTokensRequest$: StaticStructureSchema;
export declare var InvokeModelWithBidirectionalStreamRequest$: StaticStructureSchema;
export declare var InvokeModelWithBidirectionalStreamResponse$: StaticStructureSchema;
export declare var InvokeModelWithResponseStreamRequest$: StaticStructureSchema;
export declare var InvokeModelWithResponseStreamResponse$: StaticStructureSchema;
export declare var JsonSchemaDefinition$: StaticStructureSchema;
export declare var ListAsyncInvokesRequest$: StaticStructureSchema;
export declare var ListAsyncInvokesResponse$: StaticStructureSchema;
export declare var Message$: StaticStructureSchema;
export declare var MessageStartEvent$: StaticStructureSchema;
export declare var MessageStopEvent$: StaticStructureSchema;
export declare var OutputConfig$: StaticStructureSchema;
export declare var OutputFormat$: StaticStructureSchema;
export declare var PayloadPart$: StaticStructureSchema;
export declare var PerformanceConfiguration$: StaticStructureSchema;
export declare var PromptRouterTrace$: StaticStructureSchema;
export declare var ReasoningTextBlock$: StaticStructureSchema;
export declare var S3Location$: StaticStructureSchema;
export declare var SearchResultBlock$: StaticStructureSchema;
export declare var SearchResultContentBlock$: StaticStructureSchema;
export declare var SearchResultLocation$: StaticStructureSchema;
export declare var ServiceTier$: StaticStructureSchema;
export declare var SpecificToolChoice$: StaticStructureSchema;
export declare var StartAsyncInvokeRequest$: StaticStructureSchema;
export declare var StartAsyncInvokeResponse$: StaticStructureSchema;
export declare var SystemTool$: StaticStructureSchema;
export declare var Tag$: StaticStructureSchema;
export declare var TokenUsage$: StaticStructureSchema;
export declare var ToolConfiguration$: StaticStructureSchema;
export declare var ToolResultBlock$: StaticStructureSchema;
export declare var ToolResultBlockStart$: StaticStructureSchema;
export declare var ToolSpecification$: StaticStructureSchema;
export declare var ToolUseBlock$: StaticStructureSchema;
export declare var ToolUseBlockDelta$: StaticStructureSchema;
export declare var ToolUseBlockStart$: StaticStructureSchema;
export declare var VideoBlock$: StaticStructureSchema;
export declare var WebLocation$: StaticStructureSchema;
export declare var AsyncInvokeOutputDataConfig$: StaticUnionSchema;
export declare var AudioSource$: StaticUnionSchema;
export declare var CitationGeneratedContent$: StaticUnionSchema;
export declare var CitationLocation$: StaticUnionSchema;
export declare var CitationSourceContent$: StaticUnionSchema;
export declare var ContentBlock$: StaticUnionSchema;
export declare var ContentBlockDelta$: StaticUnionSchema;
export declare var ContentBlockStart$: StaticUnionSchema;
export declare var ConverseOutput$: StaticUnionSchema;
export declare var ConverseStreamOutput$: StaticUnionSchema;
export declare var CountTokensInput$: StaticUnionSchema;
export declare var DocumentContentBlock$: StaticUnionSchema;
export declare var DocumentSource$: StaticUnionSchema;
export declare var GuardrailAutomatedReasoningFinding$: StaticUnionSchema;
export declare var GuardrailContentBlock$: StaticUnionSchema;
export declare var GuardrailConverseContentBlock$: StaticUnionSchema;
export declare var GuardrailConverseImageSource$: StaticUnionSchema;
export declare var GuardrailImageSource$: StaticUnionSchema;
export declare var ImageSource$: StaticUnionSchema;
export declare var InvokeModelWithBidirectionalStreamInput$: StaticUnionSchema;
export declare var InvokeModelWithBidirectionalStreamOutput$: StaticUnionSchema;
export declare var OutputFormatStructure$: StaticUnionSchema;
export declare var PromptVariableValues$: StaticUnionSchema;
export declare var ReasoningContentBlock$: StaticUnionSchema;
export declare var ReasoningContentBlockDelta$: StaticUnionSchema;
export declare var ResponseStream$: StaticUnionSchema;
export declare var SystemContentBlock$: StaticUnionSchema;
export declare var Tool$: StaticUnionSchema;
export declare var ToolChoice$: StaticUnionSchema;
export declare var ToolInputSchema$: StaticUnionSchema;
export declare var ToolResultBlockDelta$: StaticUnionSchema;
export declare var ToolResultContentBlock$: StaticUnionSchema;
export declare var VideoSource$: StaticUnionSchema;
export declare var ApplyGuardrail$: StaticOperationSchema;
export declare var Converse$: StaticOperationSchema;
export declare var ConverseStream$: StaticOperationSchema;
export declare var CountTokens$: StaticOperationSchema;
export declare var GetAsyncInvoke$: StaticOperationSchema;
export declare var InvokeModel$: StaticOperationSchema;
export declare var InvokeModelWithBidirectionalStream$: StaticOperationSchema;
export declare var InvokeModelWithResponseStream$: StaticOperationSchema;
export declare var ListAsyncInvokes$: StaticOperationSchema;
export declare var StartAsyncInvoke$: StaticOperationSchema;

View File

@@ -0,0 +1,195 @@
import {
HttpHandlerOptions as __HttpHandlerOptions,
PaginationConfiguration,
Paginator,
} from "@smithy/types";
import { BedrockRuntimeClient } from "./BedrockRuntimeClient";
import {
ApplyGuardrailCommandInput,
ApplyGuardrailCommandOutput,
} from "./commands/ApplyGuardrailCommand";
import {
ConverseCommandInput,
ConverseCommandOutput,
} from "./commands/ConverseCommand";
import {
ConverseStreamCommandInput,
ConverseStreamCommandOutput,
} from "./commands/ConverseStreamCommand";
import {
CountTokensCommandInput,
CountTokensCommandOutput,
} from "./commands/CountTokensCommand";
import {
GetAsyncInvokeCommandInput,
GetAsyncInvokeCommandOutput,
} from "./commands/GetAsyncInvokeCommand";
import {
InvokeModelCommandInput,
InvokeModelCommandOutput,
} from "./commands/InvokeModelCommand";
import {
InvokeModelWithBidirectionalStreamCommandInput,
InvokeModelWithBidirectionalStreamCommandOutput,
} from "./commands/InvokeModelWithBidirectionalStreamCommand";
import {
InvokeModelWithResponseStreamCommandInput,
InvokeModelWithResponseStreamCommandOutput,
} from "./commands/InvokeModelWithResponseStreamCommand";
import {
ListAsyncInvokesCommandInput,
ListAsyncInvokesCommandOutput,
} from "./commands/ListAsyncInvokesCommand";
import {
StartAsyncInvokeCommandInput,
StartAsyncInvokeCommandOutput,
} from "./commands/StartAsyncInvokeCommand";
export interface BedrockRuntime {
applyGuardrail(
args: ApplyGuardrailCommandInput,
options?: __HttpHandlerOptions
): Promise<ApplyGuardrailCommandOutput>;
applyGuardrail(
args: ApplyGuardrailCommandInput,
cb: (err: any, data?: ApplyGuardrailCommandOutput) => void
): void;
applyGuardrail(
args: ApplyGuardrailCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ApplyGuardrailCommandOutput) => void
): void;
converse(
args: ConverseCommandInput,
options?: __HttpHandlerOptions
): Promise<ConverseCommandOutput>;
converse(
args: ConverseCommandInput,
cb: (err: any, data?: ConverseCommandOutput) => void
): void;
converse(
args: ConverseCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ConverseCommandOutput) => void
): void;
converseStream(
args: ConverseStreamCommandInput,
options?: __HttpHandlerOptions
): Promise<ConverseStreamCommandOutput>;
converseStream(
args: ConverseStreamCommandInput,
cb: (err: any, data?: ConverseStreamCommandOutput) => void
): void;
converseStream(
args: ConverseStreamCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ConverseStreamCommandOutput) => void
): void;
countTokens(
args: CountTokensCommandInput,
options?: __HttpHandlerOptions
): Promise<CountTokensCommandOutput>;
countTokens(
args: CountTokensCommandInput,
cb: (err: any, data?: CountTokensCommandOutput) => void
): void;
countTokens(
args: CountTokensCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: CountTokensCommandOutput) => void
): void;
getAsyncInvoke(
args: GetAsyncInvokeCommandInput,
options?: __HttpHandlerOptions
): Promise<GetAsyncInvokeCommandOutput>;
getAsyncInvoke(
args: GetAsyncInvokeCommandInput,
cb: (err: any, data?: GetAsyncInvokeCommandOutput) => void
): void;
getAsyncInvoke(
args: GetAsyncInvokeCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetAsyncInvokeCommandOutput) => void
): void;
invokeModel(
args: InvokeModelCommandInput,
options?: __HttpHandlerOptions
): Promise<InvokeModelCommandOutput>;
invokeModel(
args: InvokeModelCommandInput,
cb: (err: any, data?: InvokeModelCommandOutput) => void
): void;
invokeModel(
args: InvokeModelCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: InvokeModelCommandOutput) => void
): void;
invokeModelWithBidirectionalStream(
args: InvokeModelWithBidirectionalStreamCommandInput,
options?: __HttpHandlerOptions
): Promise<InvokeModelWithBidirectionalStreamCommandOutput>;
invokeModelWithBidirectionalStream(
args: InvokeModelWithBidirectionalStreamCommandInput,
cb: (
err: any,
data?: InvokeModelWithBidirectionalStreamCommandOutput
) => void
): void;
invokeModelWithBidirectionalStream(
args: InvokeModelWithBidirectionalStreamCommandInput,
options: __HttpHandlerOptions,
cb: (
err: any,
data?: InvokeModelWithBidirectionalStreamCommandOutput
) => void
): void;
invokeModelWithResponseStream(
args: InvokeModelWithResponseStreamCommandInput,
options?: __HttpHandlerOptions
): Promise<InvokeModelWithResponseStreamCommandOutput>;
invokeModelWithResponseStream(
args: InvokeModelWithResponseStreamCommandInput,
cb: (err: any, data?: InvokeModelWithResponseStreamCommandOutput) => void
): void;
invokeModelWithResponseStream(
args: InvokeModelWithResponseStreamCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: InvokeModelWithResponseStreamCommandOutput) => void
): void;
listAsyncInvokes(): Promise<ListAsyncInvokesCommandOutput>;
listAsyncInvokes(
args: ListAsyncInvokesCommandInput,
options?: __HttpHandlerOptions
): Promise<ListAsyncInvokesCommandOutput>;
listAsyncInvokes(
args: ListAsyncInvokesCommandInput,
cb: (err: any, data?: ListAsyncInvokesCommandOutput) => void
): void;
listAsyncInvokes(
args: ListAsyncInvokesCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListAsyncInvokesCommandOutput) => void
): void;
startAsyncInvoke(
args: StartAsyncInvokeCommandInput,
options?: __HttpHandlerOptions
): Promise<StartAsyncInvokeCommandOutput>;
startAsyncInvoke(
args: StartAsyncInvokeCommandInput,
cb: (err: any, data?: StartAsyncInvokeCommandOutput) => void
): void;
startAsyncInvoke(
args: StartAsyncInvokeCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: StartAsyncInvokeCommandOutput) => void
): void;
paginateListAsyncInvokes(
args?: ListAsyncInvokesCommandInput,
paginationConfig?: Pick<
PaginationConfiguration,
Exclude<keyof PaginationConfiguration, "client">
>
): Paginator<ListAsyncInvokesCommandOutput>;
}
export declare class BedrockRuntime
extends BedrockRuntimeClient
implements BedrockRuntime {}

View File

@@ -0,0 +1,201 @@
import {
EventStreamInputConfig,
EventStreamResolvedConfig,
} from "@aws-sdk/middleware-eventstream";
import {
HostHeaderInputConfig,
HostHeaderResolvedConfig,
} from "@aws-sdk/middleware-host-header";
import {
UserAgentInputConfig,
UserAgentResolvedConfig,
} from "@aws-sdk/middleware-user-agent";
import {
WebSocketInputConfig,
WebSocketResolvedConfig,
} from "@aws-sdk/middleware-websocket";
import { EventStreamPayloadHandlerProvider as __EventStreamPayloadHandlerProvider } from "@aws-sdk/types";
import {
RegionInputConfig,
RegionResolvedConfig,
} from "@smithy/config-resolver";
import {
EventStreamSerdeInputConfig,
EventStreamSerdeResolvedConfig,
} from "@smithy/eventstream-serde-config-resolver";
import {
EndpointInputConfig,
EndpointResolvedConfig,
} from "@smithy/middleware-endpoint";
import {
RetryInputConfig,
RetryResolvedConfig,
} from "@smithy/middleware-retry";
import { HttpHandlerUserInput as __HttpHandlerUserInput } from "@smithy/protocol-http";
import {
DefaultsMode as __DefaultsMode,
SmithyConfiguration as __SmithyConfiguration,
SmithyResolvedConfiguration as __SmithyResolvedConfiguration,
Client as __Client,
} from "@smithy/smithy-client";
import {
AwsCredentialIdentityProvider,
BodyLengthCalculator as __BodyLengthCalculator,
CheckOptionalClientConfig as __CheckOptionalClientConfig,
ChecksumConstructor as __ChecksumConstructor,
Decoder as __Decoder,
Encoder as __Encoder,
EventStreamSerdeProvider as __EventStreamSerdeProvider,
HashConstructor as __HashConstructor,
HttpHandlerOptions as __HttpHandlerOptions,
Logger as __Logger,
Provider as __Provider,
StreamCollector as __StreamCollector,
UrlParser as __UrlParser,
UserAgent as __UserAgent,
} from "@smithy/types";
import {
HttpAuthSchemeInputConfig,
HttpAuthSchemeResolvedConfig,
} from "./auth/httpAuthSchemeProvider";
import {
ApplyGuardrailCommandInput,
ApplyGuardrailCommandOutput,
} from "./commands/ApplyGuardrailCommand";
import {
ConverseCommandInput,
ConverseCommandOutput,
} from "./commands/ConverseCommand";
import {
ConverseStreamCommandInput,
ConverseStreamCommandOutput,
} from "./commands/ConverseStreamCommand";
import {
CountTokensCommandInput,
CountTokensCommandOutput,
} from "./commands/CountTokensCommand";
import {
GetAsyncInvokeCommandInput,
GetAsyncInvokeCommandOutput,
} from "./commands/GetAsyncInvokeCommand";
import {
InvokeModelCommandInput,
InvokeModelCommandOutput,
} from "./commands/InvokeModelCommand";
import {
InvokeModelWithBidirectionalStreamCommandInput,
InvokeModelWithBidirectionalStreamCommandOutput,
} from "./commands/InvokeModelWithBidirectionalStreamCommand";
import {
InvokeModelWithResponseStreamCommandInput,
InvokeModelWithResponseStreamCommandOutput,
} from "./commands/InvokeModelWithResponseStreamCommand";
import {
ListAsyncInvokesCommandInput,
ListAsyncInvokesCommandOutput,
} from "./commands/ListAsyncInvokesCommand";
import {
StartAsyncInvokeCommandInput,
StartAsyncInvokeCommandOutput,
} from "./commands/StartAsyncInvokeCommand";
import {
ClientInputEndpointParameters,
ClientResolvedEndpointParameters,
EndpointParameters,
} from "./endpoint/EndpointParameters";
import { RuntimeExtension, RuntimeExtensionsConfig } from "./runtimeExtensions";
export { __Client };
export type ServiceInputTypes =
| ApplyGuardrailCommandInput
| ConverseCommandInput
| ConverseStreamCommandInput
| CountTokensCommandInput
| GetAsyncInvokeCommandInput
| InvokeModelCommandInput
| InvokeModelWithBidirectionalStreamCommandInput
| InvokeModelWithResponseStreamCommandInput
| ListAsyncInvokesCommandInput
| StartAsyncInvokeCommandInput;
export type ServiceOutputTypes =
| ApplyGuardrailCommandOutput
| ConverseCommandOutput
| ConverseStreamCommandOutput
| CountTokensCommandOutput
| GetAsyncInvokeCommandOutput
| InvokeModelCommandOutput
| InvokeModelWithBidirectionalStreamCommandOutput
| InvokeModelWithResponseStreamCommandOutput
| ListAsyncInvokesCommandOutput
| StartAsyncInvokeCommandOutput;
export interface ClientDefaults
extends Partial<__SmithyConfiguration<__HttpHandlerOptions>> {
requestHandler?: __HttpHandlerUserInput;
sha256?: __ChecksumConstructor | __HashConstructor;
urlParser?: __UrlParser;
bodyLengthChecker?: __BodyLengthCalculator;
streamCollector?: __StreamCollector;
base64Decoder?: __Decoder;
base64Encoder?: __Encoder;
utf8Decoder?: __Decoder;
utf8Encoder?: __Encoder;
runtime?: string;
disableHostPrefix?: boolean;
serviceId?: string;
useDualstackEndpoint?: boolean | __Provider<boolean>;
useFipsEndpoint?: boolean | __Provider<boolean>;
region?: string | __Provider<string>;
profile?: string;
defaultUserAgentProvider?: __Provider<__UserAgent>;
credentialDefaultProvider?: (input: any) => AwsCredentialIdentityProvider;
maxAttempts?: number | __Provider<number>;
retryMode?: string | __Provider<string>;
logger?: __Logger;
extensions?: RuntimeExtension[];
eventStreamSerdeProvider?: __EventStreamSerdeProvider;
defaultsMode?: __DefaultsMode | __Provider<__DefaultsMode>;
eventStreamPayloadHandlerProvider?: __EventStreamPayloadHandlerProvider;
}
export type BedrockRuntimeClientConfigType = Partial<
__SmithyConfiguration<__HttpHandlerOptions>
> &
ClientDefaults &
UserAgentInputConfig &
RetryInputConfig &
RegionInputConfig &
HostHeaderInputConfig &
EndpointInputConfig<EndpointParameters> &
EventStreamSerdeInputConfig &
HttpAuthSchemeInputConfig &
EventStreamInputConfig &
WebSocketInputConfig &
ClientInputEndpointParameters;
export interface BedrockRuntimeClientConfig
extends BedrockRuntimeClientConfigType {}
export type BedrockRuntimeClientResolvedConfigType =
__SmithyResolvedConfiguration<__HttpHandlerOptions> &
Required<ClientDefaults> &
RuntimeExtensionsConfig &
UserAgentResolvedConfig &
RetryResolvedConfig &
RegionResolvedConfig &
HostHeaderResolvedConfig &
EndpointResolvedConfig<EndpointParameters> &
EventStreamSerdeResolvedConfig &
HttpAuthSchemeResolvedConfig &
EventStreamResolvedConfig &
WebSocketResolvedConfig &
ClientResolvedEndpointParameters;
export interface BedrockRuntimeClientResolvedConfig
extends BedrockRuntimeClientResolvedConfigType {}
export declare class BedrockRuntimeClient extends __Client<
__HttpHandlerOptions,
ServiceInputTypes,
ServiceOutputTypes,
BedrockRuntimeClientResolvedConfig
> {
readonly config: BedrockRuntimeClientResolvedConfig;
constructor(
...[configuration]: __CheckOptionalClientConfig<BedrockRuntimeClientConfig>
);
destroy(): void;
}

View File

@@ -0,0 +1,37 @@
import {
AwsCredentialIdentity,
AwsCredentialIdentityProvider,
HttpAuthScheme,
TokenIdentity,
TokenIdentityProvider,
} from "@smithy/types";
import { BedrockRuntimeHttpAuthSchemeProvider } from "./httpAuthSchemeProvider";
export interface HttpAuthExtensionConfiguration {
setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void;
httpAuthSchemes(): HttpAuthScheme[];
setHttpAuthSchemeProvider(
httpAuthSchemeProvider: BedrockRuntimeHttpAuthSchemeProvider
): void;
httpAuthSchemeProvider(): BedrockRuntimeHttpAuthSchemeProvider;
setCredentials(
credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider
): void;
credentials():
| AwsCredentialIdentity
| AwsCredentialIdentityProvider
| undefined;
setToken(token: TokenIdentity | TokenIdentityProvider): void;
token(): TokenIdentity | TokenIdentityProvider | undefined;
}
export type HttpAuthRuntimeConfig = Partial<{
httpAuthSchemes: HttpAuthScheme[];
httpAuthSchemeProvider: BedrockRuntimeHttpAuthSchemeProvider;
credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider;
token: TokenIdentity | TokenIdentityProvider;
}>;
export declare const getHttpAuthExtensionConfiguration: (
runtimeConfig: HttpAuthRuntimeConfig
) => HttpAuthExtensionConfiguration;
export declare const resolveHttpAuthRuntimeConfig: (
config: HttpAuthExtensionConfiguration
) => HttpAuthRuntimeConfig;

View File

@@ -0,0 +1,51 @@
import {
AwsSdkSigV4AuthInputConfig,
AwsSdkSigV4AuthResolvedConfig,
AwsSdkSigV4PreviouslyResolved,
} from "@aws-sdk/core/httpAuthSchemes";
import {
HandlerExecutionContext,
HttpAuthScheme,
HttpAuthSchemeParameters,
HttpAuthSchemeParametersProvider,
HttpAuthSchemeProvider,
Provider,
TokenIdentity,
TokenIdentityProvider,
} from "@smithy/types";
import { BedrockRuntimeClientResolvedConfig } from "../BedrockRuntimeClient";
export interface BedrockRuntimeHttpAuthSchemeParameters
extends HttpAuthSchemeParameters {
region?: string;
}
export interface BedrockRuntimeHttpAuthSchemeParametersProvider
extends HttpAuthSchemeParametersProvider<
BedrockRuntimeClientResolvedConfig,
HandlerExecutionContext,
BedrockRuntimeHttpAuthSchemeParameters,
object
> {}
export declare const defaultBedrockRuntimeHttpAuthSchemeParametersProvider: (
config: BedrockRuntimeClientResolvedConfig,
context: HandlerExecutionContext,
input: object
) => Promise<BedrockRuntimeHttpAuthSchemeParameters>;
export interface BedrockRuntimeHttpAuthSchemeProvider
extends HttpAuthSchemeProvider<BedrockRuntimeHttpAuthSchemeParameters> {}
export declare const defaultBedrockRuntimeHttpAuthSchemeProvider: BedrockRuntimeHttpAuthSchemeProvider;
export interface HttpAuthSchemeInputConfig extends AwsSdkSigV4AuthInputConfig {
authSchemePreference?: string[] | Provider<string[]>;
httpAuthSchemes?: HttpAuthScheme[];
httpAuthSchemeProvider?: BedrockRuntimeHttpAuthSchemeProvider;
token?: TokenIdentity | TokenIdentityProvider;
}
export interface HttpAuthSchemeResolvedConfig
extends AwsSdkSigV4AuthResolvedConfig {
readonly authSchemePreference: Provider<string[]>;
readonly httpAuthSchemes: HttpAuthScheme[];
readonly httpAuthSchemeProvider: BedrockRuntimeHttpAuthSchemeProvider;
readonly token?: TokenIdentityProvider;
}
export declare const resolveHttpAuthSchemeConfig: <T>(
config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved
) => T & HttpAuthSchemeResolvedConfig;

View File

@@ -0,0 +1,50 @@
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import {
ApplyGuardrailRequest,
ApplyGuardrailResponse,
} from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export interface ApplyGuardrailCommandInput extends ApplyGuardrailRequest {}
export interface ApplyGuardrailCommandOutput
extends ApplyGuardrailResponse,
__MetadataBearer {}
declare const ApplyGuardrailCommand_base: {
new (
input: ApplyGuardrailCommandInput
): import("@smithy/smithy-client").CommandImpl<
ApplyGuardrailCommandInput,
ApplyGuardrailCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
input: ApplyGuardrailCommandInput
): import("@smithy/smithy-client").CommandImpl<
ApplyGuardrailCommandInput,
ApplyGuardrailCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class ApplyGuardrailCommand extends ApplyGuardrailCommand_base {
protected static __types: {
api: {
input: ApplyGuardrailRequest;
output: ApplyGuardrailResponse;
};
sdk: {
input: ApplyGuardrailCommandInput;
output: ApplyGuardrailCommandOutput;
};
};
}

View File

@@ -0,0 +1,47 @@
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import { ConverseRequest, ConverseResponse } from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export interface ConverseCommandInput extends ConverseRequest {}
export interface ConverseCommandOutput
extends ConverseResponse,
__MetadataBearer {}
declare const ConverseCommand_base: {
new (
input: ConverseCommandInput
): import("@smithy/smithy-client").CommandImpl<
ConverseCommandInput,
ConverseCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
input: ConverseCommandInput
): import("@smithy/smithy-client").CommandImpl<
ConverseCommandInput,
ConverseCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class ConverseCommand extends ConverseCommand_base {
protected static __types: {
api: {
input: ConverseRequest;
output: ConverseResponse;
};
sdk: {
input: ConverseCommandInput;
output: ConverseCommandOutput;
};
};
}

View File

@@ -0,0 +1,50 @@
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import {
ConverseStreamRequest,
ConverseStreamResponse,
} from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export interface ConverseStreamCommandInput extends ConverseStreamRequest {}
export interface ConverseStreamCommandOutput
extends ConverseStreamResponse,
__MetadataBearer {}
declare const ConverseStreamCommand_base: {
new (
input: ConverseStreamCommandInput
): import("@smithy/smithy-client").CommandImpl<
ConverseStreamCommandInput,
ConverseStreamCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
input: ConverseStreamCommandInput
): import("@smithy/smithy-client").CommandImpl<
ConverseStreamCommandInput,
ConverseStreamCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class ConverseStreamCommand extends ConverseStreamCommand_base {
protected static __types: {
api: {
input: ConverseStreamRequest;
output: ConverseStreamResponse;
};
sdk: {
input: ConverseStreamCommandInput;
output: ConverseStreamCommandOutput;
};
};
}

View File

@@ -0,0 +1,47 @@
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import { CountTokensRequest, CountTokensResponse } from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export interface CountTokensCommandInput extends CountTokensRequest {}
export interface CountTokensCommandOutput
extends CountTokensResponse,
__MetadataBearer {}
declare const CountTokensCommand_base: {
new (
input: CountTokensCommandInput
): import("@smithy/smithy-client").CommandImpl<
CountTokensCommandInput,
CountTokensCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
input: CountTokensCommandInput
): import("@smithy/smithy-client").CommandImpl<
CountTokensCommandInput,
CountTokensCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class CountTokensCommand extends CountTokensCommand_base {
protected static __types: {
api: {
input: CountTokensRequest;
output: CountTokensResponse;
};
sdk: {
input: CountTokensCommandInput;
output: CountTokensCommandOutput;
};
};
}

View File

@@ -0,0 +1,50 @@
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import {
GetAsyncInvokeRequest,
GetAsyncInvokeResponse,
} from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export interface GetAsyncInvokeCommandInput extends GetAsyncInvokeRequest {}
export interface GetAsyncInvokeCommandOutput
extends GetAsyncInvokeResponse,
__MetadataBearer {}
declare const GetAsyncInvokeCommand_base: {
new (
input: GetAsyncInvokeCommandInput
): import("@smithy/smithy-client").CommandImpl<
GetAsyncInvokeCommandInput,
GetAsyncInvokeCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
input: GetAsyncInvokeCommandInput
): import("@smithy/smithy-client").CommandImpl<
GetAsyncInvokeCommandInput,
GetAsyncInvokeCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class GetAsyncInvokeCommand extends GetAsyncInvokeCommand_base {
protected static __types: {
api: {
input: GetAsyncInvokeRequest;
output: GetAsyncInvokeResponse;
};
sdk: {
input: GetAsyncInvokeCommandInput;
output: GetAsyncInvokeCommandOutput;
};
};
}

View File

@@ -0,0 +1,63 @@
import { Command as $Command } from "@smithy/smithy-client";
import {
BlobPayloadInputTypes,
MetadataBearer as __MetadataBearer,
} from "@smithy/types";
import { Uint8ArrayBlobAdapter } from "@smithy/util-stream";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import { InvokeModelRequest, InvokeModelResponse } from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export type InvokeModelCommandInputType = Pick<
InvokeModelRequest,
Exclude<keyof InvokeModelRequest, "body">
> & {
body?: BlobPayloadInputTypes;
};
export interface InvokeModelCommandInput extends InvokeModelCommandInputType {}
export type InvokeModelCommandOutputType = Pick<
InvokeModelResponse,
Exclude<keyof InvokeModelResponse, "body">
> & {
body: Uint8ArrayBlobAdapter;
};
export interface InvokeModelCommandOutput
extends InvokeModelCommandOutputType,
__MetadataBearer {}
declare const InvokeModelCommand_base: {
new (
input: InvokeModelCommandInput
): import("@smithy/smithy-client").CommandImpl<
InvokeModelCommandInput,
InvokeModelCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
input: InvokeModelCommandInput
): import("@smithy/smithy-client").CommandImpl<
InvokeModelCommandInput,
InvokeModelCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class InvokeModelCommand extends InvokeModelCommand_base {
protected static __types: {
api: {
input: InvokeModelRequest;
output: InvokeModelResponse;
};
sdk: {
input: InvokeModelCommandInput;
output: InvokeModelCommandOutput;
};
};
}

View File

@@ -0,0 +1,51 @@
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import {
InvokeModelWithBidirectionalStreamRequest,
InvokeModelWithBidirectionalStreamResponse,
} from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export interface InvokeModelWithBidirectionalStreamCommandInput
extends InvokeModelWithBidirectionalStreamRequest {}
export interface InvokeModelWithBidirectionalStreamCommandOutput
extends InvokeModelWithBidirectionalStreamResponse,
__MetadataBearer {}
declare const InvokeModelWithBidirectionalStreamCommand_base: {
new (
input: InvokeModelWithBidirectionalStreamCommandInput
): import("@smithy/smithy-client").CommandImpl<
InvokeModelWithBidirectionalStreamCommandInput,
InvokeModelWithBidirectionalStreamCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
input: InvokeModelWithBidirectionalStreamCommandInput
): import("@smithy/smithy-client").CommandImpl<
InvokeModelWithBidirectionalStreamCommandInput,
InvokeModelWithBidirectionalStreamCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class InvokeModelWithBidirectionalStreamCommand extends InvokeModelWithBidirectionalStreamCommand_base {
protected static __types: {
api: {
input: InvokeModelWithBidirectionalStreamRequest;
output: InvokeModelWithBidirectionalStreamResponse;
};
sdk: {
input: InvokeModelWithBidirectionalStreamCommandInput;
output: InvokeModelWithBidirectionalStreamCommandOutput;
};
};
}

View File

@@ -0,0 +1,60 @@
import { Command as $Command } from "@smithy/smithy-client";
import {
BlobPayloadInputTypes,
MetadataBearer as __MetadataBearer,
} from "@smithy/types";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import {
InvokeModelWithResponseStreamRequest,
InvokeModelWithResponseStreamResponse,
} from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export type InvokeModelWithResponseStreamCommandInputType = Pick<
InvokeModelWithResponseStreamRequest,
Exclude<keyof InvokeModelWithResponseStreamRequest, "body">
> & {
body?: BlobPayloadInputTypes;
};
export interface InvokeModelWithResponseStreamCommandInput
extends InvokeModelWithResponseStreamCommandInputType {}
export interface InvokeModelWithResponseStreamCommandOutput
extends InvokeModelWithResponseStreamResponse,
__MetadataBearer {}
declare const InvokeModelWithResponseStreamCommand_base: {
new (
input: InvokeModelWithResponseStreamCommandInput
): import("@smithy/smithy-client").CommandImpl<
InvokeModelWithResponseStreamCommandInput,
InvokeModelWithResponseStreamCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
input: InvokeModelWithResponseStreamCommandInput
): import("@smithy/smithy-client").CommandImpl<
InvokeModelWithResponseStreamCommandInput,
InvokeModelWithResponseStreamCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class InvokeModelWithResponseStreamCommand extends InvokeModelWithResponseStreamCommand_base {
protected static __types: {
api: {
input: InvokeModelWithResponseStreamRequest;
output: InvokeModelWithResponseStreamResponse;
};
sdk: {
input: InvokeModelWithResponseStreamCommandInput;
output: InvokeModelWithResponseStreamCommandOutput;
};
};
}

View File

@@ -0,0 +1,50 @@
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import {
ListAsyncInvokesRequest,
ListAsyncInvokesResponse,
} from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export interface ListAsyncInvokesCommandInput extends ListAsyncInvokesRequest {}
export interface ListAsyncInvokesCommandOutput
extends ListAsyncInvokesResponse,
__MetadataBearer {}
declare const ListAsyncInvokesCommand_base: {
new (
input: ListAsyncInvokesCommandInput
): import("@smithy/smithy-client").CommandImpl<
ListAsyncInvokesCommandInput,
ListAsyncInvokesCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
...[input]: [] | [ListAsyncInvokesCommandInput]
): import("@smithy/smithy-client").CommandImpl<
ListAsyncInvokesCommandInput,
ListAsyncInvokesCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class ListAsyncInvokesCommand extends ListAsyncInvokesCommand_base {
protected static __types: {
api: {
input: ListAsyncInvokesRequest;
output: ListAsyncInvokesResponse;
};
sdk: {
input: ListAsyncInvokesCommandInput;
output: ListAsyncInvokesCommandOutput;
};
};
}

View File

@@ -0,0 +1,50 @@
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import {
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../BedrockRuntimeClient";
import {
StartAsyncInvokeRequest,
StartAsyncInvokeResponse,
} from "../models/models_0";
export { __MetadataBearer };
export { $Command };
export interface StartAsyncInvokeCommandInput extends StartAsyncInvokeRequest {}
export interface StartAsyncInvokeCommandOutput
extends StartAsyncInvokeResponse,
__MetadataBearer {}
declare const StartAsyncInvokeCommand_base: {
new (
input: StartAsyncInvokeCommandInput
): import("@smithy/smithy-client").CommandImpl<
StartAsyncInvokeCommandInput,
StartAsyncInvokeCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
new (
input: StartAsyncInvokeCommandInput
): import("@smithy/smithy-client").CommandImpl<
StartAsyncInvokeCommandInput,
StartAsyncInvokeCommandOutput,
BedrockRuntimeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
export declare class StartAsyncInvokeCommand extends StartAsyncInvokeCommand_base {
protected static __types: {
api: {
input: StartAsyncInvokeRequest;
output: StartAsyncInvokeResponse;
};
sdk: {
input: StartAsyncInvokeCommandInput;
output: StartAsyncInvokeCommandOutput;
};
};
}

View File

@@ -0,0 +1,10 @@
export * from "./ApplyGuardrailCommand";
export * from "./ConverseCommand";
export * from "./ConverseStreamCommand";
export * from "./CountTokensCommand";
export * from "./GetAsyncInvokeCommand";
export * from "./InvokeModelCommand";
export * from "./InvokeModelWithBidirectionalStreamCommand";
export * from "./InvokeModelWithResponseStreamCommand";
export * from "./ListAsyncInvokesCommand";
export * from "./StartAsyncInvokeCommand";

View File

@@ -0,0 +1,51 @@
import {
Endpoint,
EndpointParameters as __EndpointParameters,
EndpointV2,
Provider,
} from "@smithy/types";
export interface ClientInputEndpointParameters {
region?: string | undefined | Provider<string | undefined>;
useDualstackEndpoint?: boolean | undefined | Provider<boolean | undefined>;
useFipsEndpoint?: boolean | undefined | Provider<boolean | undefined>;
endpoint?:
| string
| Provider<string>
| Endpoint
| Provider<Endpoint>
| EndpointV2
| Provider<EndpointV2>;
}
export type ClientResolvedEndpointParameters = Pick<
ClientInputEndpointParameters,
Exclude<keyof ClientInputEndpointParameters, "endpoint">
> & {
defaultSigningName: string;
};
export declare const resolveClientEndpointParameters: <T>(
options: T & ClientInputEndpointParameters
) => T & ClientResolvedEndpointParameters;
export declare const commonParams: {
readonly UseFIPS: {
readonly type: "builtInParams";
readonly name: "useFipsEndpoint";
};
readonly Endpoint: {
readonly type: "builtInParams";
readonly name: "endpoint";
};
readonly Region: {
readonly type: "builtInParams";
readonly name: "region";
};
readonly UseDualStack: {
readonly type: "builtInParams";
readonly name: "useDualstackEndpoint";
};
};
export interface EndpointParameters extends __EndpointParameters {
Region?: string | undefined;
UseDualStack?: boolean | undefined;
UseFIPS?: boolean | undefined;
Endpoint?: string | undefined;
}

View File

@@ -0,0 +1,8 @@
import { EndpointV2, Logger } from "@smithy/types";
import { EndpointParameters } from "./EndpointParameters";
export declare const defaultEndpointResolver: (
endpointParams: EndpointParameters,
context?: {
logger?: Logger;
}
) => EndpointV2;

View File

@@ -0,0 +1,2 @@
import { RuleSetObject } from "@smithy/types";
export declare const ruleSet: RuleSetObject;

View File

@@ -0,0 +1,9 @@
import { AwsRegionExtensionConfiguration } from "@aws-sdk/types";
import { HttpHandlerExtensionConfiguration } from "@smithy/protocol-http";
import { DefaultExtensionConfiguration } from "@smithy/types";
import { HttpAuthExtensionConfiguration } from "./auth/httpAuthExtensionConfiguration";
export interface BedrockRuntimeExtensionConfiguration
extends HttpHandlerExtensionConfiguration,
DefaultExtensionConfiguration,
AwsRegionExtensionConfiguration,
HttpAuthExtensionConfiguration {}

View File

@@ -0,0 +1,12 @@
export * from "./BedrockRuntimeClient";
export * from "./BedrockRuntime";
export { ClientInputEndpointParameters } from "./endpoint/EndpointParameters";
export { RuntimeExtension } from "./runtimeExtensions";
export { BedrockRuntimeExtensionConfiguration } from "./extensionConfiguration";
export * from "./commands";
export * from "./schemas/schemas_0";
export * from "./pagination";
export * from "./models/enums";
export * from "./models/errors";
export * from "./models/models_0";
export { BedrockRuntimeServiceException } from "./models/BedrockRuntimeServiceException";

Some files were not shown because too many files have changed in this diff Show More