@alumnium/aws 0.0.0-stage → 0.24.0-alpha.2

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Alexey Rodionov, Tatiana Shepeleva
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # Temporary Holding Version
1
+ # @alumnium/aws
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Alumnium AWS (Bedrock) LLM provider. See [the main `alumnium` package page](https://www.npmjs.com/package/alumnium) for more details.
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@alumnium/aws",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.24.0-alpha.2",
4
+ "description": "Alumnium AWS (Bedrock) LLM provider",
5
+ "license": "MIT",
6
+ "author": "Alex Rodionov <p0deje@gmail.com>",
7
+ "contributors": [
8
+ "Alex Rodionov <p0deje@gmail.com>",
9
+ "Sasha Koss <koss@nocorp.me>",
10
+ "Tatiana Shepeleva <tati.shep@gmail.com>"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/alumnium-hq/alumnium.git"
15
+ },
16
+ "files": [
17
+ "src",
18
+ "README.md",
19
+ "LICENSE.md"
20
+ ],
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "import": {
25
+ "types": "./src/index.d.ts",
26
+ "default": "./src/index.js"
27
+ },
28
+ "require": {
29
+ "types": "./src/index.d.ts",
30
+ "default": "./src/index.cjs"
31
+ }
32
+ }
33
+ },
34
+ "dependencies": {
35
+ "@ai-sdk/amazon-bedrock": "^5.0.61",
36
+ "@ai-sdk/provider": "^4.0.7",
37
+ "@alumnium/core": "0.24.0-alpha.2",
38
+ "ai": "^7.0.78"
39
+ }
40
+ }
package/src/index.cjs ADDED
@@ -0,0 +1,79 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ function __accessProp(key) {
6
+ return this[key];
7
+ }
8
+ var __toCommonJS = (from) => {
9
+ var entry = (__moduleCache ??= new WeakMap()).get(from),
10
+ desc;
11
+ if (entry) return entry;
12
+ entry = __defProp({}, "__esModule", { value: true });
13
+ if ((from && typeof from === "object") || typeof from === "function") {
14
+ for (var key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(entry, key))
16
+ __defProp(entry, key, {
17
+ get: __accessProp.bind(from, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
19
+ });
20
+ }
21
+ __moduleCache.set(from, entry);
22
+ return entry;
23
+ };
24
+ var __moduleCache;
25
+ var __returnValue = (v) => v;
26
+ function __exportSetter(name, newValue) {
27
+ this[name] = __returnValue.bind(null, newValue);
28
+ }
29
+ var __export = (target, all) => {
30
+ for (var name in all)
31
+ __defProp(target, name, {
32
+ get: all[name],
33
+ enumerable: true,
34
+ configurable: true,
35
+ set: __exportSetter.bind(all, name),
36
+ });
37
+ };
38
+
39
+ // aws/src/index.ts
40
+ var exports_src = {};
41
+ __export(exports_src, {
42
+ awsProviders: () => awsProviders,
43
+ createAwsLlm: () => createAwsLlm,
44
+ });
45
+ module.exports = __toCommonJS(exports_src);
46
+
47
+ // aws/src/llm/awsProviders.ts
48
+ var import_amazon_bedrock = require("@ai-sdk/amazon-bedrock");
49
+ var import_internal = require("@alumnium/core/internal");
50
+ var logger = import_internal.Logger.get(
51
+ "packages/typescript/aws/src/llm/awsProviders.ts",
52
+ );
53
+ function createAwsLlm(model) {
54
+ logger.debug(`Creating AWS LLM with model ${model.name}`);
55
+ const accessKeyId = import_internal.Env.AWS_ACCESS_KEY;
56
+ const secretAccessKey = import_internal.Env.AWS_SECRET_KEY;
57
+ const provider = import_amazon_bedrock.createAmazonBedrock({
58
+ region: import_internal.Env.AWS_REGION_NAME,
59
+ ...(accessKeyId && secretAccessKey ? { accessKeyId, secretAccessKey } : {}),
60
+ });
61
+ const llm = provider(model.name);
62
+ if (model.provider !== "aws_anthropic") return llm;
63
+ const additionalModelRequestFields = import_internal.usesAdaptiveThinking(
64
+ model.name,
65
+ )
66
+ ? { thinking: { type: "adaptive" }, output_config: { effort: "low" } }
67
+ : { thinking: { type: "enabled", budget_tokens: 1024 } };
68
+ return import_internal.withCallDefaults(llm, {
69
+ providerOptions: { bedrock: { additionalModelRequestFields } },
70
+ });
71
+ }
72
+ var awsProviders = {
73
+ aws_anthropic: createAwsLlm,
74
+ aws_meta: createAwsLlm,
75
+ };
76
+ import_internal.LlmFactory.register(awsProviders);
77
+
78
+ //# debugId=ECA0DB9DC2EE2F9F64756E2164756E21
79
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../aws/src/llm/awsProviders.ts"],
4
+ "sourcesContent": [
5
+ "import { createAmazonBedrock } from \"@ai-sdk/amazon-bedrock\";\nimport type { LanguageModelV4 } from \"@ai-sdk/provider\";\nimport {\n LlmFactory,\n usesAdaptiveThinking,\n withCallDefaults,\n Env,\n Logger,\n type Model,\n} from \"@alumnium/core/internal\";\n\nconst logger = Logger.get(\"packages/typescript/aws/src/llm/awsProviders.ts\");\n\nexport function createAwsLlm(model: Model): LanguageModelV4 {\n logger.debug(`Creating AWS LLM with model ${model.name}`);\n const accessKeyId = Env.AWS_ACCESS_KEY;\n const secretAccessKey = Env.AWS_SECRET_KEY;\n const provider = createAmazonBedrock({\n region: Env.AWS_REGION_NAME,\n ...(accessKeyId && secretAccessKey ? { accessKeyId, secretAccessKey } : {}),\n });\n const llm = provider(model.name);\n if (model.provider !== \"aws_anthropic\") return llm;\n\n const additionalModelRequestFields = usesAdaptiveThinking(model.name)\n ? { thinking: { type: \"adaptive\" }, output_config: { effort: \"low\" } }\n : { thinking: { type: \"enabled\", budget_tokens: 1024 } };\n return withCallDefaults(llm, {\n providerOptions: { bedrock: { additionalModelRequestFields } },\n });\n}\n\nexport const awsProviders: LlmFactory.Providers = {\n aws_anthropic: createAwsLlm,\n aws_meta: createAwsLlm,\n};\n\nLlmFactory.register(awsProviders);\n"
6
+ ],
7
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAoC,IAApC;AASO,IAPP;AASA,IAAM,SAAS,uBAAO,IAAI,iDAAiD;AAEpE,SAAS,YAAY,CAAC,OAA+B;AAAA,EAC1D,OAAO,MAAM,+BAA+B,MAAM,MAAM;AAAA,EACxD,MAAM,cAAc,oBAAI;AAAA,EACxB,MAAM,kBAAkB,oBAAI;AAAA,EAC5B,MAAM,WAAW,0CAAoB;AAAA,IACnC,QAAQ,oBAAI;AAAA,OACR,eAAe,kBAAkB,EAAE,aAAa,gBAAgB,IAAI,CAAC;AAAA,EAC3E,CAAC;AAAA,EACD,MAAM,MAAM,SAAS,MAAM,IAAI;AAAA,EAC/B,IAAI,MAAM,aAAa;AAAA,IAAiB,OAAO;AAAA,EAE/C,MAAM,+BAA+B,qCAAqB,MAAM,IAAI,IAChE,EAAE,UAAU,EAAE,MAAM,WAAW,GAAG,eAAe,EAAE,QAAQ,MAAM,EAAE,IACnE,EAAE,UAAU,EAAE,MAAM,WAAW,eAAe,KAAK,EAAE;AAAA,EACzD,OAAO,iCAAiB,KAAK;AAAA,IAC3B,iBAAiB,EAAE,SAAS,EAAE,6BAA6B,EAAE;AAAA,EAC/D,CAAC;AAAA;AAGI,IAAM,eAAqC;AAAA,EAChD,eAAe;AAAA,EACf,UAAU;AACZ;AAEA,2BAAW,SAAS,YAAY;",
8
+ "debugId": "ECA0DB9DC2EE2F9F64756E2164756E21",
9
+ "names": []
10
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./llm/awsProviders.ts";
package/src/index.js ADDED
@@ -0,0 +1,36 @@
1
+ // aws/src/llm/awsProviders.ts
2
+ import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
3
+ import {
4
+ LlmFactory,
5
+ usesAdaptiveThinking,
6
+ withCallDefaults,
7
+ Env,
8
+ Logger,
9
+ } from "@alumnium/core/internal";
10
+ var logger = Logger.get("packages/typescript/aws/src/llm/awsProviders.ts");
11
+ function createAwsLlm(model) {
12
+ logger.debug(`Creating AWS LLM with model ${model.name}`);
13
+ const accessKeyId = Env.AWS_ACCESS_KEY;
14
+ const secretAccessKey = Env.AWS_SECRET_KEY;
15
+ const provider = createAmazonBedrock({
16
+ region: Env.AWS_REGION_NAME,
17
+ ...(accessKeyId && secretAccessKey ? { accessKeyId, secretAccessKey } : {}),
18
+ });
19
+ const llm = provider(model.name);
20
+ if (model.provider !== "aws_anthropic") return llm;
21
+ const additionalModelRequestFields = usesAdaptiveThinking(model.name)
22
+ ? { thinking: { type: "adaptive" }, output_config: { effort: "low" } }
23
+ : { thinking: { type: "enabled", budget_tokens: 1024 } };
24
+ return withCallDefaults(llm, {
25
+ providerOptions: { bedrock: { additionalModelRequestFields } },
26
+ });
27
+ }
28
+ var awsProviders = {
29
+ aws_anthropic: createAwsLlm,
30
+ aws_meta: createAwsLlm,
31
+ };
32
+ LlmFactory.register(awsProviders);
33
+ export { awsProviders, createAwsLlm };
34
+
35
+ //# debugId=E58C4AE783E3563964756E2164756E21
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../aws/src/llm/awsProviders.ts"],
4
+ "sourcesContent": [
5
+ "import { createAmazonBedrock } from \"@ai-sdk/amazon-bedrock\";\nimport type { LanguageModelV4 } from \"@ai-sdk/provider\";\nimport {\n LlmFactory,\n usesAdaptiveThinking,\n withCallDefaults,\n Env,\n Logger,\n type Model,\n} from \"@alumnium/core/internal\";\n\nconst logger = Logger.get(\"packages/typescript/aws/src/llm/awsProviders.ts\");\n\nexport function createAwsLlm(model: Model): LanguageModelV4 {\n logger.debug(`Creating AWS LLM with model ${model.name}`);\n const accessKeyId = Env.AWS_ACCESS_KEY;\n const secretAccessKey = Env.AWS_SECRET_KEY;\n const provider = createAmazonBedrock({\n region: Env.AWS_REGION_NAME,\n ...(accessKeyId && secretAccessKey ? { accessKeyId, secretAccessKey } : {}),\n });\n const llm = provider(model.name);\n if (model.provider !== \"aws_anthropic\") return llm;\n\n const additionalModelRequestFields = usesAdaptiveThinking(model.name)\n ? { thinking: { type: \"adaptive\" }, output_config: { effort: \"low\" } }\n : { thinking: { type: \"enabled\", budget_tokens: 1024 } };\n return withCallDefaults(llm, {\n providerOptions: { bedrock: { additionalModelRequestFields } },\n });\n}\n\nexport const awsProviders: LlmFactory.Providers = {\n aws_anthropic: createAwsLlm,\n aws_meta: createAwsLlm,\n};\n\nLlmFactory.register(awsProviders);\n"
6
+ ],
7
+ "mappings": ";AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,SAAS,OAAO,IAAI,iDAAiD;AAEpE,SAAS,YAAY,CAAC,OAA+B;AAAA,EAC1D,OAAO,MAAM,+BAA+B,MAAM,MAAM;AAAA,EACxD,MAAM,cAAc,IAAI;AAAA,EACxB,MAAM,kBAAkB,IAAI;AAAA,EAC5B,MAAM,WAAW,oBAAoB;AAAA,IACnC,QAAQ,IAAI;AAAA,OACR,eAAe,kBAAkB,EAAE,aAAa,gBAAgB,IAAI,CAAC;AAAA,EAC3E,CAAC;AAAA,EACD,MAAM,MAAM,SAAS,MAAM,IAAI;AAAA,EAC/B,IAAI,MAAM,aAAa;AAAA,IAAiB,OAAO;AAAA,EAE/C,MAAM,+BAA+B,qBAAqB,MAAM,IAAI,IAChE,EAAE,UAAU,EAAE,MAAM,WAAW,GAAG,eAAe,EAAE,QAAQ,MAAM,EAAE,IACnE,EAAE,UAAU,EAAE,MAAM,WAAW,eAAe,KAAK,EAAE;AAAA,EACzD,OAAO,iBAAiB,KAAK;AAAA,IAC3B,iBAAiB,EAAE,SAAS,EAAE,6BAA6B,EAAE;AAAA,EAC/D,CAAC;AAAA;AAGI,IAAM,eAAqC;AAAA,EAChD,eAAe;AAAA,EACf,UAAU;AACZ;AAEA,WAAW,SAAS,YAAY;",
8
+ "debugId": "E58C4AE783E3563964756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,4 @@
1
+ import type { LanguageModelV4 } from "@ai-sdk/provider";
2
+ import { LlmFactory, type Model } from "@alumnium/core/internal";
3
+ export declare function createAwsLlm(model: Model): LanguageModelV4;
4
+ export declare const awsProviders: LlmFactory.Providers;