@llumiverse/core 0.24.0 → 0.25.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/package.json +2 -2
- package/lib/cjs/CompletionStream.js +0 -244
- package/lib/cjs/CompletionStream.js.map +0 -1
- package/lib/cjs/Driver.js +0 -194
- package/lib/cjs/Driver.js.map +0 -1
- package/lib/cjs/async.js +0 -131
- package/lib/cjs/async.js.map +0 -1
- package/lib/cjs/conversation-utils.js +0 -457
- package/lib/cjs/conversation-utils.js.map +0 -1
- package/lib/cjs/formatters/commons.js +0 -7
- package/lib/cjs/formatters/commons.js.map +0 -1
- package/lib/cjs/formatters/generic.js +0 -59
- package/lib/cjs/formatters/generic.js.map +0 -1
- package/lib/cjs/formatters/index.js +0 -20
- package/lib/cjs/formatters/index.js.map +0 -1
- package/lib/cjs/formatters/nova.js +0 -99
- package/lib/cjs/formatters/nova.js.map +0 -1
- package/lib/cjs/index.js +0 -22
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/json.js +0 -29
- package/lib/cjs/json.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/resolver.js +0 -45
- package/lib/cjs/resolver.js.map +0 -1
- package/lib/cjs/stream.js +0 -30
- package/lib/cjs/stream.js.map +0 -1
- package/lib/cjs/validation.js +0 -96
- package/lib/cjs/validation.js.map +0 -1
- package/lib/esm/CompletionStream.js +0 -239
- package/lib/esm/CompletionStream.js.map +0 -1
- package/lib/esm/Driver.js +0 -189
- package/lib/esm/Driver.js.map +0 -1
- package/lib/esm/async.js +0 -123
- package/lib/esm/async.js.map +0 -1
- package/lib/esm/conversation-utils.js +0 -447
- package/lib/esm/conversation-utils.js.map +0 -1
- package/lib/esm/formatters/commons.js +0 -4
- package/lib/esm/formatters/commons.js.map +0 -1
- package/lib/esm/formatters/generic.js +0 -55
- package/lib/esm/formatters/generic.js.map +0 -1
- package/lib/esm/formatters/index.js +0 -4
- package/lib/esm/formatters/index.js.map +0 -1
- package/lib/esm/formatters/nova.js +0 -96
- package/lib/esm/formatters/nova.js.map +0 -1
- package/lib/esm/index.js +0 -6
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/json.js +0 -25
- package/lib/esm/json.js.map +0 -1
- package/lib/esm/resolver.js +0 -42
- package/lib/esm/resolver.js.map +0 -1
- package/lib/esm/stream.js +0 -25
- package/lib/esm/stream.js.map +0 -1
- package/lib/esm/validation.js +0 -88
- package/lib/esm/validation.js.map +0 -1
- package/lib/types/CompletionStream.d.ts +0 -20
- package/lib/types/CompletionStream.d.ts.map +0 -1
- package/lib/types/Driver.d.ts +0 -86
- package/lib/types/Driver.d.ts.map +0 -1
- package/lib/types/async.d.ts +0 -27
- package/lib/types/async.d.ts.map +0 -1
- package/lib/types/conversation-utils.d.ts +0 -112
- package/lib/types/conversation-utils.d.ts.map +0 -1
- package/lib/types/formatters/commons.d.ts +0 -3
- package/lib/types/formatters/commons.d.ts.map +0 -1
- package/lib/types/formatters/generic.d.ts +0 -13
- package/lib/types/formatters/generic.d.ts.map +0 -1
- package/lib/types/formatters/index.d.ts +0 -4
- package/lib/types/formatters/index.d.ts.map +0 -1
- package/lib/types/formatters/nova.d.ts +0 -40
- package/lib/types/formatters/nova.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -6
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/json.d.ts +0 -4
- package/lib/types/json.d.ts.map +0 -1
- package/lib/types/resolver.d.ts +0 -2
- package/lib/types/resolver.d.ts.map +0 -1
- package/lib/types/stream.d.ts +0 -4
- package/lib/types/stream.d.ts.map +0 -1
- package/lib/types/validation.d.ts +0 -7
- package/lib/types/validation.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llumiverse/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Provide an universal API to LLMs. Support for existing LLMs can be added by writing a driver.",
|
|
6
6
|
"files": [
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"ajv": "^8.17.1",
|
|
75
75
|
"ajv-formats": "^3.0.1",
|
|
76
76
|
"jsonrepair": "^3.13.1",
|
|
77
|
-
"@llumiverse/common": "0.
|
|
77
|
+
"@llumiverse/common": "0.25.0"
|
|
78
78
|
},
|
|
79
79
|
"ts_dual_module": {
|
|
80
80
|
"outDir": "lib",
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FallbackCompletionStream = exports.DefaultCompletionStream = void 0;
|
|
4
|
-
class DefaultCompletionStream {
|
|
5
|
-
driver;
|
|
6
|
-
prompt;
|
|
7
|
-
options;
|
|
8
|
-
chunks; // Counter for number of chunks instead of storing strings
|
|
9
|
-
completion;
|
|
10
|
-
constructor(driver, prompt, options) {
|
|
11
|
-
this.driver = driver;
|
|
12
|
-
this.prompt = prompt;
|
|
13
|
-
this.options = options;
|
|
14
|
-
this.chunks = 0;
|
|
15
|
-
}
|
|
16
|
-
async *[Symbol.asyncIterator]() {
|
|
17
|
-
// reset state
|
|
18
|
-
this.completion = undefined;
|
|
19
|
-
this.chunks = 0;
|
|
20
|
-
const accumulatedResults = []; // Accumulate CompletionResult[] from chunks
|
|
21
|
-
const accumulatedToolUse = new Map(); // Accumulate tool_use by id
|
|
22
|
-
this.driver.logger.debug(`[${this.driver.provider}] Streaming Execution of ${this.options.model} with prompt`);
|
|
23
|
-
const start = Date.now();
|
|
24
|
-
let finish_reason = undefined;
|
|
25
|
-
let promptTokens = 0;
|
|
26
|
-
let resultTokens = undefined;
|
|
27
|
-
try {
|
|
28
|
-
const stream = await this.driver.requestTextCompletionStream(this.prompt, this.options);
|
|
29
|
-
for await (const chunk of stream) {
|
|
30
|
-
if (chunk) {
|
|
31
|
-
if (typeof chunk === 'string') {
|
|
32
|
-
this.chunks++;
|
|
33
|
-
yield chunk;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
if (chunk.finish_reason) { //Do not replace non-null values with null values
|
|
37
|
-
finish_reason = chunk.finish_reason; //Used to skip empty finish_reason chunks coming after "stop" or "length"
|
|
38
|
-
}
|
|
39
|
-
if (chunk.token_usage) {
|
|
40
|
-
//Tokens returned include prior parts of stream,
|
|
41
|
-
//so overwrite rather than accumulate
|
|
42
|
-
//Math.max used as some models report final token count at beginning of stream
|
|
43
|
-
promptTokens = Math.max(promptTokens, chunk.token_usage.prompt ?? 0);
|
|
44
|
-
resultTokens = Math.max(resultTokens ?? 0, chunk.token_usage.result ?? 0);
|
|
45
|
-
}
|
|
46
|
-
// Accumulate tool_use from chunks
|
|
47
|
-
// Note: During streaming, tool_input comes as string chunks that need concatenation
|
|
48
|
-
if (chunk.tool_use && chunk.tool_use.length > 0) {
|
|
49
|
-
for (const tool of chunk.tool_use) {
|
|
50
|
-
const existing = accumulatedToolUse.get(tool.id);
|
|
51
|
-
if (existing) {
|
|
52
|
-
// Merge tool input (for streaming where arguments come as string pieces)
|
|
53
|
-
if (tool.tool_input !== null && tool.tool_input !== undefined) {
|
|
54
|
-
const existingInput = existing.tool_input;
|
|
55
|
-
const newInput = tool.tool_input;
|
|
56
|
-
if (typeof existingInput === 'string' && typeof newInput === 'string') {
|
|
57
|
-
// Concatenate string arguments
|
|
58
|
-
existing.tool_input = existingInput + newInput;
|
|
59
|
-
}
|
|
60
|
-
else if (existingInput && typeof existingInput === 'object' && newInput && typeof newInput === 'object') {
|
|
61
|
-
// Merge objects
|
|
62
|
-
existing.tool_input = { ...existingInput, ...newInput };
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
existing.tool_input = tool.tool_input;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// Update tool name if provided (might come in later chunk)
|
|
69
|
-
if (tool.tool_name) {
|
|
70
|
-
existing.tool_name = tool.tool_name;
|
|
71
|
-
}
|
|
72
|
-
// Update actual ID if provided (OpenAI sends id only in first chunk)
|
|
73
|
-
if (tool._actual_id) {
|
|
74
|
-
existing._actual_id = tool._actual_id;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
// New tool call
|
|
79
|
-
accumulatedToolUse.set(tool.id, { ...tool });
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (Array.isArray(chunk.result) && chunk.result.length > 0) {
|
|
84
|
-
// Process each result in the chunk, combining consecutive text/JSON
|
|
85
|
-
for (const result of chunk.result) {
|
|
86
|
-
// Check if we can combine with the last accumulated result
|
|
87
|
-
const lastResult = accumulatedResults[accumulatedResults.length - 1];
|
|
88
|
-
if (lastResult &&
|
|
89
|
-
((lastResult.type === 'text' && result.type === 'text') ||
|
|
90
|
-
(lastResult.type === 'json' && result.type === 'json'))) {
|
|
91
|
-
// Combine consecutive text or JSON results
|
|
92
|
-
if (result.type === 'text') {
|
|
93
|
-
lastResult.value += result.value;
|
|
94
|
-
}
|
|
95
|
-
else if (result.type === 'json') {
|
|
96
|
-
// For JSON, combine the parsed objects directly
|
|
97
|
-
try {
|
|
98
|
-
const lastParsed = lastResult.value;
|
|
99
|
-
const currentParsed = result.value;
|
|
100
|
-
if (lastParsed !== null && typeof lastParsed === 'object' &&
|
|
101
|
-
currentParsed !== null && typeof currentParsed === 'object') {
|
|
102
|
-
const combined = { ...lastParsed, ...currentParsed };
|
|
103
|
-
lastResult.value = combined;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
// If not objects, convert to string and concatenate
|
|
107
|
-
const lastStr = typeof lastParsed === 'string' ? lastParsed : JSON.stringify(lastParsed);
|
|
108
|
-
const currentStr = typeof currentParsed === 'string' ? currentParsed : JSON.stringify(currentParsed);
|
|
109
|
-
lastResult.value = lastStr + currentStr;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
// If anything fails, just concatenate string representations
|
|
114
|
-
lastResult.value = String(lastResult.value) + String(result.value);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
// Add as new result
|
|
120
|
-
accumulatedResults.push(result);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Convert CompletionResult[] to string for streaming
|
|
124
|
-
// Only yield if we have results to show
|
|
125
|
-
const resultText = chunk.result.map(r => {
|
|
126
|
-
switch (r.type) {
|
|
127
|
-
case 'text':
|
|
128
|
-
return r.value;
|
|
129
|
-
case 'json':
|
|
130
|
-
return JSON.stringify(r.value);
|
|
131
|
-
case 'image':
|
|
132
|
-
// Show truncated image placeholder for streaming
|
|
133
|
-
const truncatedValue = typeof r.value === 'string' ? r.value.slice(0, 10) : String(r.value).slice(0, 10);
|
|
134
|
-
return `\n[Image: ${truncatedValue}...]\n`;
|
|
135
|
-
default:
|
|
136
|
-
return String(r.value || '');
|
|
137
|
-
}
|
|
138
|
-
}).join('');
|
|
139
|
-
if (resultText) {
|
|
140
|
-
this.chunks++;
|
|
141
|
-
yield resultText;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
error.prompt = this.prompt;
|
|
150
|
-
throw error;
|
|
151
|
-
}
|
|
152
|
-
// Return undefined for the ExecutionTokenUsage object if there is nothing to fill it with.
|
|
153
|
-
// Allows for checking for truthy-ness on token_usage, rather than it's internals. For testing and downstream usage.
|
|
154
|
-
const tokens = resultTokens ?
|
|
155
|
-
{ prompt: promptTokens, result: resultTokens, total: resultTokens + promptTokens, } : undefined;
|
|
156
|
-
// Convert accumulated tool_use Map to array
|
|
157
|
-
const toolUseArray = accumulatedToolUse.size > 0 ? Array.from(accumulatedToolUse.values()) : undefined;
|
|
158
|
-
// Finalize tool calls: restore actual IDs and parse JSON arguments
|
|
159
|
-
if (toolUseArray) {
|
|
160
|
-
for (const tool of toolUseArray) {
|
|
161
|
-
// Restore actual ID from OpenAI (was stored in _actual_id during streaming)
|
|
162
|
-
if (tool._actual_id) {
|
|
163
|
-
tool.id = tool._actual_id;
|
|
164
|
-
delete tool._actual_id;
|
|
165
|
-
}
|
|
166
|
-
// Parse tool_input strings as JSON if needed (streaming sends arguments as string chunks)
|
|
167
|
-
if (typeof tool.tool_input === 'string') {
|
|
168
|
-
try {
|
|
169
|
-
tool.tool_input = JSON.parse(tool.tool_input);
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
// Keep as string if not valid JSON
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
this.completion = {
|
|
178
|
-
result: accumulatedResults, // Return the accumulated CompletionResult[] instead of text
|
|
179
|
-
prompt: this.prompt,
|
|
180
|
-
execution_time: Date.now() - start,
|
|
181
|
-
token_usage: tokens,
|
|
182
|
-
finish_reason: finish_reason,
|
|
183
|
-
chunks: this.chunks,
|
|
184
|
-
tool_use: toolUseArray,
|
|
185
|
-
};
|
|
186
|
-
// Build conversation context for multi-turn support
|
|
187
|
-
const conversation = this.driver.buildStreamingConversation(this.prompt, accumulatedResults, toolUseArray, this.options);
|
|
188
|
-
if (conversation !== undefined) {
|
|
189
|
-
this.completion.conversation = conversation;
|
|
190
|
-
}
|
|
191
|
-
try {
|
|
192
|
-
if (this.completion) {
|
|
193
|
-
this.driver.validateResult(this.completion, this.options);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
catch (error) {
|
|
197
|
-
error.prompt = this.prompt;
|
|
198
|
-
throw error;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
exports.DefaultCompletionStream = DefaultCompletionStream;
|
|
203
|
-
class FallbackCompletionStream {
|
|
204
|
-
driver;
|
|
205
|
-
prompt;
|
|
206
|
-
options;
|
|
207
|
-
completion;
|
|
208
|
-
constructor(driver, prompt, options) {
|
|
209
|
-
this.driver = driver;
|
|
210
|
-
this.prompt = prompt;
|
|
211
|
-
this.options = options;
|
|
212
|
-
}
|
|
213
|
-
async *[Symbol.asyncIterator]() {
|
|
214
|
-
// reset state
|
|
215
|
-
this.completion = undefined;
|
|
216
|
-
this.driver.logger.debug(`[${this.driver.provider}] Streaming is not supported, falling back to blocking execution`);
|
|
217
|
-
try {
|
|
218
|
-
const completion = await this.driver._execute(this.prompt, this.options);
|
|
219
|
-
// For fallback streaming, yield the text content but keep the original completion
|
|
220
|
-
const content = completion.result.map(r => {
|
|
221
|
-
switch (r.type) {
|
|
222
|
-
case 'text':
|
|
223
|
-
return r.value;
|
|
224
|
-
case 'json':
|
|
225
|
-
return JSON.stringify(r.value);
|
|
226
|
-
case 'image':
|
|
227
|
-
// Show truncated image placeholder for streaming
|
|
228
|
-
const truncatedValue = typeof r.value === 'string' ? r.value.slice(0, 10) : String(r.value).slice(0, 10);
|
|
229
|
-
return `[Image: ${truncatedValue}...]`;
|
|
230
|
-
default:
|
|
231
|
-
return String(r.value || '');
|
|
232
|
-
}
|
|
233
|
-
}).join('');
|
|
234
|
-
yield content;
|
|
235
|
-
this.completion = completion; // Return the original completion with untouched CompletionResult[]
|
|
236
|
-
}
|
|
237
|
-
catch (error) {
|
|
238
|
-
error.prompt = this.prompt;
|
|
239
|
-
throw error;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
exports.FallbackCompletionStream = FallbackCompletionStream;
|
|
244
|
-
//# sourceMappingURL=CompletionStream.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompletionStream.js","sourceRoot":"","sources":["../../src/CompletionStream.ts"],"names":[],"mappings":";;;AAGA,MAAa,uBAAuB;IAKb;IACR;IACA;IALX,MAAM,CAAS,CAAC,0DAA0D;IAC1E,UAAU,CAAyC;IAEnD,YAAmB,MAA8C,EACtD,MAAe,EACf,OAAyB;QAFjB,WAAM,GAAN,MAAM,CAAwC;QACtD,WAAM,GAAN,MAAM,CAAS;QACf,YAAO,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CAAC,EAAE,EAAE,CAAC,CAAC;wBACzG,OAAO,WAAW,cAAc,MAAM,CAAC;oBAC3C;wBACI,OAAO,MAAM,CAAE,CAAS,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;gBAC9C,CAAC;YACL,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACZ,MAAM,OAAO,CAAC;YACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,mEAAmE;QACrG,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YAClB,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3B,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CACJ;AAvCD,4DAuCC"}
|
package/lib/cjs/Driver.js
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Classes to handle the execution of an interaction in an execution environment.
|
|
4
|
-
* Base abstract class is then implemented by each environment
|
|
5
|
-
* (eg: OpenAI, HuggingFace, etc.)
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.AbstractDriver = void 0;
|
|
9
|
-
exports.createLogger = createLogger;
|
|
10
|
-
const CompletionStream_js_1 = require("./CompletionStream.js");
|
|
11
|
-
const index_js_1 = require("./formatters/index.js");
|
|
12
|
-
const common_1 = require("@llumiverse/common");
|
|
13
|
-
const validation_js_1 = require("./validation.js");
|
|
14
|
-
// Helper to create logger methods that support both message-only and object-first signatures
|
|
15
|
-
function createConsoleLoggerMethod(consoleMethod) {
|
|
16
|
-
return ((objOrMsg, msgOrNever, ...args) => {
|
|
17
|
-
if (typeof objOrMsg === 'string') {
|
|
18
|
-
// Message-only: logger.info("message", ...args)
|
|
19
|
-
consoleMethod(objOrMsg, msgOrNever, ...args);
|
|
20
|
-
}
|
|
21
|
-
else if (msgOrNever !== undefined) {
|
|
22
|
-
// Object-first: logger.info({ obj }, "message", ...args)
|
|
23
|
-
consoleMethod(msgOrNever, objOrMsg, ...args);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
// Object-only: logger.info({ obj })
|
|
27
|
-
consoleMethod(objOrMsg, ...args);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
const ConsoleLogger = {
|
|
32
|
-
debug: createConsoleLoggerMethod(console.debug.bind(console)),
|
|
33
|
-
info: createConsoleLoggerMethod(console.info.bind(console)),
|
|
34
|
-
warn: createConsoleLoggerMethod(console.warn.bind(console)),
|
|
35
|
-
error: createConsoleLoggerMethod(console.error.bind(console)),
|
|
36
|
-
};
|
|
37
|
-
const noop = () => void 0;
|
|
38
|
-
const NoopLogger = {
|
|
39
|
-
debug: noop,
|
|
40
|
-
info: noop,
|
|
41
|
-
warn: noop,
|
|
42
|
-
error: noop,
|
|
43
|
-
};
|
|
44
|
-
function createLogger(logger) {
|
|
45
|
-
if (logger === "console") {
|
|
46
|
-
return ConsoleLogger;
|
|
47
|
-
}
|
|
48
|
-
else if (logger) {
|
|
49
|
-
return logger;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return NoopLogger;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* To be implemented by each driver
|
|
57
|
-
*/
|
|
58
|
-
class AbstractDriver {
|
|
59
|
-
options;
|
|
60
|
-
logger;
|
|
61
|
-
constructor(opts) {
|
|
62
|
-
this.options = opts;
|
|
63
|
-
this.logger = createLogger(opts.logger);
|
|
64
|
-
}
|
|
65
|
-
async createTrainingPrompt(options) {
|
|
66
|
-
const prompt = await this.createPrompt(options.segments, { result_schema: options.schema, model: options.model });
|
|
67
|
-
return JSON.stringify({
|
|
68
|
-
prompt,
|
|
69
|
-
completion: typeof options.completion === 'string' ? options.completion : JSON.stringify(options.completion)
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
startTraining(_dataset, _options) {
|
|
73
|
-
throw new Error("Method not implemented.");
|
|
74
|
-
}
|
|
75
|
-
cancelTraining(_jobId) {
|
|
76
|
-
throw new Error("Method not implemented.");
|
|
77
|
-
}
|
|
78
|
-
getTrainingJob(_jobId) {
|
|
79
|
-
throw new Error("Method not implemented.");
|
|
80
|
-
}
|
|
81
|
-
validateResult(result, options) {
|
|
82
|
-
if (!result.tool_use && !result.error && options.result_schema) {
|
|
83
|
-
try {
|
|
84
|
-
result.result = (0, validation_js_1.validateResult)(result.result, options.result_schema);
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
const errorMessage = `[${this.provider}] [${options.model}] ${error.code ? '[' + error.code + '] ' : ''}Result validation error: ${error.message}`;
|
|
88
|
-
this.logger.error({ err: error, data: result.result }, errorMessage);
|
|
89
|
-
result.error = {
|
|
90
|
-
code: error.code || error.name,
|
|
91
|
-
message: error.message,
|
|
92
|
-
data: result.result,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
async execute(segments, options) {
|
|
98
|
-
const prompt = await this.createPrompt(segments, options);
|
|
99
|
-
return this._execute(prompt, options).catch((error) => {
|
|
100
|
-
error.prompt = prompt;
|
|
101
|
-
throw error;
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
async _execute(prompt, options) {
|
|
105
|
-
try {
|
|
106
|
-
const start = Date.now();
|
|
107
|
-
let result;
|
|
108
|
-
if (this.isImageModel(options.model)) {
|
|
109
|
-
this.logger.debug(`[${this.provider}] Executing prompt on ${options.model}, image pathway.`);
|
|
110
|
-
result = await this.requestImageGeneration(prompt, options);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
this.logger.debug(`[${this.provider}] Executing prompt on ${options.model}, text pathway.`);
|
|
114
|
-
result = await this.requestTextCompletion(prompt, options);
|
|
115
|
-
this.validateResult(result, options);
|
|
116
|
-
}
|
|
117
|
-
const execution_time = Date.now() - start;
|
|
118
|
-
return { ...result, prompt, execution_time };
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
error.prompt = prompt;
|
|
122
|
-
throw error;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
isImageModel(_model) {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
// by default no stream is supported. we block and we return all at once
|
|
129
|
-
async stream(segments, options) {
|
|
130
|
-
const prompt = await this.createPrompt(segments, options);
|
|
131
|
-
const canStream = await this.canStream(options);
|
|
132
|
-
if (options.output_modality === common_1.Modalities.text && canStream) {
|
|
133
|
-
return new CompletionStream_js_1.DefaultCompletionStream(this, prompt, options);
|
|
134
|
-
}
|
|
135
|
-
else if (this.isImageModel(options.model)) {
|
|
136
|
-
return new CompletionStream_js_1.FallbackCompletionStream(this, prompt, options);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
return new CompletionStream_js_1.FallbackCompletionStream(this, prompt, options);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Override this method to provide a custom prompt formatter
|
|
144
|
-
* @param segments
|
|
145
|
-
* @param options
|
|
146
|
-
* @returns
|
|
147
|
-
*/
|
|
148
|
-
async formatPrompt(segments, opts) {
|
|
149
|
-
return (0, index_js_1.formatTextPrompt)(segments, opts.result_schema);
|
|
150
|
-
}
|
|
151
|
-
async createPrompt(segments, opts) {
|
|
152
|
-
return await (opts.format ? opts.format(segments, opts.result_schema) : this.formatPrompt(segments, opts));
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Must be overridden if the implementation cannot stream.
|
|
156
|
-
* Some implementation may be able to stream for certain models but not for others.
|
|
157
|
-
* You must overwrite and return false if the current model doesn't support streaming.
|
|
158
|
-
* The default implementation returns true, so it is assumed that the streaming can be done.
|
|
159
|
-
* If this method returns false then the streaming execution will fallback on a blocking execution streaming the entire response as a single event.
|
|
160
|
-
* @param options the execution options containing the target model name.
|
|
161
|
-
* @returns true if the execution can be streamed false otherwise.
|
|
162
|
-
*/
|
|
163
|
-
canStream(_options) {
|
|
164
|
-
return Promise.resolve(true);
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Get a list of models that can be trained.
|
|
168
|
-
* The default is to return an empty array
|
|
169
|
-
* @returns
|
|
170
|
-
*/
|
|
171
|
-
async listTrainableModels() {
|
|
172
|
-
return [];
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Build the conversation context after streaming completion.
|
|
176
|
-
* Override this in driver implementations that support multi-turn conversations.
|
|
177
|
-
*
|
|
178
|
-
* @param prompt - The prompt that was sent (includes prior conversation context)
|
|
179
|
-
* @param result - The completion results from the streamed response
|
|
180
|
-
* @param toolUse - The tool calls from the streamed response (if any)
|
|
181
|
-
* @param options - The execution options
|
|
182
|
-
* @returns The updated conversation context, or undefined if not supported
|
|
183
|
-
*/
|
|
184
|
-
buildStreamingConversation(_prompt, _result, _toolUse, _options) {
|
|
185
|
-
// Default implementation returns undefined - drivers can override
|
|
186
|
-
return undefined;
|
|
187
|
-
}
|
|
188
|
-
async requestImageGeneration(_prompt, _options) {
|
|
189
|
-
throw new Error("Image generation not implemented.");
|
|
190
|
-
//Cannot be made abstract, as abstract methods are required in the derived class
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
exports.AbstractDriver = AbstractDriver;
|
|
194
|
-
//# sourceMappingURL=Driver.js.map
|
package/lib/cjs/Driver.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Driver.js","sourceRoot":"","sources":["../../src/Driver.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAyDH,oCAQC;AA/DD,+DAA0F;AAC1F,oDAAyD;AACzD,+CAmB4B;AAC5B,mDAAiD;AAEjD,6FAA6F;AAC7F,SAAS,yBAAyB,CAAC,aAA2C;IAC1E,OAAO,CAAC,CAAC,QAAa,EAAE,UAAgB,EAAE,GAAG,IAAmC,EAAE,EAAE;QAChF,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC/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YACJ,OAAO,IAAI,8CAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/D,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,YAAY,CAAC,QAAyB,EAAE,IAAmB;QACvE,OAAO,IAAA,2BAAgB,EAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAY,CAAC;IACrE,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,QAAyB,EAAE,IAAmB;QACpE,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/G,CAAC;IAED;;;;;;;;OAQG;IACO,SAAS,CAAC,QAA0B;QAC1C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,mBAAmB;QACrB,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;;;;;;OASG;IACH,0BAA0B,CACtB,OAAgB,EAChB,OAAkB,EAClB,QAA+B,EAC/B,QAA0B;QAE1B,kEAAkE;QAClE,OAAO,SAAS,CAAC;IACrB,CAAC;IAMD,KAAK,CAAC,sBAAsB,CAAC,OAAgB,EAAE,QAA0B;QACrE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACrD,gFAAgF;IACpF,CAAC;CAWJ;AA1KD,wCA0KC"}
|
package/lib/cjs/async.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventStream = void 0;
|
|
4
|
-
exports.asyncMap = asyncMap;
|
|
5
|
-
exports.oneAsyncIterator = oneAsyncIterator;
|
|
6
|
-
exports.transformSSEStream = transformSSEStream;
|
|
7
|
-
exports.transformAsyncIterator = transformAsyncIterator;
|
|
8
|
-
async function* asyncMap(asyncIterable, callback) {
|
|
9
|
-
let i = 0;
|
|
10
|
-
for await (const val of asyncIterable)
|
|
11
|
-
yield callback(val, i++);
|
|
12
|
-
}
|
|
13
|
-
function oneAsyncIterator(value) {
|
|
14
|
-
return {
|
|
15
|
-
async *[Symbol.asyncIterator]() {
|
|
16
|
-
yield value;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Given a ReadableStream of server sent events, tran
|
|
22
|
-
*/
|
|
23
|
-
function transformSSEStream(stream, transform) {
|
|
24
|
-
// on node and bun the ReadableStream is an async iterable
|
|
25
|
-
return stream.pipeThrough(new TransformStream({
|
|
26
|
-
transform(event, controller) {
|
|
27
|
-
if (event.type === 'event' && event.data && event.data !== '[DONE]') {
|
|
28
|
-
try {
|
|
29
|
-
const result = transform(event.data) ?? '';
|
|
30
|
-
controller.enqueue(result);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
// double check for the last event which is not a JSON - at this time togetherai and mistralai returns the string [DONE]
|
|
34
|
-
// do nothing - happens if data is not a JSON - the last event data is the [DONE] string
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
class EventStream {
|
|
41
|
-
queue = [];
|
|
42
|
-
pending;
|
|
43
|
-
done = false;
|
|
44
|
-
push(event) {
|
|
45
|
-
if (this.done) {
|
|
46
|
-
throw new Error('Cannot push to a closed stream');
|
|
47
|
-
}
|
|
48
|
-
if (this.pending) {
|
|
49
|
-
this.pending.resolve({ value: event });
|
|
50
|
-
this.pending = undefined;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.queue.push(event);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Close the stream. This means the stream cannot be fed anymore.
|
|
58
|
-
* But the consumer can still consume the remaining events.
|
|
59
|
-
*/
|
|
60
|
-
close(value) {
|
|
61
|
-
this.done = true;
|
|
62
|
-
if (this.pending) {
|
|
63
|
-
this.pending.resolve({ done: true, value });
|
|
64
|
-
this.pending = undefined;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
[Symbol.asyncIterator]() {
|
|
68
|
-
const self = this;
|
|
69
|
-
return {
|
|
70
|
-
next() {
|
|
71
|
-
const next = self.queue.shift();
|
|
72
|
-
if (next !== undefined) {
|
|
73
|
-
return Promise.resolve({ value: next });
|
|
74
|
-
}
|
|
75
|
-
else if (self.done) {
|
|
76
|
-
return Promise.resolve({ done: true, value: undefined });
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
return new Promise((resolve, reject) => {
|
|
80
|
-
self.pending = { resolve, reject };
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
async return(value) {
|
|
85
|
-
self.done = true;
|
|
86
|
-
self.queue = [];
|
|
87
|
-
if (value === undefined) {
|
|
88
|
-
return { done: true, value: undefined };
|
|
89
|
-
}
|
|
90
|
-
const _value = await value;
|
|
91
|
-
return { done: true, value: _value };
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.EventStream = EventStream;
|
|
97
|
-
/**
|
|
98
|
-
* Transform an async iterator by applying a function to each value.
|
|
99
|
-
* @param originalGenerator
|
|
100
|
-
* @param transform
|
|
101
|
-
**/
|
|
102
|
-
async function* transformAsyncIterator(originalGenerator, transform, initCallback) {
|
|
103
|
-
if (initCallback) {
|
|
104
|
-
yield initCallback();
|
|
105
|
-
}
|
|
106
|
-
for await (const value of originalGenerator) {
|
|
107
|
-
yield transform(value);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
//TODO move in a test file
|
|
111
|
-
// const max = 10; let cnt = 0;
|
|
112
|
-
// function feedStream(stream: EventStream<string>) {
|
|
113
|
-
// setTimeout(() => {
|
|
114
|
-
// cnt++;
|
|
115
|
-
// console.log('push: ', cnt, max);
|
|
116
|
-
// stream.push('event ' + cnt);
|
|
117
|
-
// if (cnt < max) {
|
|
118
|
-
// console.log('next: ', cnt, max);
|
|
119
|
-
// setTimeout(() => feedStream(stream), 1000);
|
|
120
|
-
// } else {
|
|
121
|
-
// console.log('end of stream');
|
|
122
|
-
// stream.close();
|
|
123
|
-
// }
|
|
124
|
-
// }, 1000);
|
|
125
|
-
// }
|
|
126
|
-
// const stream = new EventStream<string>();
|
|
127
|
-
// feedStream(stream);
|
|
128
|
-
// for await (const chunk of stream) {
|
|
129
|
-
// console.log('++++chunk:', chunk);
|
|
130
|
-
// }
|
|
131
|
-
//# sourceMappingURL=async.js.map
|
package/lib/cjs/async.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../src/async.ts"],"names":[],"mappings":";;;AAGA,4BAIC;AAED,4CAMC;AAKD,gDAeC;AAuED,wDAWC;AAlHM,KAAK,SAAS,CAAC,CAAC,QAAQ,CAAO,aAA+B,EAAE,QAAwC;IAC3G,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,aAAa;QACjC,MAAM,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,SAAgB,gBAAgB,CAAI,KAAQ;IACxC,OAAO;QACH,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;YACzB,MAAM,KAAK,CAAA;QACf,CAAC;KACJ,CAAA;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,MAAuC,EAAE,SAAkD;IAC1H,0DAA0D;IAC1D,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,eAAe,CAAyC;QAClF,SAAS,CAAC,KAAsB,EAAE,UAAU;YACxC,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAA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