@stacksjs/ai 0.58.48 → 0.58.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -6
- package/package.json +5 -4
- package/src/chatbots.ts +0 -0
- package/src/image-generation.ts +0 -0
- package/src/index.ts +8 -0
- package/src/personalization.ts +0 -0
- package/src/search.ts +0 -0
- package/src/text-generation.ts +0 -0
- package/src/text-summary.ts +0 -0
- package/src/utils/client-bedrock-runtime.ts +38 -0
- package/src/utils/client-bedrock.ts +53 -0
package/dist/index.js
CHANGED
|
@@ -8276,7 +8276,7 @@ var commonParams = {
|
|
|
8276
8276
|
var package_default = {
|
|
8277
8277
|
name: "@aws-sdk/client-bedrock",
|
|
8278
8278
|
description: "AWS SDK for JavaScript Bedrock Client for Node.js, Browser and React Native",
|
|
8279
|
-
version: "3.
|
|
8279
|
+
version: "3.504.0",
|
|
8280
8280
|
scripts: {
|
|
8281
8281
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
8282
8282
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock",
|
|
@@ -8295,9 +8295,9 @@ var package_default = {
|
|
|
8295
8295
|
dependencies: {
|
|
8296
8296
|
"@aws-crypto/sha256-browser": "3.0.0",
|
|
8297
8297
|
"@aws-crypto/sha256-js": "3.0.0",
|
|
8298
|
-
"@aws-sdk/client-sts": "3.
|
|
8298
|
+
"@aws-sdk/client-sts": "3.504.0",
|
|
8299
8299
|
"@aws-sdk/core": "3.496.0",
|
|
8300
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
8300
|
+
"@aws-sdk/credential-provider-node": "3.504.0",
|
|
8301
8301
|
"@aws-sdk/middleware-host-header": "3.502.0",
|
|
8302
8302
|
"@aws-sdk/middleware-logger": "3.502.0",
|
|
8303
8303
|
"@aws-sdk/middleware-recursion-detection": "3.502.0",
|
|
@@ -9332,7 +9332,7 @@ var commonParams2 = {
|
|
|
9332
9332
|
var package_default2 = {
|
|
9333
9333
|
name: "@aws-sdk/client-bedrock-runtime",
|
|
9334
9334
|
description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
9335
|
-
version: "3.
|
|
9335
|
+
version: "3.504.0",
|
|
9336
9336
|
scripts: {
|
|
9337
9337
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
9338
9338
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -9351,9 +9351,9 @@ var package_default2 = {
|
|
|
9351
9351
|
dependencies: {
|
|
9352
9352
|
"@aws-crypto/sha256-browser": "3.0.0",
|
|
9353
9353
|
"@aws-crypto/sha256-js": "3.0.0",
|
|
9354
|
-
"@aws-sdk/client-sts": "3.
|
|
9354
|
+
"@aws-sdk/client-sts": "3.504.0",
|
|
9355
9355
|
"@aws-sdk/core": "3.496.0",
|
|
9356
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
9356
|
+
"@aws-sdk/credential-provider-node": "3.504.0",
|
|
9357
9357
|
"@aws-sdk/middleware-host-header": "3.502.0",
|
|
9358
9358
|
"@aws-sdk/middleware-logger": "3.502.0",
|
|
9359
9359
|
"@aws-sdk/middleware-recursion-detection": "3.502.0",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/ai",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.50",
|
|
5
5
|
"description": "Stacks Artificial Intelligence.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
],
|
|
41
41
|
"files": [
|
|
42
42
|
"README.md",
|
|
43
|
-
"dist"
|
|
43
|
+
"dist",
|
|
44
|
+
"src"
|
|
44
45
|
],
|
|
45
46
|
"scripts": {
|
|
46
47
|
"build": "bun --bun build.ts",
|
|
@@ -48,10 +49,10 @@
|
|
|
48
49
|
"prepublishOnly": "bun --bun run build"
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
51
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
|
52
|
+
"@aws-sdk/client-bedrock-runtime": "^3.504.0"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
|
55
|
+
"@aws-sdk/client-bedrock-runtime": "^3.504.0"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@stacksjs/development": "latest"
|
package/src/chatbots.ts
ADDED
|
File without changes
|
|
File without changes
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './utils/client-bedrock'
|
|
2
|
+
export * from './utils/client-bedrock-runtime'
|
|
3
|
+
|
|
4
|
+
// export * from './chatbots'
|
|
5
|
+
// export * from './image-generation'
|
|
6
|
+
// export * from './search'
|
|
7
|
+
// export * from './text-generation'
|
|
8
|
+
// export * from './text-summary'
|
|
File without changes
|
package/src/search.ts
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { InvokeModelCommandInput, InvokeModelCommandOutput, InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput } from '@aws-sdk/client-bedrock-runtime'
|
|
2
|
+
import { BedrockRuntimeClient, InvokeModelCommand, InvokeModelWithResponseStreamCommand } from '@aws-sdk/client-bedrock-runtime'
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line node/prefer-global/process
|
|
5
|
+
const client = new BedrockRuntimeClient({ region: process.env.REGION || 'us-east-1' })
|
|
6
|
+
const logger = console // import your own logger
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Invoke Model
|
|
10
|
+
* @param {InvokeModelCommandInput} params
|
|
11
|
+
* @returns {Promise<InvokeModelCommandOutput>}
|
|
12
|
+
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/BedrockRuntime.html#invokeModel-property
|
|
13
|
+
*/
|
|
14
|
+
export async function invokeModel(params: InvokeModelCommandInput): Promise<InvokeModelCommandOutput> {
|
|
15
|
+
logger.debug(params)
|
|
16
|
+
const command = new InvokeModelCommand(params)
|
|
17
|
+
const res = await client.send(command)
|
|
18
|
+
logger.debug('Successfully invoke model')
|
|
19
|
+
logger.debug(res)
|
|
20
|
+
return res
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Invoke Model With Response Stream
|
|
25
|
+
* @param {InvokeModelWithResponseStreamCommandInput} params
|
|
26
|
+
* @returns {Promise<InvokeModelWithResponseStreamCommandOutput>}
|
|
27
|
+
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/BedrockRuntime.html#invokeModelWithResponseStream-property
|
|
28
|
+
*/
|
|
29
|
+
export async function invokeModelWithResponseStream(params: InvokeModelWithResponseStreamCommandInput): Promise<InvokeModelWithResponseStreamCommandOutput> {
|
|
30
|
+
logger.debug(params)
|
|
31
|
+
const command = new InvokeModelWithResponseStreamCommand(params)
|
|
32
|
+
const res = await client.send(command)
|
|
33
|
+
logger.debug('Successfully invoke model with response stream')
|
|
34
|
+
logger.debug(res)
|
|
35
|
+
return res
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type { InvokeModelCommandInput, InvokeModelWithResponseStreamCommandInput }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CreateModelCustomizationJobCommandInput, CreateModelCustomizationJobCommandOutput, GetModelCustomizationJobCommandInput, GetModelCustomizationJobCommandOutput, ListFoundationModelsCommandInput, ListFoundationModelsCommandOutput } from '@aws-sdk/client-bedrock'
|
|
2
|
+
import { BedrockClient, CreateModelCustomizationJobCommand, GetModelCustomizationJobCommand, ListFoundationModelsCommand } from '@aws-sdk/client-bedrock'
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line node/prefer-global/process
|
|
5
|
+
const client = new BedrockClient({ region: process.env.REGION || 'us-east-1' })
|
|
6
|
+
const logger = console // import your own logger
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Create Model Customization Job
|
|
10
|
+
* @param {CreateModelCustomizationJobCommandInput} params
|
|
11
|
+
* @returns {Promise<CreateModelCustomizationJobCommandOutput>}
|
|
12
|
+
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Bedrock.html#CreateModelCustomizationJob-property
|
|
13
|
+
*/
|
|
14
|
+
export async function createModelCustomizationJob(param: CreateModelCustomizationJobCommandInput): Promise<CreateModelCustomizationJobCommandOutput> {
|
|
15
|
+
logger.debug(param)
|
|
16
|
+
const command = new CreateModelCustomizationJobCommand(param)
|
|
17
|
+
const res = await client.send(command)
|
|
18
|
+
logger.debug('Successfully create model customization job')
|
|
19
|
+
logger.debug(res)
|
|
20
|
+
return res
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Get Model Customization Job
|
|
25
|
+
* @param {GetModelCustomizationJobCommandInput} params
|
|
26
|
+
* @returns {Promise<GetModelCustomizationJobCommandOutput>}
|
|
27
|
+
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Bedrock.html#getModelCustomizationJob-property
|
|
28
|
+
*/
|
|
29
|
+
export async function getModelCustomizationJob(params: GetModelCustomizationJobCommandInput): Promise<GetModelCustomizationJobCommandOutput> {
|
|
30
|
+
logger.debug(params)
|
|
31
|
+
const command = new GetModelCustomizationJobCommand(params)
|
|
32
|
+
const res = await client.send(command)
|
|
33
|
+
logger.debug('Successfully get model customization job')
|
|
34
|
+
logger.debug(res)
|
|
35
|
+
return res
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* List Foundation Models
|
|
40
|
+
* @param {ListFoundationModelsCommandInput} params
|
|
41
|
+
* @returns {Promise<ListFoundationModelsCommandOutput>}
|
|
42
|
+
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Bedrock.html#listFoundationModels-property
|
|
43
|
+
*/
|
|
44
|
+
export async function listFoundationModels(params: ListFoundationModelsCommandInput): Promise<ListFoundationModelsCommandOutput> {
|
|
45
|
+
logger.debug(params)
|
|
46
|
+
const command = new ListFoundationModelsCommand(params)
|
|
47
|
+
const res = await client.send(command)
|
|
48
|
+
logger.debug('Successfully list foundation models')
|
|
49
|
+
logger.debug(res)
|
|
50
|
+
return res
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type { CreateModelCustomizationJobCommandInput, GetModelCustomizationJobCommandInput, ListFoundationModelsCommandInput }
|