@sprucelabs/sprucebot-llm 9.0.14 → 9.0.16
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/build/bots/adapters/OpenAi.d.ts +1 -1
- package/build/bots/adapters/OpenAi.js +2 -2
- package/build/chat.js +2 -2
- package/build/chatWithImages.js +2 -2
- package/build/esm/bots/adapters/OpenAi.d.ts +1 -1
- package/build/esm/bots/adapters/OpenAi.js +2 -1
- package/build/esm/chat.js +1 -1
- package/build/esm/chatWithImages.js +1 -1
- package/build/esm/index.d.ts +2 -1
- package/build/esm/index.js +2 -1
- package/build/index.d.ts +2 -1
- package/build/index.js +4 -2
- package/package.json +12 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
2
|
import { LlmAdapter, SendMessageOptions, SprucebotLlmBot } from '../../llm.types';
|
|
3
|
-
export
|
|
3
|
+
export default class OpenAiAdapter implements LlmAdapter {
|
|
4
4
|
static OpenAI: typeof OpenAI;
|
|
5
5
|
private api;
|
|
6
6
|
protected constructor(apiKey: string);
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MESSAGE_RESPONSE_ERROR_MESSAGE =
|
|
6
|
+
exports.MESSAGE_RESPONSE_ERROR_MESSAGE = void 0;
|
|
7
7
|
const schema_1 = require("@sprucelabs/schema");
|
|
8
8
|
const openai_1 = __importDefault(require("openai"));
|
|
9
9
|
const OpenAiMessageBuilder_1 = __importDefault(require("./OpenAiMessageBuilder"));
|
|
@@ -33,6 +33,6 @@ class OpenAiAdapter {
|
|
|
33
33
|
return message;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
exports.OpenAiAdapter = OpenAiAdapter;
|
|
37
36
|
OpenAiAdapter.OpenAI = openai_1.default;
|
|
37
|
+
exports.default = OpenAiAdapter;
|
|
38
38
|
exports.MESSAGE_RESPONSE_ERROR_MESSAGE = "Oh no! Something went wrong and I can't talk right now!";
|
package/build/chat.js
CHANGED
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
const node_process_1 = require("node:process");
|
|
40
40
|
const readline = __importStar(require("node:readline/promises"));
|
|
41
41
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
42
|
-
const OpenAi_1 = require("./bots/adapters/OpenAi");
|
|
42
|
+
const OpenAi_1 = __importDefault(require("./bots/adapters/OpenAi"));
|
|
43
43
|
const SprucebotLlmFactory_1 = __importDefault(require("./bots/SprucebotLlmFactory"));
|
|
44
44
|
const buildCallbackSkill_1 = __importDefault(require("./examples/buildCallbackSkill"));
|
|
45
45
|
const buildFileTransformerSkill_1 = __importDefault(require("./examples/buildFileTransformerSkill"));
|
|
@@ -50,7 +50,7 @@ dotenv_1.default.config();
|
|
|
50
50
|
const rl = readline.createInterface({ input: node_process_1.stdin, output: node_process_1.stdout });
|
|
51
51
|
void (async () => {
|
|
52
52
|
console.clear();
|
|
53
|
-
const adapter = OpenAi_1.
|
|
53
|
+
const adapter = OpenAi_1.default.Adapter(process.env.OPEN_AI_API_KEY);
|
|
54
54
|
const bots = SprucebotLlmFactory_1.default.Factory(adapter);
|
|
55
55
|
const skills = {
|
|
56
56
|
jokes: (0, buildJokeSkill_1.default)(bots),
|
package/build/chatWithImages.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const fs_1 = __importDefault(require("fs"));
|
|
7
7
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
-
const OpenAi_1 = require("./bots/adapters/OpenAi");
|
|
8
|
+
const OpenAi_1 = __importDefault(require("./bots/adapters/OpenAi"));
|
|
9
9
|
const SprucebotLlmFactory_1 = __importDefault(require("./bots/SprucebotLlmFactory"));
|
|
10
10
|
dotenv_1.default.config();
|
|
11
11
|
void (async () => {
|
|
@@ -14,7 +14,7 @@ void (async () => {
|
|
|
14
14
|
const image2 = fs_1.default.readFileSync('build/examples/images/image2.png');
|
|
15
15
|
const base64Image1 = image1.toString('base64');
|
|
16
16
|
const base64Image2 = image2.toString('base64');
|
|
17
|
-
const adapter = OpenAi_1.
|
|
17
|
+
const adapter = OpenAi_1.default.Adapter(process.env.OPEN_AI_API_KEY);
|
|
18
18
|
const bots = SprucebotLlmFactory_1.default.Factory(adapter);
|
|
19
19
|
const skill = bots.Skill({
|
|
20
20
|
weAreDoneWhen: 'you have described both images to me',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
2
|
import { LlmAdapter, SendMessageOptions, SprucebotLlmBot } from '../../llm.types';
|
|
3
|
-
export
|
|
3
|
+
export default class OpenAiAdapter implements LlmAdapter {
|
|
4
4
|
static OpenAI: typeof OpenAI;
|
|
5
5
|
private api;
|
|
6
6
|
protected constructor(apiKey: string);
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { assertOptions } from '@sprucelabs/schema';
|
|
11
11
|
import OpenAI from 'openai';
|
|
12
12
|
import OpenAiMessageBuilder from './OpenAiMessageBuilder.js';
|
|
13
|
-
|
|
13
|
+
class OpenAiAdapter {
|
|
14
14
|
// private log = buildLog('SprucebotLLM::OpenAiAdapter')
|
|
15
15
|
constructor(apiKey) {
|
|
16
16
|
assertOptions({ apiKey }, ['apiKey']);
|
|
@@ -39,4 +39,5 @@ export class OpenAiAdapter {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
OpenAiAdapter.OpenAI = OpenAI;
|
|
42
|
+
export default OpenAiAdapter;
|
|
42
43
|
export const MESSAGE_RESPONSE_ERROR_MESSAGE = "Oh no! Something went wrong and I can't talk right now!";
|
package/build/esm/chat.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { stdin as input, stdout as output } from 'node:process';
|
|
11
11
|
import * as readline from 'node:readline/promises.js';
|
|
12
12
|
import dotenv from 'dotenv';
|
|
13
|
-
import
|
|
13
|
+
import OpenAiAdapter from './bots/adapters/OpenAi.js';
|
|
14
14
|
import SprucebotLlmFactory from './bots/SprucebotLlmFactory.js';
|
|
15
15
|
import buildCallbackSkill from './examples/buildCallbackSkill.js';
|
|
16
16
|
import buildFileTransformerSkill from './examples/buildFileTransformerSkill.js';
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import fs from 'fs';
|
|
11
11
|
import dotenv from 'dotenv';
|
|
12
|
-
import
|
|
12
|
+
import OpenAiAdapter from './bots/adapters/OpenAi.js';
|
|
13
13
|
import SprucebotLlmFactory from './bots/SprucebotLlmFactory.js';
|
|
14
14
|
dotenv.config();
|
|
15
15
|
void (() => __awaiter(void 0, void 0, void 0, function* () {
|
package/build/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { default as SprucebotLlmFactory } from './bots/SprucebotLlmFactory';
|
|
2
2
|
export { default as SprucebotLlmBotImpl } from './bots/SprucebotLlmBotImpl';
|
|
3
3
|
export { default as SprucebotLlmSkillImpl } from './bots/SprucebotLlmSkillImpl';
|
|
4
|
-
export { OpenAiAdapter } from './bots/adapters/OpenAi';
|
|
4
|
+
export { default as OpenAiAdapter } from './bots/adapters/OpenAi';
|
|
5
5
|
export * from './llm.types';
|
|
6
6
|
export { default as SprucebotLlmError } from './errors/SpruceError';
|
|
7
7
|
export { default as MockLlmSkill } from './tests/MockLlmSkill';
|
|
8
8
|
export { default as SpyLllmBot } from './tests/SpyLlmBot';
|
|
9
9
|
export { default as SpyLlmAdapter } from './tests/SpyAdapter';
|
|
10
|
+
export { default as SpyOpenAiApi } from './bots/adapters/SpyOpenAiApi';
|
package/build/esm/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { default as SprucebotLlmFactory } from './bots/SprucebotLlmFactory.js';
|
|
2
2
|
export { default as SprucebotLlmBotImpl } from './bots/SprucebotLlmBotImpl.js';
|
|
3
3
|
export { default as SprucebotLlmSkillImpl } from './bots/SprucebotLlmSkillImpl.js';
|
|
4
|
-
export { OpenAiAdapter } from './bots/adapters/OpenAi.js';
|
|
4
|
+
export { default as OpenAiAdapter } from './bots/adapters/OpenAi.js';
|
|
5
5
|
export * from './llm.types.js';
|
|
6
6
|
export { default as SprucebotLlmError } from './errors/SpruceError.js';
|
|
7
7
|
export { default as MockLlmSkill } from './tests/MockLlmSkill.js';
|
|
8
8
|
export { default as SpyLllmBot } from './tests/SpyLlmBot.js';
|
|
9
9
|
export { default as SpyLlmAdapter } from './tests/SpyAdapter.js';
|
|
10
|
+
export { default as SpyOpenAiApi } from './bots/adapters/SpyOpenAiApi.js';
|
package/build/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { default as SprucebotLlmFactory } from './bots/SprucebotLlmFactory';
|
|
2
2
|
export { default as SprucebotLlmBotImpl } from './bots/SprucebotLlmBotImpl';
|
|
3
3
|
export { default as SprucebotLlmSkillImpl } from './bots/SprucebotLlmSkillImpl';
|
|
4
|
-
export { OpenAiAdapter } from './bots/adapters/OpenAi';
|
|
4
|
+
export { default as OpenAiAdapter } from './bots/adapters/OpenAi';
|
|
5
5
|
export * from './llm.types';
|
|
6
6
|
export { default as SprucebotLlmError } from './errors/SpruceError';
|
|
7
7
|
export { default as MockLlmSkill } from './tests/MockLlmSkill';
|
|
8
8
|
export { default as SpyLllmBot } from './tests/SpyLlmBot';
|
|
9
9
|
export { default as SpyLlmAdapter } from './tests/SpyAdapter';
|
|
10
|
+
export { default as SpyOpenAiApi } from './bots/adapters/SpyOpenAiApi';
|
package/build/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.SpyLlmAdapter = exports.SpyLllmBot = exports.MockLlmSkill = exports.SprucebotLlmError = exports.OpenAiAdapter = exports.SprucebotLlmSkillImpl = exports.SprucebotLlmBotImpl = exports.SprucebotLlmFactory = void 0;
|
|
20
|
+
exports.SpyOpenAiApi = exports.SpyLlmAdapter = exports.SpyLllmBot = exports.MockLlmSkill = exports.SprucebotLlmError = exports.OpenAiAdapter = exports.SprucebotLlmSkillImpl = exports.SprucebotLlmBotImpl = exports.SprucebotLlmFactory = void 0;
|
|
21
21
|
var SprucebotLlmFactory_1 = require("./bots/SprucebotLlmFactory");
|
|
22
22
|
Object.defineProperty(exports, "SprucebotLlmFactory", { enumerable: true, get: function () { return __importDefault(SprucebotLlmFactory_1).default; } });
|
|
23
23
|
var SprucebotLlmBotImpl_1 = require("./bots/SprucebotLlmBotImpl");
|
|
@@ -25,7 +25,7 @@ Object.defineProperty(exports, "SprucebotLlmBotImpl", { enumerable: true, get: f
|
|
|
25
25
|
var SprucebotLlmSkillImpl_1 = require("./bots/SprucebotLlmSkillImpl");
|
|
26
26
|
Object.defineProperty(exports, "SprucebotLlmSkillImpl", { enumerable: true, get: function () { return __importDefault(SprucebotLlmSkillImpl_1).default; } });
|
|
27
27
|
var OpenAi_1 = require("./bots/adapters/OpenAi");
|
|
28
|
-
Object.defineProperty(exports, "OpenAiAdapter", { enumerable: true, get: function () { return OpenAi_1.
|
|
28
|
+
Object.defineProperty(exports, "OpenAiAdapter", { enumerable: true, get: function () { return __importDefault(OpenAi_1).default; } });
|
|
29
29
|
__exportStar(require("./llm.types"), exports);
|
|
30
30
|
var SpruceError_1 = require("./errors/SpruceError");
|
|
31
31
|
Object.defineProperty(exports, "SprucebotLlmError", { enumerable: true, get: function () { return __importDefault(SpruceError_1).default; } });
|
|
@@ -35,3 +35,5 @@ var SpyLlmBot_1 = require("./tests/SpyLlmBot");
|
|
|
35
35
|
Object.defineProperty(exports, "SpyLllmBot", { enumerable: true, get: function () { return __importDefault(SpyLlmBot_1).default; } });
|
|
36
36
|
var SpyAdapter_1 = require("./tests/SpyAdapter");
|
|
37
37
|
Object.defineProperty(exports, "SpyLlmAdapter", { enumerable: true, get: function () { return __importDefault(SpyAdapter_1).default; } });
|
|
38
|
+
var SpyOpenAiApi_1 = require("./bots/adapters/SpyOpenAiApi");
|
|
39
|
+
Object.defineProperty(exports, "SpyOpenAiApi", { enumerable: true, get: function () { return __importDefault(SpyOpenAiApi_1).default; } });
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@sprucelabs/spruce-test-fixtures"
|
|
10
10
|
]
|
|
11
11
|
},
|
|
12
|
-
"version": "9.0.
|
|
12
|
+
"version": "9.0.16",
|
|
13
13
|
"files": [
|
|
14
14
|
"build"
|
|
15
15
|
],
|
|
@@ -54,28 +54,28 @@
|
|
|
54
54
|
"chat.images": "node ./build/chatWithImages.js"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@sprucelabs/error": "^7.0.
|
|
58
|
-
"@sprucelabs/mercury-event-emitter": "^43.0.
|
|
59
|
-
"@sprucelabs/mercury-types": "^48.0.
|
|
60
|
-
"@sprucelabs/schema": "^32.0.
|
|
57
|
+
"@sprucelabs/error": "^7.0.9",
|
|
58
|
+
"@sprucelabs/mercury-event-emitter": "^43.0.16",
|
|
59
|
+
"@sprucelabs/mercury-types": "^48.0.15",
|
|
60
|
+
"@sprucelabs/schema": "^32.0.14",
|
|
61
61
|
"@sprucelabs/spruce-skill-utils": "^31.2.18",
|
|
62
62
|
"eta": "^3.5.0",
|
|
63
63
|
"openai": "^5.5.1"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@sprucelabs/esm-postbuild": "^7.0.
|
|
67
|
-
"@sprucelabs/jest-json-reporter": "^9.0.
|
|
68
|
-
"@sprucelabs/resolve-path-aliases": "^3.0.
|
|
66
|
+
"@sprucelabs/esm-postbuild": "^7.0.6",
|
|
67
|
+
"@sprucelabs/jest-json-reporter": "^9.0.10",
|
|
68
|
+
"@sprucelabs/resolve-path-aliases": "^3.0.6",
|
|
69
69
|
"@sprucelabs/semantic-release": "^5.0.2",
|
|
70
|
-
"@sprucelabs/test": "^10.0.
|
|
71
|
-
"@sprucelabs/test-utils": "^6.0.
|
|
70
|
+
"@sprucelabs/test": "^10.0.4",
|
|
71
|
+
"@sprucelabs/test-utils": "^6.0.13",
|
|
72
72
|
"@types/node": "^24.0.3",
|
|
73
73
|
"chokidar-cli": "^3.0.0",
|
|
74
74
|
"dotenv": "^16.5.0",
|
|
75
75
|
"eslint": "^9.29.0",
|
|
76
76
|
"eslint-config-spruce": "^11.2.26",
|
|
77
|
-
"jest": "^30.0.
|
|
78
|
-
"jest-circus": "^30.0.
|
|
77
|
+
"jest": "^30.0.2",
|
|
78
|
+
"jest-circus": "^30.0.2",
|
|
79
79
|
"prettier": "^3.5.3",
|
|
80
80
|
"ts-node": "^10.9.2",
|
|
81
81
|
"tsc-watch": "^7.1.1",
|