@sprucelabs/sprucebot-llm 12.3.3 → 12.4.0
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/OllamaAdapter.d.ts +14 -0
- package/build/bots/adapters/OllamaAdapter.js +23 -0
- package/build/bots/adapters/{OpenAi.d.ts → OpenAiAdapter.d.ts} +6 -2
- package/build/bots/adapters/{OpenAi.js → OpenAiAdapter.js} +8 -4
- package/build/bots/adapters/{SpyOpenAiApi.d.ts → SpyOpenAiModule.d.ts} +4 -7
- package/build/bots/adapters/{SpyOpenAiApi.js → SpyOpenAiModule.js} +7 -7
- package/build/chat.js +2 -2
- package/build/chatWithImages.js +2 -2
- package/build/esm/bots/adapters/OllamaAdapter.d.ts +14 -0
- package/build/esm/bots/adapters/OllamaAdapter.js +26 -0
- package/build/esm/bots/adapters/{OpenAi.d.ts → OpenAiAdapter.d.ts} +6 -2
- package/build/esm/bots/adapters/{OpenAi.js → OpenAiAdapter.js} +11 -10
- package/build/esm/bots/adapters/{SpyOpenAiApi.d.ts → SpyOpenAiModule.d.ts} +4 -7
- package/build/esm/bots/adapters/{SpyOpenAiApi.js → SpyOpenAiModule.js} +7 -7
- package/build/esm/chat.js +1 -1
- package/build/esm/chatWithImages.js +1 -1
- package/build/esm/index.d.ts +4 -2
- package/build/esm/index.js +4 -2
- package/build/index.d.ts +4 -2
- package/build/index.js +8 -5
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Schema } from '@sprucelabs/schema';
|
|
2
|
+
import { LlmAdapter, SprucebotLlmBot, SendMessageOptions } from '../../llm.types';
|
|
3
|
+
export default class OllamaAdapter implements LlmAdapter {
|
|
4
|
+
private openai;
|
|
5
|
+
private think;
|
|
6
|
+
private constructor();
|
|
7
|
+
static Adapter(options?: OllamaOptions): OllamaAdapter;
|
|
8
|
+
sendMessage(bot: SprucebotLlmBot<Schema>, options?: SendMessageOptions): Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
interface OllamaOptions {
|
|
11
|
+
model?: string;
|
|
12
|
+
think?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const OpenAiAdapter_1 = __importDefault(require("./OpenAiAdapter"));
|
|
7
|
+
class OllamaAdapter {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.think = options?.think ?? false;
|
|
10
|
+
this.openai = OpenAiAdapter_1.default.Adapter('***', {
|
|
11
|
+
...options,
|
|
12
|
+
baseUrl: 'http://localhost:11434/v1',
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
static Adapter(options) {
|
|
16
|
+
return new this(options);
|
|
17
|
+
}
|
|
18
|
+
async sendMessage(bot, options) {
|
|
19
|
+
//@ts-ignore
|
|
20
|
+
return this.openai.sendMessage(bot, { ...options, think: this.think });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.default = OllamaAdapter;
|
|
@@ -3,6 +3,7 @@ import OpenAI from 'openai';
|
|
|
3
3
|
import { ReasoningEffort } from 'openai/resources';
|
|
4
4
|
import { LlmAdapter, SendMessageOptions, SprucebotLlmBot } from '../../llm.types';
|
|
5
5
|
export default class OpenAiAdapter implements LlmAdapter {
|
|
6
|
+
static Class: new (apiKey: string, options?: OpenAiAdapterOptions) => OpenAiAdapter;
|
|
6
7
|
static OpenAI: typeof OpenAI;
|
|
7
8
|
private api;
|
|
8
9
|
private log?;
|
|
@@ -18,7 +19,10 @@ export default class OpenAiAdapter implements LlmAdapter {
|
|
|
18
19
|
setReasoningEffort(effort: ReasoningEffort): void;
|
|
19
20
|
}
|
|
20
21
|
export declare const MESSAGE_RESPONSE_ERROR_MESSAGE = "Oh no! Something went wrong and I can't talk right now!";
|
|
21
|
-
interface OpenAiAdapterOptions {
|
|
22
|
+
export interface OpenAiAdapterOptions {
|
|
22
23
|
log?: Log;
|
|
24
|
+
memoryLimit?: number;
|
|
25
|
+
model?: string;
|
|
26
|
+
reasoningEffort?: ReasoningEffort;
|
|
27
|
+
baseUrl?: string;
|
|
23
28
|
}
|
|
24
|
-
export {};
|
|
@@ -11,12 +11,15 @@ class OpenAiAdapter {
|
|
|
11
11
|
constructor(apiKey, options) {
|
|
12
12
|
this.model = 'gpt-4o';
|
|
13
13
|
(0, schema_1.assertOptions)({ apiKey }, ['apiKey']);
|
|
14
|
-
const { log } = options || {};
|
|
15
|
-
this.api = new OpenAiAdapter.OpenAI({ apiKey });
|
|
14
|
+
const { log, memoryLimit, model, reasoningEffort, baseUrl } = options || {};
|
|
15
|
+
this.api = new OpenAiAdapter.OpenAI({ apiKey, baseURL: baseUrl });
|
|
16
16
|
this.log = log;
|
|
17
|
+
this.memoryLimit = memoryLimit;
|
|
18
|
+
this.model = model ?? this.model;
|
|
19
|
+
this.reasoningEffort = reasoningEffort;
|
|
17
20
|
}
|
|
18
21
|
static Adapter(apiKey, options) {
|
|
19
|
-
return new this(apiKey, options);
|
|
22
|
+
return new (this.Class ?? this)(apiKey, options);
|
|
20
23
|
}
|
|
21
24
|
async sendMessage(bot, options) {
|
|
22
25
|
const messageBuilder = OpenAiMessageBuilder_1.default.Builder(bot, {
|
|
@@ -26,7 +29,8 @@ class OpenAiAdapter {
|
|
|
26
29
|
this.log?.info('Sending message to OpenAI', JSON.stringify(messages, null, 2));
|
|
27
30
|
const params = {
|
|
28
31
|
messages,
|
|
29
|
-
model:
|
|
32
|
+
model: this.model,
|
|
33
|
+
...options,
|
|
30
34
|
};
|
|
31
35
|
const reasoningEffort = this.getReasoningEffort();
|
|
32
36
|
if (reasoningEffort) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import OpenAI from 'openai';
|
|
1
|
+
import OpenAI, { ClientOptions } from 'openai';
|
|
2
2
|
import { ChatCompletion, ChatCompletionCreateParamsNonStreaming } from 'openai/resources';
|
|
3
|
-
export default class
|
|
4
|
-
static config?:
|
|
3
|
+
export default class SpyOpenAiModule extends OpenAI {
|
|
4
|
+
static config?: ClientOptions;
|
|
5
5
|
static lastSentCompletion?: ChatCompletionCreateParamsNonStreaming;
|
|
6
6
|
static responseMessage: string | false;
|
|
7
|
-
constructor(config:
|
|
7
|
+
constructor(config: ClientOptions);
|
|
8
8
|
chat: {
|
|
9
9
|
completions: {
|
|
10
10
|
create: (options: ChatCompletionCreateParamsNonStreaming) => Promise<Response>;
|
|
@@ -13,7 +13,4 @@ export default class SpyOpenAiApi extends OpenAI {
|
|
|
13
13
|
private createCompletion;
|
|
14
14
|
}
|
|
15
15
|
type Response = ChatCompletion;
|
|
16
|
-
interface OpenAiOptions {
|
|
17
|
-
apiKey: string;
|
|
18
|
-
}
|
|
19
16
|
export {};
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const openai_1 = __importDefault(require("openai"));
|
|
7
|
-
class
|
|
7
|
+
class SpyOpenAiModule extends openai_1.default {
|
|
8
8
|
constructor(config) {
|
|
9
9
|
super(config);
|
|
10
10
|
//@ts-ignore
|
|
@@ -13,18 +13,18 @@ class SpyOpenAiApi extends openai_1.default {
|
|
|
13
13
|
create: this.createCompletion.bind(this),
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
SpyOpenAiModule.config = config;
|
|
17
17
|
}
|
|
18
18
|
async createCompletion(options) {
|
|
19
|
-
|
|
19
|
+
SpyOpenAiModule.lastSentCompletion = options;
|
|
20
20
|
const choices = [];
|
|
21
|
-
if (
|
|
21
|
+
if (SpyOpenAiModule.responseMessage) {
|
|
22
22
|
choices.push({
|
|
23
23
|
finish_reason: 'stop',
|
|
24
24
|
index: 0,
|
|
25
25
|
logprobs: null,
|
|
26
26
|
message: {
|
|
27
|
-
content:
|
|
27
|
+
content: SpyOpenAiModule.responseMessage,
|
|
28
28
|
role: 'assistant',
|
|
29
29
|
refusal: null,
|
|
30
30
|
},
|
|
@@ -39,5 +39,5 @@ class SpyOpenAiApi extends openai_1.default {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
exports.default =
|
|
42
|
+
SpyOpenAiModule.responseMessage = 'hello!';
|
|
43
|
+
exports.default = SpyOpenAiModule;
|
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
|
|
42
|
+
const OpenAiAdapter_1 = __importDefault(require("./bots/adapters/OpenAiAdapter"));
|
|
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"));
|
|
@@ -51,7 +51,7 @@ const rl = readline.createInterface({ input: node_process_1.stdin, output: node_
|
|
|
51
51
|
void (async () => {
|
|
52
52
|
console.clear();
|
|
53
53
|
// Create the adapter that handles actually sending the prompt to an LLM
|
|
54
|
-
const adapter =
|
|
54
|
+
const adapter = OpenAiAdapter_1.default.Adapter(process.env.OPEN_AI_API_KEY);
|
|
55
55
|
// The LLmFactory is a layer of abstraction that simplifies bot creation
|
|
56
56
|
// and enables test doubling (mocks, spies, etc)
|
|
57
57
|
const bots = SprucebotLlmFactory_1.default.Factory(adapter);
|
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
|
|
8
|
+
const OpenAiAdapter_1 = __importDefault(require("./bots/adapters/OpenAiAdapter"));
|
|
9
9
|
const SprucebotLlmFactory_1 = __importDefault(require("./bots/SprucebotLlmFactory"));
|
|
10
10
|
dotenv_1.default.config({ quiet: true });
|
|
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 =
|
|
17
|
+
const adapter = OpenAiAdapter_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',
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Schema } from '@sprucelabs/schema';
|
|
2
|
+
import { LlmAdapter, SprucebotLlmBot, SendMessageOptions } from '../../llm.types';
|
|
3
|
+
export default class OllamaAdapter implements LlmAdapter {
|
|
4
|
+
private openai;
|
|
5
|
+
private think;
|
|
6
|
+
private constructor();
|
|
7
|
+
static Adapter(options?: OllamaOptions): OllamaAdapter;
|
|
8
|
+
sendMessage(bot: SprucebotLlmBot<Schema>, options?: SendMessageOptions): Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
interface OllamaOptions {
|
|
11
|
+
model?: string;
|
|
12
|
+
think?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import OpenAiAdapter from './OpenAiAdapter.js';
|
|
11
|
+
export default class OllamaAdapter {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
var _a;
|
|
14
|
+
this.think = (_a = options === null || options === void 0 ? void 0 : options.think) !== null && _a !== void 0 ? _a : false;
|
|
15
|
+
this.openai = OpenAiAdapter.Adapter('***', Object.assign(Object.assign({}, options), { baseUrl: 'http://localhost:11434/v1' }));
|
|
16
|
+
}
|
|
17
|
+
static Adapter(options) {
|
|
18
|
+
return new this(options);
|
|
19
|
+
}
|
|
20
|
+
sendMessage(bot, options) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
//@ts-ignore
|
|
23
|
+
return this.openai.sendMessage(bot, Object.assign(Object.assign({}, options), { think: this.think }));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -3,6 +3,7 @@ import OpenAI from 'openai';
|
|
|
3
3
|
import { ReasoningEffort } from 'openai/resources';
|
|
4
4
|
import { LlmAdapter, SendMessageOptions, SprucebotLlmBot } from '../../llm.types';
|
|
5
5
|
export default class OpenAiAdapter implements LlmAdapter {
|
|
6
|
+
static Class: new (apiKey: string, options?: OpenAiAdapterOptions) => OpenAiAdapter;
|
|
6
7
|
static OpenAI: typeof OpenAI;
|
|
7
8
|
private api;
|
|
8
9
|
private log?;
|
|
@@ -18,7 +19,10 @@ export default class OpenAiAdapter implements LlmAdapter {
|
|
|
18
19
|
setReasoningEffort(effort: ReasoningEffort): void;
|
|
19
20
|
}
|
|
20
21
|
export declare const MESSAGE_RESPONSE_ERROR_MESSAGE = "Oh no! Something went wrong and I can't talk right now!";
|
|
21
|
-
interface OpenAiAdapterOptions {
|
|
22
|
+
export interface OpenAiAdapterOptions {
|
|
22
23
|
log?: Log;
|
|
24
|
+
memoryLimit?: number;
|
|
25
|
+
model?: string;
|
|
26
|
+
reasoningEffort?: ReasoningEffort;
|
|
27
|
+
baseUrl?: string;
|
|
23
28
|
}
|
|
24
|
-
export {};
|
|
@@ -14,32 +14,33 @@ class OpenAiAdapter {
|
|
|
14
14
|
constructor(apiKey, options) {
|
|
15
15
|
this.model = 'gpt-4o';
|
|
16
16
|
assertOptions({ apiKey }, ['apiKey']);
|
|
17
|
-
const { log } = options || {};
|
|
18
|
-
this.api = new OpenAiAdapter.OpenAI({ apiKey });
|
|
17
|
+
const { log, memoryLimit, model, reasoningEffort, baseUrl } = options || {};
|
|
18
|
+
this.api = new OpenAiAdapter.OpenAI({ apiKey, baseURL: baseUrl });
|
|
19
19
|
this.log = log;
|
|
20
|
+
this.memoryLimit = memoryLimit;
|
|
21
|
+
this.model = model !== null && model !== void 0 ? model : this.model;
|
|
22
|
+
this.reasoningEffort = reasoningEffort;
|
|
20
23
|
}
|
|
21
24
|
static Adapter(apiKey, options) {
|
|
22
|
-
|
|
25
|
+
var _a;
|
|
26
|
+
return new ((_a = this.Class) !== null && _a !== void 0 ? _a : this)(apiKey, options);
|
|
23
27
|
}
|
|
24
28
|
sendMessage(bot, options) {
|
|
25
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
27
31
|
const messageBuilder = OpenAiMessageBuilder.Builder(bot, {
|
|
28
32
|
memoryLimit: this.memoryLimit,
|
|
29
33
|
});
|
|
30
34
|
const messages = messageBuilder.buildMessages();
|
|
31
35
|
(_a = this.log) === null || _a === void 0 ? void 0 : _a.info('Sending message to OpenAI', JSON.stringify(messages, null, 2));
|
|
32
|
-
const params = {
|
|
33
|
-
messages,
|
|
34
|
-
model: (_b = options === null || options === void 0 ? void 0 : options.model) !== null && _b !== void 0 ? _b : this.model,
|
|
35
|
-
};
|
|
36
|
+
const params = Object.assign({ messages, model: this.model }, options);
|
|
36
37
|
const reasoningEffort = this.getReasoningEffort();
|
|
37
38
|
if (reasoningEffort) {
|
|
38
39
|
params.reasoning_effort = reasoningEffort;
|
|
39
40
|
}
|
|
40
41
|
const response = yield this.api.chat.completions.create(params);
|
|
41
|
-
const message = (
|
|
42
|
-
(
|
|
42
|
+
const message = (_f = (_e = (_d = (_c = (_b = response.choices) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.trim()) !== null && _f !== void 0 ? _f : MESSAGE_RESPONSE_ERROR_MESSAGE;
|
|
43
|
+
(_g = this.log) === null || _g === void 0 ? void 0 : _g.info('Received response from OpenAI', message);
|
|
43
44
|
return message;
|
|
44
45
|
});
|
|
45
46
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import OpenAI from 'openai';
|
|
1
|
+
import OpenAI, { ClientOptions } from 'openai';
|
|
2
2
|
import { ChatCompletion, ChatCompletionCreateParamsNonStreaming } from 'openai/resources';
|
|
3
|
-
export default class
|
|
4
|
-
static config?:
|
|
3
|
+
export default class SpyOpenAiModule extends OpenAI {
|
|
4
|
+
static config?: ClientOptions;
|
|
5
5
|
static lastSentCompletion?: ChatCompletionCreateParamsNonStreaming;
|
|
6
6
|
static responseMessage: string | false;
|
|
7
|
-
constructor(config:
|
|
7
|
+
constructor(config: ClientOptions);
|
|
8
8
|
chat: {
|
|
9
9
|
completions: {
|
|
10
10
|
create: (options: ChatCompletionCreateParamsNonStreaming) => Promise<Response>;
|
|
@@ -13,7 +13,4 @@ export default class SpyOpenAiApi extends OpenAI {
|
|
|
13
13
|
private createCompletion;
|
|
14
14
|
}
|
|
15
15
|
type Response = ChatCompletion;
|
|
16
|
-
interface OpenAiOptions {
|
|
17
|
-
apiKey: string;
|
|
18
|
-
}
|
|
19
16
|
export {};
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import OpenAI from 'openai';
|
|
11
|
-
class
|
|
11
|
+
class SpyOpenAiModule extends OpenAI {
|
|
12
12
|
constructor(config) {
|
|
13
13
|
super(config);
|
|
14
14
|
//@ts-ignore
|
|
@@ -17,19 +17,19 @@ class SpyOpenAiApi extends OpenAI {
|
|
|
17
17
|
create: this.createCompletion.bind(this),
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
SpyOpenAiModule.config = config;
|
|
21
21
|
}
|
|
22
22
|
createCompletion(options) {
|
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
|
|
24
|
+
SpyOpenAiModule.lastSentCompletion = options;
|
|
25
25
|
const choices = [];
|
|
26
|
-
if (
|
|
26
|
+
if (SpyOpenAiModule.responseMessage) {
|
|
27
27
|
choices.push({
|
|
28
28
|
finish_reason: 'stop',
|
|
29
29
|
index: 0,
|
|
30
30
|
logprobs: null,
|
|
31
31
|
message: {
|
|
32
|
-
content:
|
|
32
|
+
content: SpyOpenAiModule.responseMessage,
|
|
33
33
|
role: 'assistant',
|
|
34
34
|
refusal: null,
|
|
35
35
|
},
|
|
@@ -45,5 +45,5 @@ class SpyOpenAiApi extends OpenAI {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
export default
|
|
48
|
+
SpyOpenAiModule.responseMessage = 'hello!';
|
|
49
|
+
export default SpyOpenAiModule;
|
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 OpenAiAdapter from './bots/adapters/
|
|
13
|
+
import OpenAiAdapter from './bots/adapters/OpenAiAdapter.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 OpenAiAdapter from './bots/adapters/
|
|
12
|
+
import OpenAiAdapter from './bots/adapters/OpenAiAdapter.js';
|
|
13
13
|
import SprucebotLlmFactory from './bots/SprucebotLlmFactory.js';
|
|
14
14
|
dotenv.config({ quiet: true });
|
|
15
15
|
void (() => __awaiter(void 0, void 0, void 0, function* () {
|
package/build/esm/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
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 { default as OpenAiAdapter } from './bots/adapters/
|
|
4
|
+
export { default as OpenAiAdapter } from './bots/adapters/OpenAiAdapter';
|
|
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/
|
|
10
|
+
export { default as SpyOpenAiApi } from './bots/adapters/SpyOpenAiModule';
|
|
11
|
+
export { default as OllamaAdapter } from './bots/adapters/OllamaAdapter';
|
|
12
|
+
export * from './bots/adapters/OllamaAdapter';
|
package/build/esm/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
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 { default as OpenAiAdapter } from './bots/adapters/
|
|
4
|
+
export { default as OpenAiAdapter } from './bots/adapters/OpenAiAdapter.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/
|
|
10
|
+
export { default as SpyOpenAiApi } from './bots/adapters/SpyOpenAiModule.js';
|
|
11
|
+
export { default as OllamaAdapter } from './bots/adapters/OllamaAdapter.js';
|
|
12
|
+
export * from './bots/adapters/OllamaAdapter.js';
|
package/build/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
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 { default as OpenAiAdapter } from './bots/adapters/
|
|
4
|
+
export { default as OpenAiAdapter } from './bots/adapters/OpenAiAdapter';
|
|
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/
|
|
10
|
+
export { default as SpyOpenAiApi } from './bots/adapters/SpyOpenAiModule';
|
|
11
|
+
export { default as OllamaAdapter } from './bots/adapters/OllamaAdapter';
|
|
12
|
+
export * from './bots/adapters/OllamaAdapter';
|
package/build/index.js
CHANGED
|
@@ -17,15 +17,15 @@ 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.SpyOpenAiApi = exports.SpyLlmAdapter = exports.SpyLllmBot = exports.MockLlmSkill = exports.SprucebotLlmError = exports.OpenAiAdapter = exports.SprucebotLlmSkillImpl = exports.SprucebotLlmBotImpl = exports.SprucebotLlmFactory = void 0;
|
|
20
|
+
exports.OllamaAdapter = 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");
|
|
24
24
|
Object.defineProperty(exports, "SprucebotLlmBotImpl", { enumerable: true, get: function () { return __importDefault(SprucebotLlmBotImpl_1).default; } });
|
|
25
25
|
var SprucebotLlmSkillImpl_1 = require("./bots/SprucebotLlmSkillImpl");
|
|
26
26
|
Object.defineProperty(exports, "SprucebotLlmSkillImpl", { enumerable: true, get: function () { return __importDefault(SprucebotLlmSkillImpl_1).default; } });
|
|
27
|
-
var
|
|
28
|
-
Object.defineProperty(exports, "OpenAiAdapter", { enumerable: true, get: function () { return __importDefault(
|
|
27
|
+
var OpenAiAdapter_1 = require("./bots/adapters/OpenAiAdapter");
|
|
28
|
+
Object.defineProperty(exports, "OpenAiAdapter", { enumerable: true, get: function () { return __importDefault(OpenAiAdapter_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,5 +35,8 @@ 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
|
|
39
|
-
Object.defineProperty(exports, "SpyOpenAiApi", { enumerable: true, get: function () { return __importDefault(
|
|
38
|
+
var SpyOpenAiModule_1 = require("./bots/adapters/SpyOpenAiModule");
|
|
39
|
+
Object.defineProperty(exports, "SpyOpenAiApi", { enumerable: true, get: function () { return __importDefault(SpyOpenAiModule_1).default; } });
|
|
40
|
+
var OllamaAdapter_1 = require("./bots/adapters/OllamaAdapter");
|
|
41
|
+
Object.defineProperty(exports, "OllamaAdapter", { enumerable: true, get: function () { return __importDefault(OllamaAdapter_1).default; } });
|
|
42
|
+
__exportStar(require("./bots/adapters/OllamaAdapter"), exports);
|