@stacksjs/ai 0.58.47 → 0.58.49

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/ai",
3
3
  "type": "module",
4
- "version": "0.58.47",
4
+ "version": "0.58.49",
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",
@@ -54,6 +55,6 @@
54
55
  "@aws-sdk/client-bedrock-runtime": "^3.503.1"
55
56
  },
56
57
  "devDependencies": {
57
- "@stacksjs/development": "workspace:*"
58
+ "@stacksjs/development": "latest"
58
59
  }
59
60
  }
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 }