@trymirai/uzu 0.1.44 → 0.1.45
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/README.md +100 -1
- package/bridging/config.d.mts +6 -3
- package/bridging/config.d.mts.map +1 -1
- package/bridging/config.d.ts +6 -3
- package/bridging/config.d.ts.map +1 -1
- package/bridging/config.js +15 -9
- package/bridging/config.js.map +1 -1
- package/bridging/config.mjs +15 -9
- package/bridging/config.mjs.map +1 -1
- package/bridging/contextMode.d.mts +12 -0
- package/bridging/contextMode.d.mts.map +1 -0
- package/bridging/contextMode.d.ts +12 -0
- package/bridging/contextMode.d.ts.map +1 -0
- package/bridging/contextMode.js +26 -0
- package/bridging/contextMode.js.map +1 -0
- package/bridging/contextMode.mjs +22 -0
- package/bridging/contextMode.mjs.map +1 -0
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/interactors/chatModelInteractor.d.mts +3 -1
- package/interactors/chatModelInteractor.d.mts.map +1 -1
- package/interactors/chatModelInteractor.d.ts +3 -1
- package/interactors/chatModelInteractor.d.ts.map +1 -1
- package/interactors/chatModelInteractor.js +6 -2
- package/interactors/chatModelInteractor.js.map +1 -1
- package/interactors/chatModelInteractor.mjs +6 -2
- package/interactors/chatModelInteractor.mjs.map +1 -1
- package/napi/uzu.d.ts +7 -1
- package/napi/uzu.js +2 -0
- package/napi/uzu.mjs +1 -0
- package/napi/uzu.node +0 -0
- package/package.json +1 -1
- package/src/bridging/config.ts +50 -10
- package/src/bridging/contextMode.ts +31 -0
- package/src/index.ts +1 -0
- package/src/interactors/chatModelInteractor.ts +8 -2
- package/src/napi/uzu.d.ts +7 -1
- package/src/napi/uzu.js +2 -0
- package/src/napi/uzu.mjs +1 -0
- package/src/napi/uzu.node +0 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Add the `uzu` dependency to your project's `package.json`:
|
|
|
26
26
|
|
|
27
27
|
```json
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@trymirai/uzu": "0.1.
|
|
29
|
+
"@trymirai/uzu": "0.1.45"
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -47,6 +47,8 @@ Place the `API_KEY` you obtained earlier in the corresponding example file, and
|
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
49
|
pnpm run tsn examples/chat.ts
|
|
50
|
+
pnpm run tsn examples/chatDynamicContext.ts
|
|
51
|
+
pnpm run tsn examples/chatStaticContext.ts
|
|
50
52
|
pnpm run tsn examples/summarization.ts
|
|
51
53
|
pnpm run tsn examples/classification.ts
|
|
52
54
|
pnpm run tsn examples/cloud.ts
|
|
@@ -82,6 +84,103 @@ main().catch((error) => {
|
|
|
82
84
|
});
|
|
83
85
|
```
|
|
84
86
|
|
|
87
|
+
### Chat with dynamic context
|
|
88
|
+
|
|
89
|
+
In this example, we will use the dynamic `ContextMode`, which automatically maintains a continuous conversation history instead of resetting the context with each new input. Every new message is added to the ongoing chat, allowing the model to remember what has already been said and respond with full context.
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import Engine, { Config, ContextMode, Input, RunConfig } from '@trymirai/uzu';
|
|
93
|
+
|
|
94
|
+
async function main() {
|
|
95
|
+
const engine = await Engine.load('API_KEY');
|
|
96
|
+
|
|
97
|
+
const model = await engine.chatModel('Qwen/Qwen3-0.6B');
|
|
98
|
+
await engine.downloadChatModel(model, (update) => {
|
|
99
|
+
console.log('Progress:', update.progress);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const config = Config
|
|
103
|
+
.default()
|
|
104
|
+
.withContextMode(ContextMode.dynamic());
|
|
105
|
+
const session = engine.chatSession(model, config);
|
|
106
|
+
|
|
107
|
+
const requests = [
|
|
108
|
+
'Tell about London',
|
|
109
|
+
'Compare with New York',
|
|
110
|
+
'Compare the population of the two',
|
|
111
|
+
];
|
|
112
|
+
const runConfig = RunConfig
|
|
113
|
+
.default()
|
|
114
|
+
.withTokensLimit(1024)
|
|
115
|
+
.withEnableThinking(false);
|
|
116
|
+
|
|
117
|
+
for (const request of requests) {
|
|
118
|
+
const output = session.run(Input.text(request), runConfig, (partialOutput) => {
|
|
119
|
+
return true;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
console.log('Request:', request);
|
|
123
|
+
console.log('Response:', output.text.original.trim());
|
|
124
|
+
console.log('-------------------------');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
main().catch((error) => {
|
|
129
|
+
console.error(error);
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Chat with static context
|
|
134
|
+
|
|
135
|
+
In this example, we will use the static `ContextMode`, which begins with an initial list of messages defining the base context of the conversation, such as predefined instructions. Unlike dynamic mode, this context is fixed and does not evolve with new messages. Each inference request is processed independently, using only the initial context and the latest input, without retaining any previous conversation history.
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import Engine, { Config, ContextMode, Input, Message, RunConfig } from '@trymirai/uzu';
|
|
139
|
+
|
|
140
|
+
function listToString(list: string[]): string {
|
|
141
|
+
return "[" + list.map((item) => `"${item}"`).join(", ") + "]";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function main() {
|
|
145
|
+
const engine = await Engine.load('API_KEY');
|
|
146
|
+
|
|
147
|
+
const model = await engine.chatModel('Qwen/Qwen3-0.6B');
|
|
148
|
+
await engine.downloadChatModel(model, (update) => {
|
|
149
|
+
console.log('Progress:', update.progress);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const instructions =
|
|
153
|
+
`Your task is to name countries for each city in the given list.
|
|
154
|
+
For example for ${listToString(["Helsenki", "Stockholm", "Barcelona"])} the answer should be ${listToString(["Finland", "Sweden", "Spain"])}.`;
|
|
155
|
+
const config = Config
|
|
156
|
+
.default()
|
|
157
|
+
.withContextMode(ContextMode.static(Input.messages([Message.system(instructions)])));
|
|
158
|
+
const session = engine.chatSession(model, config);
|
|
159
|
+
|
|
160
|
+
const requests = [
|
|
161
|
+
listToString(["New York", "London", "Lisbon", "Paris", "Berlin"]),
|
|
162
|
+
listToString(["Bangkok", "Tokyo", "Seoul", "Beijing", "Delhi"]),
|
|
163
|
+
];
|
|
164
|
+
const runConfig = RunConfig
|
|
165
|
+
.default()
|
|
166
|
+
.withEnableThinking(false);
|
|
167
|
+
|
|
168
|
+
for (const request of requests) {
|
|
169
|
+
const output = session.run(Input.text(request), runConfig, (partialOutput) => {
|
|
170
|
+
return true;
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
console.log('Request:', request);
|
|
174
|
+
console.log('Response:', output.text.original.trim());
|
|
175
|
+
console.log('-------------------------');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
main().catch((error) => {
|
|
180
|
+
console.error(error);
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
85
184
|
### Summarization
|
|
86
185
|
|
|
87
186
|
In this example, we will use the `summarization` preset to generate a summary of the input text:
|
package/bridging/config.d.mts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { Config as NapiConfig } from "../napi/uzu.mjs";
|
|
2
2
|
import { ContextLength } from "./contextLength.mjs";
|
|
3
|
+
import { ContextMode } from "./contextMode.mjs";
|
|
3
4
|
import { ToNapi } from "./napi.mjs";
|
|
4
5
|
import { PrefillStepSize } from "./prefillStepSize.mjs";
|
|
5
6
|
import { Preset } from "./preset.mjs";
|
|
6
7
|
import { SamplingSeed } from "./samplingSeed.mjs";
|
|
7
8
|
export declare class Config implements ToNapi<NapiConfig> {
|
|
8
9
|
readonly preset: Preset;
|
|
9
|
-
readonly
|
|
10
|
+
readonly contextMode: ContextMode;
|
|
10
11
|
readonly contextLength: ContextLength;
|
|
12
|
+
readonly prefillStepSize: PrefillStepSize;
|
|
11
13
|
readonly samplingSeed: SamplingSeed;
|
|
12
|
-
constructor(preset: Preset,
|
|
14
|
+
constructor(preset: Preset, contextMode: ContextMode, contextLength: ContextLength, prefillStepSize: PrefillStepSize, samplingSeed: SamplingSeed);
|
|
13
15
|
static default(): Config;
|
|
14
16
|
withPreset(preset: Preset): Config;
|
|
15
|
-
|
|
17
|
+
withContextMode(contextMode: ContextMode): Config;
|
|
16
18
|
withContextLength(contextLength: ContextLength): Config;
|
|
19
|
+
withPrefillStepSize(prefillStepSize: PrefillStepSize): Config;
|
|
17
20
|
withSamplingSeed(samplingSeed: SamplingSeed): Config;
|
|
18
21
|
toNapi(): NapiConfig;
|
|
19
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","sourceRoot":"","sources":["../src/bridging/config.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,IAAI,UAAU,EAAE;OACxB,EAAE,aAAa,EAAE;OACjB,EAAE,MAAM,EAAE;OACV,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,YAAY,EAAE;AAEvB,qBAAa,MAAO,YAAW,MAAM,CAAC,UAAU,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"config.d.mts","sourceRoot":"","sources":["../src/bridging/config.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,IAAI,UAAU,EAAE;OACxB,EAAE,aAAa,EAAE;OACjB,EAAE,WAAW,EAAE;OACf,EAAE,MAAM,EAAE;OACV,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,YAAY,EAAE;AAEvB,qBAAa,MAAO,YAAW,MAAM,CAAC,UAAU,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;gBAGhC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY;IAS9B,MAAM,CAAC,OAAO,IAAI,MAAM;IAUxB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAUlC,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM;IAUjD,iBAAiB,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM;IAUvD,mBAAmB,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM;IAU7D,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM;IAUpD,MAAM,IAAI,UAAU;CAUvB"}
|
package/bridging/config.d.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { Config as NapiConfig } from "../napi/uzu.js";
|
|
2
2
|
import { ContextLength } from "./contextLength.js";
|
|
3
|
+
import { ContextMode } from "./contextMode.js";
|
|
3
4
|
import { ToNapi } from "./napi.js";
|
|
4
5
|
import { PrefillStepSize } from "./prefillStepSize.js";
|
|
5
6
|
import { Preset } from "./preset.js";
|
|
6
7
|
import { SamplingSeed } from "./samplingSeed.js";
|
|
7
8
|
export declare class Config implements ToNapi<NapiConfig> {
|
|
8
9
|
readonly preset: Preset;
|
|
9
|
-
readonly
|
|
10
|
+
readonly contextMode: ContextMode;
|
|
10
11
|
readonly contextLength: ContextLength;
|
|
12
|
+
readonly prefillStepSize: PrefillStepSize;
|
|
11
13
|
readonly samplingSeed: SamplingSeed;
|
|
12
|
-
constructor(preset: Preset,
|
|
14
|
+
constructor(preset: Preset, contextMode: ContextMode, contextLength: ContextLength, prefillStepSize: PrefillStepSize, samplingSeed: SamplingSeed);
|
|
13
15
|
static default(): Config;
|
|
14
16
|
withPreset(preset: Preset): Config;
|
|
15
|
-
|
|
17
|
+
withContextMode(contextMode: ContextMode): Config;
|
|
16
18
|
withContextLength(contextLength: ContextLength): Config;
|
|
19
|
+
withPrefillStepSize(prefillStepSize: PrefillStepSize): Config;
|
|
17
20
|
withSamplingSeed(samplingSeed: SamplingSeed): Config;
|
|
18
21
|
toNapi(): NapiConfig;
|
|
19
22
|
}
|
package/bridging/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/bridging/config.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,IAAI,UAAU,EAAE;OACxB,EAAE,aAAa,EAAE;OACjB,EAAE,MAAM,EAAE;OACV,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,YAAY,EAAE;AAEvB,qBAAa,MAAO,YAAW,MAAM,CAAC,UAAU,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/bridging/config.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,IAAI,UAAU,EAAE;OACxB,EAAE,aAAa,EAAE;OACjB,EAAE,WAAW,EAAE;OACf,EAAE,MAAM,EAAE;OACV,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,YAAY,EAAE;AAEvB,qBAAa,MAAO,YAAW,MAAM,CAAC,UAAU,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;gBAGhC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY;IAS9B,MAAM,CAAC,OAAO,IAAI,MAAM;IAUxB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAUlC,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM;IAUjD,iBAAiB,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM;IAUvD,mBAAmB,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM;IAU7D,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM;IAUpD,MAAM,IAAI,UAAU;CAUvB"}
|
package/bridging/config.js
CHANGED
|
@@ -2,36 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Config = void 0;
|
|
4
4
|
const contextLength_1 = require("./contextLength.js");
|
|
5
|
+
const contextMode_1 = require("./contextMode.js");
|
|
5
6
|
const prefillStepSize_1 = require("./prefillStepSize.js");
|
|
6
7
|
const preset_1 = require("./preset.js");
|
|
7
8
|
const samplingSeed_1 = require("./samplingSeed.js");
|
|
8
9
|
class Config {
|
|
9
|
-
constructor(preset,
|
|
10
|
+
constructor(preset, contextMode, contextLength, prefillStepSize, samplingSeed) {
|
|
10
11
|
this.preset = preset;
|
|
11
|
-
this.
|
|
12
|
+
this.contextMode = contextMode;
|
|
12
13
|
this.contextLength = contextLength;
|
|
14
|
+
this.prefillStepSize = prefillStepSize;
|
|
13
15
|
this.samplingSeed = samplingSeed;
|
|
14
16
|
}
|
|
15
17
|
static default() {
|
|
16
|
-
return new Config(preset_1.Preset.general(),
|
|
18
|
+
return new Config(preset_1.Preset.general(), contextMode_1.ContextMode.none(), contextLength_1.ContextLength.default(), prefillStepSize_1.PrefillStepSize.default(), samplingSeed_1.SamplingSeed.default());
|
|
17
19
|
}
|
|
18
20
|
withPreset(preset) {
|
|
19
|
-
return new Config(preset, this.
|
|
21
|
+
return new Config(preset, this.contextMode, this.contextLength, this.prefillStepSize, this.samplingSeed);
|
|
20
22
|
}
|
|
21
|
-
|
|
22
|
-
return new Config(this.preset,
|
|
23
|
+
withContextMode(contextMode) {
|
|
24
|
+
return new Config(this.preset, contextMode, this.contextLength, this.prefillStepSize, this.samplingSeed);
|
|
23
25
|
}
|
|
24
26
|
withContextLength(contextLength) {
|
|
25
|
-
return new Config(this.preset, this.
|
|
27
|
+
return new Config(this.preset, this.contextMode, contextLength, this.prefillStepSize, this.samplingSeed);
|
|
28
|
+
}
|
|
29
|
+
withPrefillStepSize(prefillStepSize) {
|
|
30
|
+
return new Config(this.preset, this.contextMode, this.contextLength, prefillStepSize, this.samplingSeed);
|
|
26
31
|
}
|
|
27
32
|
withSamplingSeed(samplingSeed) {
|
|
28
|
-
return new Config(this.preset, this.
|
|
33
|
+
return new Config(this.preset, this.contextMode, this.contextLength, this.prefillStepSize, samplingSeed);
|
|
29
34
|
}
|
|
30
35
|
toNapi() {
|
|
31
36
|
const napiConfig = {
|
|
32
37
|
preset: this.preset.toNapi(),
|
|
33
|
-
|
|
38
|
+
contextMode: this.contextMode.toNapi(),
|
|
34
39
|
contextLength: this.contextLength.toNapi(),
|
|
40
|
+
prefillStepSize: this.prefillStepSize.toNapi(),
|
|
35
41
|
samplingSeed: this.samplingSeed.toNapi(),
|
|
36
42
|
};
|
|
37
43
|
return napiConfig;
|
package/bridging/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/bridging/config.ts"],"names":[],"mappings":";;;AACA,sDAAgD;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/bridging/config.ts"],"names":[],"mappings":";;;AACA,sDAAgD;AAChD,kDAA4C;AAE5C,0DAAoD;AACpD,wCAAkC;AAClC,oDAA8C;AAE9C,MAAa,MAAM;IAOf,YACI,MAAc,EACd,WAAwB,EACxB,aAA4B,EAC5B,eAAgC,E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AC,MAAM,EACX,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,eAAe,EACpB,YAAY,CACf,CAAC;IACN,CAAC;IAED,MAAM;QACF,MAAM,UAAU,GAAe;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;YACtC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YAC1C,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;YAC9C,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;SAC3C,CAAC;QACF,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AA3FD,wBA2FC"}
|
package/bridging/config.mjs
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
import { ContextLength } from "./contextLength.mjs";
|
|
2
|
+
import { ContextMode } from "./contextMode.mjs";
|
|
2
3
|
import { PrefillStepSize } from "./prefillStepSize.mjs";
|
|
3
4
|
import { Preset } from "./preset.mjs";
|
|
4
5
|
import { SamplingSeed } from "./samplingSeed.mjs";
|
|
5
6
|
export class Config {
|
|
6
|
-
constructor(preset,
|
|
7
|
+
constructor(preset, contextMode, contextLength, prefillStepSize, samplingSeed) {
|
|
7
8
|
this.preset = preset;
|
|
8
|
-
this.
|
|
9
|
+
this.contextMode = contextMode;
|
|
9
10
|
this.contextLength = contextLength;
|
|
11
|
+
this.prefillStepSize = prefillStepSize;
|
|
10
12
|
this.samplingSeed = samplingSeed;
|
|
11
13
|
}
|
|
12
14
|
static default() {
|
|
13
|
-
return new Config(Preset.general(),
|
|
15
|
+
return new Config(Preset.general(), ContextMode.none(), ContextLength.default(), PrefillStepSize.default(), SamplingSeed.default());
|
|
14
16
|
}
|
|
15
17
|
withPreset(preset) {
|
|
16
|
-
return new Config(preset, this.
|
|
18
|
+
return new Config(preset, this.contextMode, this.contextLength, this.prefillStepSize, this.samplingSeed);
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
return new Config(this.preset,
|
|
20
|
+
withContextMode(contextMode) {
|
|
21
|
+
return new Config(this.preset, contextMode, this.contextLength, this.prefillStepSize, this.samplingSeed);
|
|
20
22
|
}
|
|
21
23
|
withContextLength(contextLength) {
|
|
22
|
-
return new Config(this.preset, this.
|
|
24
|
+
return new Config(this.preset, this.contextMode, contextLength, this.prefillStepSize, this.samplingSeed);
|
|
25
|
+
}
|
|
26
|
+
withPrefillStepSize(prefillStepSize) {
|
|
27
|
+
return new Config(this.preset, this.contextMode, this.contextLength, prefillStepSize, this.samplingSeed);
|
|
23
28
|
}
|
|
24
29
|
withSamplingSeed(samplingSeed) {
|
|
25
|
-
return new Config(this.preset, this.
|
|
30
|
+
return new Config(this.preset, this.contextMode, this.contextLength, this.prefillStepSize, samplingSeed);
|
|
26
31
|
}
|
|
27
32
|
toNapi() {
|
|
28
33
|
const napiConfig = {
|
|
29
34
|
preset: this.preset.toNapi(),
|
|
30
|
-
|
|
35
|
+
contextMode: this.contextMode.toNapi(),
|
|
31
36
|
contextLength: this.contextLength.toNapi(),
|
|
37
|
+
prefillStepSize: this.prefillStepSize.toNapi(),
|
|
32
38
|
samplingSeed: this.samplingSeed.toNapi(),
|
|
33
39
|
};
|
|
34
40
|
return napiConfig;
|
package/bridging/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","sourceRoot":"","sources":["../src/bridging/config.ts"],"names":[],"mappings":"OACO,EAAE,aAAa,EAAE;
|
|
1
|
+
{"version":3,"file":"config.mjs","sourceRoot":"","sources":["../src/bridging/config.ts"],"names":[],"mappings":"OACO,EAAE,aAAa,EAAE;OACjB,EAAE,WAAW,EAAE;OAEf,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,YAAY,EAAE;AAEvB,MAAM,OAAO,MAAM;IAOf,YACI,MAAc,EACd,WAAwB,EAC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I,MAAM,CACb,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,eAAe,EACpB,YAAY,CACf,CAAC;IACN,CAAC;IAED,MAAM;QACF,MAAM,UAAU,GAAe;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;YACtC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YAC1C,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;YAC9C,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;SAC3C,CAAC;QACF,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ContextMode as NapiContextMode } from "../napi/uzu.mjs";
|
|
2
|
+
import { Input } from "./input.mjs";
|
|
3
|
+
import { ToNapi } from "./napi.mjs";
|
|
4
|
+
export declare class ContextMode implements ToNapi<NapiContextMode> {
|
|
5
|
+
private readonly napiContextMode;
|
|
6
|
+
private constructor();
|
|
7
|
+
static none(): ContextMode;
|
|
8
|
+
static static(input: Input): ContextMode;
|
|
9
|
+
static dynamic(): ContextMode;
|
|
10
|
+
toNapi(): NapiContextMode;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=contextMode.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextMode.d.mts","sourceRoot":"","sources":["../src/bridging/contextMode.ts"],"names":[],"mappings":"OAAO,EAAE,WAAW,IAAI,eAAe,EAAsB;OACtD,EAAE,KAAK,EAAE;OACT,EAAE,MAAM,EAAE;AAEjB,qBAAa,WAAY,YAAW,MAAM,CAAC,eAAe,CAAC;IACvD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAElD,OAAO;IAIP,MAAM,CAAC,IAAI,IAAI,WAAW;IAK1B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW;IAMxC,MAAM,CAAC,OAAO,IAAI,WAAW;IAK7B,MAAM,IAAI,eAAe;CAG5B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ContextMode as NapiContextMode } from "../napi/uzu.js";
|
|
2
|
+
import { Input } from "./input.js";
|
|
3
|
+
import { ToNapi } from "./napi.js";
|
|
4
|
+
export declare class ContextMode implements ToNapi<NapiContextMode> {
|
|
5
|
+
private readonly napiContextMode;
|
|
6
|
+
private constructor();
|
|
7
|
+
static none(): ContextMode;
|
|
8
|
+
static static(input: Input): ContextMode;
|
|
9
|
+
static dynamic(): ContextMode;
|
|
10
|
+
toNapi(): NapiContextMode;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=contextMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextMode.d.ts","sourceRoot":"","sources":["../src/bridging/contextMode.ts"],"names":[],"mappings":"OAAO,EAAE,WAAW,IAAI,eAAe,EAAsB;OACtD,EAAE,KAAK,EAAE;OACT,EAAE,MAAM,EAAE;AAEjB,qBAAa,WAAY,YAAW,MAAM,CAAC,eAAe,CAAC;IACvD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAElD,OAAO;IAIP,MAAM,CAAC,IAAI,IAAI,WAAW;IAK1B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW;IAMxC,MAAM,CAAC,OAAO,IAAI,WAAW;IAK7B,MAAM,IAAI,eAAe;CAG5B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContextMode = void 0;
|
|
4
|
+
class ContextMode {
|
|
5
|
+
constructor(napiContextMode) {
|
|
6
|
+
this.napiContextMode = napiContextMode;
|
|
7
|
+
}
|
|
8
|
+
static none() {
|
|
9
|
+
const napiContextMode = { type: 'None' };
|
|
10
|
+
return new ContextMode(napiContextMode);
|
|
11
|
+
}
|
|
12
|
+
static static(input) {
|
|
13
|
+
let napiInput = input.toNapi();
|
|
14
|
+
let napiContextMode = { type: 'Static', input: napiInput };
|
|
15
|
+
return new ContextMode(napiContextMode);
|
|
16
|
+
}
|
|
17
|
+
static dynamic() {
|
|
18
|
+
const napiContextMode = { type: 'Dynamic' };
|
|
19
|
+
return new ContextMode(napiContextMode);
|
|
20
|
+
}
|
|
21
|
+
toNapi() {
|
|
22
|
+
return this.napiContextMode;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ContextMode = ContextMode;
|
|
26
|
+
//# sourceMappingURL=contextMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextMode.js","sourceRoot":"","sources":["../src/bridging/contextMode.ts"],"names":[],"mappings":";;;AAIA,MAAa,WAAW;IAGpB,YAAoB,eAAgC;QAChD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,IAAI;QACP,MAAM,eAAe,GAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC1D,OAAO,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAY;QACtB,IAAI,SAAS,GAAc,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1C,IAAI,eAAe,GAAoB,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAC5E,OAAO,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,OAAO;QACV,MAAM,eAAe,GAAoB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC7D,OAAO,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;CACJ;AA1BD,kCA0BC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class ContextMode {
|
|
2
|
+
constructor(napiContextMode) {
|
|
3
|
+
this.napiContextMode = napiContextMode;
|
|
4
|
+
}
|
|
5
|
+
static none() {
|
|
6
|
+
const napiContextMode = { type: 'None' };
|
|
7
|
+
return new ContextMode(napiContextMode);
|
|
8
|
+
}
|
|
9
|
+
static static(input) {
|
|
10
|
+
let napiInput = input.toNapi();
|
|
11
|
+
let napiContextMode = { type: 'Static', input: napiInput };
|
|
12
|
+
return new ContextMode(napiContextMode);
|
|
13
|
+
}
|
|
14
|
+
static dynamic() {
|
|
15
|
+
const napiContextMode = { type: 'Dynamic' };
|
|
16
|
+
return new ContextMode(napiContextMode);
|
|
17
|
+
}
|
|
18
|
+
toNapi() {
|
|
19
|
+
return this.napiContextMode;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=contextMode.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextMode.mjs","sourceRoot":"","sources":["../src/bridging/contextMode.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,WAAW;IAGpB,YAAoB,eAAgC;QAChD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,IAAI;QACP,MAAM,eAAe,GAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC1D,OAAO,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAY;QACtB,IAAI,SAAS,GAAc,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1C,IAAI,eAAe,GAAoB,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAC5E,OAAO,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,OAAO;QACV,MAAM,eAAe,GAAoB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC7D,OAAO,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;CACJ"}
|
package/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ export { ChatSession } from "./bridging/chatSession.mjs";
|
|
|
3
3
|
export { ClassificationFeature } from "./bridging/classificationFeature.mjs";
|
|
4
4
|
export { Config } from "./bridging/config.mjs";
|
|
5
5
|
export { ContextLength } from "./bridging/contextLength.mjs";
|
|
6
|
+
export { ContextMode } from "./bridging/contextMode.mjs";
|
|
6
7
|
export { DownloadHandle } from "./bridging/downloadHandle.mjs";
|
|
7
8
|
export { DownloadProgressUpdate } from "./bridging/downloadProgressUpdate.mjs";
|
|
8
9
|
export { DownloadPhase, DownloadState } from "./bridging/downloadState.mjs";
|
package/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE;OACb,EAAE,WAAW,EAAE;OACf,EAAE,qBAAqB,EAAE;OACzB,EAAE,MAAM,EAAE;OACV,EAAE,aAAa,EAAE;OACjB,EAAE,cAAc,EAAE;OAClB,EAAE,sBAAsB,EAAE;OAC1B,EAAE,aAAa,EAAE,aAAa,EAAE;OAChC,EAAE,MAAM,IAAI,OAAO,EAAE;OACrB,EAAE,YAAY,EAAE;OAChB,EAAE,KAAK,EAAE;OACT,EAAE,OAAO,EAAE;OACX,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE;OACV,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,IAAI,EAAE;OACR,EAAE,SAAS,EAAE;OACb,EAAE,QAAQ,EAAE;OACZ,EAAE,cAAc,EAAE;OAClB,EAAE,cAAc,EAAE;OAClB,EAAE,YAAY,EAAE;OAChB,EAAE,KAAK,EAAE;OACT,EAAE,SAAS,EAAE;OACb,EAAE,IAAI,EAAE;OACR,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE;OACf,EAAE,mBAAmB,EAAE;OACvB,EAAE,oBAAoB,EAAE;OACxB,EAAE,qBAAqB,EAAE;OACzB,EAAE,kBAAkB,EAAE;OACtB,EAAE,gBAAgB,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE;OACb,EAAE,WAAW,EAAE;OACf,EAAE,qBAAqB,EAAE;OACzB,EAAE,MAAM,EAAE;OACV,EAAE,aAAa,EAAE;OACjB,EAAE,WAAW,EAAE;OACf,EAAE,cAAc,EAAE;OAClB,EAAE,sBAAsB,EAAE;OAC1B,EAAE,aAAa,EAAE,aAAa,EAAE;OAChC,EAAE,MAAM,IAAI,OAAO,EAAE;OACrB,EAAE,YAAY,EAAE;OAChB,EAAE,KAAK,EAAE;OACT,EAAE,OAAO,EAAE;OACX,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE;OACV,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,IAAI,EAAE;OACR,EAAE,SAAS,EAAE;OACb,EAAE,QAAQ,EAAE;OACZ,EAAE,cAAc,EAAE;OAClB,EAAE,cAAc,EAAE;OAClB,EAAE,YAAY,EAAE;OAChB,EAAE,KAAK,EAAE;OACT,EAAE,SAAS,EAAE;OACb,EAAE,IAAI,EAAE;OACR,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE;OACf,EAAE,mBAAmB,EAAE;OACvB,EAAE,oBAAoB,EAAE;OACxB,EAAE,qBAAqB,EAAE;OACzB,EAAE,kBAAkB,EAAE;OACtB,EAAE,gBAAgB,EAAE"}
|
package/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { ChatSession } from "./bridging/chatSession.js";
|
|
|
3
3
|
export { ClassificationFeature } from "./bridging/classificationFeature.js";
|
|
4
4
|
export { Config } from "./bridging/config.js";
|
|
5
5
|
export { ContextLength } from "./bridging/contextLength.js";
|
|
6
|
+
export { ContextMode } from "./bridging/contextMode.js";
|
|
6
7
|
export { DownloadHandle } from "./bridging/downloadHandle.js";
|
|
7
8
|
export { DownloadProgressUpdate } from "./bridging/downloadProgressUpdate.js";
|
|
8
9
|
export { DownloadPhase, DownloadState } from "./bridging/downloadState.js";
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE;OACb,EAAE,WAAW,EAAE;OACf,EAAE,qBAAqB,EAAE;OACzB,EAAE,MAAM,EAAE;OACV,EAAE,aAAa,EAAE;OACjB,EAAE,cAAc,EAAE;OAClB,EAAE,sBAAsB,EAAE;OAC1B,EAAE,aAAa,EAAE,aAAa,EAAE;OAChC,EAAE,MAAM,IAAI,OAAO,EAAE;OACrB,EAAE,YAAY,EAAE;OAChB,EAAE,KAAK,EAAE;OACT,EAAE,OAAO,EAAE;OACX,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE;OACV,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,IAAI,EAAE;OACR,EAAE,SAAS,EAAE;OACb,EAAE,QAAQ,EAAE;OACZ,EAAE,cAAc,EAAE;OAClB,EAAE,cAAc,EAAE;OAClB,EAAE,YAAY,EAAE;OAChB,EAAE,KAAK,EAAE;OACT,EAAE,SAAS,EAAE;OACb,EAAE,IAAI,EAAE;OACR,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE;OACf,EAAE,mBAAmB,EAAE;OACvB,EAAE,oBAAoB,EAAE;OACxB,EAAE,qBAAqB,EAAE;OACzB,EAAE,kBAAkB,EAAE;OACtB,EAAE,gBAAgB,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE;OACb,EAAE,WAAW,EAAE;OACf,EAAE,qBAAqB,EAAE;OACzB,EAAE,MAAM,EAAE;OACV,EAAE,aAAa,EAAE;OACjB,EAAE,WAAW,EAAE;OACf,EAAE,cAAc,EAAE;OAClB,EAAE,sBAAsB,EAAE;OAC1B,EAAE,aAAa,EAAE,aAAa,EAAE;OAChC,EAAE,MAAM,IAAI,OAAO,EAAE;OACrB,EAAE,YAAY,EAAE;OAChB,EAAE,KAAK,EAAE;OACT,EAAE,OAAO,EAAE;OACX,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE;OACV,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,IAAI,EAAE;OACR,EAAE,SAAS,EAAE;OACb,EAAE,QAAQ,EAAE;OACZ,EAAE,cAAc,EAAE;OAClB,EAAE,cAAc,EAAE;OAClB,EAAE,YAAY,EAAE;OAChB,EAAE,KAAK,EAAE;OACT,EAAE,SAAS,EAAE;OACb,EAAE,IAAI,EAAE;OACR,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE;OACf,EAAE,mBAAmB,EAAE;OACvB,EAAE,oBAAoB,EAAE;OACxB,EAAE,qBAAqB,EAAE;OACzB,EAAE,kBAAkB,EAAE;OACtB,EAAE,gBAAgB,EAAE"}
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ exports = module.exports = function (...args) {
|
|
|
3
3
|
return new exports.default(...args)
|
|
4
4
|
}
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EngineInteractor = exports.DownloadInteractor = exports.ChatSessionInteractor = exports.ChatModelsInteractor = exports.ChatModelInteractor = exports.EngineError = exports.TotalStats = exports.Text = exports.StepStats = exports.Stats = exports.SamplingSeed = exports.SamplingPolicy = exports.SamplingMethod = exports.RunStats = exports.RunConfig = exports.Role = exports.Preset = exports.PrefillStepSize = exports.ParsedText = exports.Output = exports.ModelType = exports.Message = exports.Input = exports.FinishReason = exports.default = exports.DownloadState = exports.DownloadPhase = exports.DownloadProgressUpdate = exports.DownloadHandle = exports.ContextLength = exports.Config = exports.ClassificationFeature = exports.ChatSession = exports.ChatModel = void 0;
|
|
6
|
+
exports.EngineInteractor = exports.DownloadInteractor = exports.ChatSessionInteractor = exports.ChatModelsInteractor = exports.ChatModelInteractor = exports.EngineError = exports.TotalStats = exports.Text = exports.StepStats = exports.Stats = exports.SamplingSeed = exports.SamplingPolicy = exports.SamplingMethod = exports.RunStats = exports.RunConfig = exports.Role = exports.Preset = exports.PrefillStepSize = exports.ParsedText = exports.Output = exports.ModelType = exports.Message = exports.Input = exports.FinishReason = exports.default = exports.DownloadState = exports.DownloadPhase = exports.DownloadProgressUpdate = exports.DownloadHandle = exports.ContextMode = exports.ContextLength = exports.Config = exports.ClassificationFeature = exports.ChatSession = exports.ChatModel = void 0;
|
|
7
7
|
var chatModel_1 = require("./bridging/chatModel.js");
|
|
8
8
|
Object.defineProperty(exports, "ChatModel", { enumerable: true, get: function () { return chatModel_1.ChatModel; } });
|
|
9
9
|
var chatSession_1 = require("./bridging/chatSession.js");
|
|
@@ -14,6 +14,8 @@ var config_1 = require("./bridging/config.js");
|
|
|
14
14
|
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_1.Config; } });
|
|
15
15
|
var contextLength_1 = require("./bridging/contextLength.js");
|
|
16
16
|
Object.defineProperty(exports, "ContextLength", { enumerable: true, get: function () { return contextLength_1.ContextLength; } });
|
|
17
|
+
var contextMode_1 = require("./bridging/contextMode.js");
|
|
18
|
+
Object.defineProperty(exports, "ContextMode", { enumerable: true, get: function () { return contextMode_1.ContextMode; } });
|
|
17
19
|
var downloadHandle_1 = require("./bridging/downloadHandle.js");
|
|
18
20
|
Object.defineProperty(exports, "DownloadHandle", { enumerable: true, get: function () { return downloadHandle_1.DownloadHandle; } });
|
|
19
21
|
var downloadProgressUpdate_1 = require("./bridging/downloadProgressUpdate.js");
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAClB,yDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,6EAAyE;AAAhE,8HAAA,qBAAqB,OAAA;AAC9B,+CAA2C;AAAlC,gGAAA,MAAM,OAAA;AACf,6DAAyD;AAAhD,8GAAA,aAAa,OAAA;AACtB,+DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,+EAA2E;AAAlE,gIAAA,sBAAsB,OAAA;AAC/B,6DAAwE;AAA/D,8GAAA,aAAa,OAAA;AAAE,8GAAA,aAAa,OAAA;AACrC,+CAAsD;AAA7C,iGAAA,MAAM,OAAW;AAC1B,2DAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,6CAAyC;AAAhC,8FAAA,KAAK,OAAA;AACd,iDAA6C;AAApC,kGAAA,OAAO,OAAA;AAChB,qDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAClB,+CAA2C;AAAlC,gGAAA,MAAM,OAAA;AACf,uDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,iEAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,+CAA2C;AAAlC,gGAAA,MAAM,OAAA;AACf,2CAAuC;AAA9B,4FAAA,IAAI,OAAA;AACb,qDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAClB,mDAA+C;AAAtC,oGAAA,QAAQ,OAAA;AACjB,+DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,+DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,2DAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,6CAAyC;AAAhC,8FAAA,KAAK,OAAA;A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AA9B,4FAAA,IAAI,OAAA;AACb,qDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAClB,mDAA+C;AAAtC,oGAAA,QAAQ,OAAA;AACjB,+DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,+DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,2DAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,6CAAyC;AAAhC,8FAAA,KAAK,OAAA;AACd,qDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAClB,2CAAuC;AAA9B,4FAAA,IAAI,OAAA;AACb,uDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,oCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,4EAAwE;AAA/D,0HAAA,mBAAmB,OAAA;AAC5B,8EAA0E;AAAjE,4HAAA,oBAAoB,OAAA;AAC7B,gFAA4E;AAAnE,8HAAA,qBAAqB,OAAA;AAC9B,0EAAsE;AAA7D,wHAAA,kBAAkB,OAAA;AAC3B,sEAAkE;AAAzD,oHAAA,gBAAgB,OAAA"}
|
package/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ export { ChatSession } from "./bridging/chatSession.mjs";
|
|
|
3
3
|
export { ClassificationFeature } from "./bridging/classificationFeature.mjs";
|
|
4
4
|
export { Config } from "./bridging/config.mjs";
|
|
5
5
|
export { ContextLength } from "./bridging/contextLength.mjs";
|
|
6
|
+
export { ContextMode } from "./bridging/contextMode.mjs";
|
|
6
7
|
export { DownloadHandle } from "./bridging/downloadHandle.mjs";
|
|
7
8
|
export { DownloadProgressUpdate } from "./bridging/downloadProgressUpdate.mjs";
|
|
8
9
|
export { DownloadPhase, DownloadState } from "./bridging/downloadState.mjs";
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE;OACb,EAAE,WAAW,EAAE;OACf,EAAE,qBAAqB,EAA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AAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OACV,EAAE,IAAI,EAAE;OACR,EAAE,SAAS,EAAE;OACb,EAAE,QAAQ,EAAE;OACZ,EAAE,cAAc,EAAE;OAClB,EAAE,cAAc,EAAE;OAClB,EAAE,YAAY,EAAE;OAChB,EAAE,KAAK,EAAE;OACT,EAAE,SAAS,EAAE;OACb,EAAE,IAAI,EAAE;OACR,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE;OACf,EAAE,mBAAmB,EAAE;OACvB,EAAE,oBAAoB,EAAE;OACxB,EAAE,qBAAqB,EAAE;OACzB,EAAE,kBAAkB,EAAE;OACtB,EAAE,gBAAgB,EAAE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChatModel } from "../bridging/chatModel.mjs";
|
|
2
2
|
import { Config } from "../bridging/config.mjs";
|
|
3
3
|
import { ContextLength } from "../bridging/contextLength.mjs";
|
|
4
|
+
import { ContextMode } from "../bridging/contextMode.mjs";
|
|
4
5
|
import { DownloadProgressUpdate } from "../bridging/downloadProgressUpdate.mjs";
|
|
5
6
|
import { Message } from "../bridging/message.mjs";
|
|
6
7
|
import { Output } from "../bridging/output.mjs";
|
|
@@ -20,8 +21,9 @@ export declare class ChatModelInteractor implements Interactor<ChatModel> {
|
|
|
20
21
|
downloading(): DownloadInteractor;
|
|
21
22
|
download(callback?: (progressUpdate: DownloadProgressUpdate) => void): ChatModelInteractor;
|
|
22
23
|
preset(preset: Preset): ChatModelInteractor;
|
|
23
|
-
|
|
24
|
+
contextMode(contextMode: ContextMode): ChatModelInteractor;
|
|
24
25
|
contextLength(contextLength: ContextLength): ChatModelInteractor;
|
|
26
|
+
prefillStepSize(prefillStepSize: PrefillStepSize): ChatModelInteractor;
|
|
25
27
|
samplingSeed(samplingSeed: SamplingSeed): ChatModelInteractor;
|
|
26
28
|
session(): ChatSessionInteractor;
|
|
27
29
|
reply(text: string, progress?: (partialOutput: Output) => boolean): Promise<Output>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelInteractor.d.mts","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE;OACV,EAAE,aAAa,EAAE;OACjB,EAAE,sBAAsB,EAAE;OAE1B,EAAE,OAAO,EAAE;OAEX,EAAE,MAAM,EAAE;OACV,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OAEV,EAAE,YAAY,EAAE;OAChB,EAAE,oBAAoB,EAAE;OACxB,EAAE,qBAAqB,EAAE;OACzB,EAAE,kBAAkB,EAAE;OACtB,EAAE,UAAU,EAAE,gBAAgB,EAAE;AAEvC,qBAAa,mBAAoB,YAAW,UAAU,CAAC,SAAS,CAAC;IAC7D,QAAQ,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,gBAAgB,EAAE,oBAAoB,EAAE,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM;IAMhG,QAAQ,IAAI,OAAO,CAAC,SAAS,CAAC;IAMpC,WAAW,IAAI,kBAAkB;IAUjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,sBAAsB,KAAK,IAAI,GAAG,mBAAmB;IAsB1F,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;IAK3C,
|
|
1
|
+
{"version":3,"file":"chatModelInteractor.d.mts","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE;OACV,EAAE,aAAa,EAAE;OACjB,EAAE,WAAW,EAAE;OACf,EAAE,sBAAsB,EAAE;OAE1B,EAAE,OAAO,EAAE;OAEX,EAAE,M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
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChatModel } from "../bridging/chatModel.js";
|
|
2
2
|
import { Config } from "../bridging/config.js";
|
|
3
3
|
import { ContextLength } from "../bridging/contextLength.js";
|
|
4
|
+
import { ContextMode } from "../bridging/contextMode.js";
|
|
4
5
|
import { DownloadProgressUpdate } from "../bridging/downloadProgressUpdate.js";
|
|
5
6
|
import { Message } from "../bridging/message.js";
|
|
6
7
|
import { Output } from "../bridging/output.js";
|
|
@@ -20,8 +21,9 @@ export declare class ChatModelInteractor implements Interactor<ChatModel> {
|
|
|
20
21
|
downloading(): DownloadInteractor;
|
|
21
22
|
download(callback?: (progressUpdate: DownloadProgressUpdate) => void): ChatModelInteractor;
|
|
22
23
|
preset(preset: Preset): ChatModelInteractor;
|
|
23
|
-
|
|
24
|
+
contextMode(contextMode: ContextMode): ChatModelInteractor;
|
|
24
25
|
contextLength(contextLength: ContextLength): ChatModelInteractor;
|
|
26
|
+
prefillStepSize(prefillStepSize: PrefillStepSize): ChatModelInteractor;
|
|
25
27
|
samplingSeed(samplingSeed: SamplingSeed): ChatModelInteractor;
|
|
26
28
|
session(): ChatSessionInteractor;
|
|
27
29
|
reply(text: string, progress?: (partialOutput: Output) => boolean): Promise<Output>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelInteractor.d.ts","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE;OACV,EAAE,aAAa,EAAE;OACjB,EAAE,sBAAsB,EAAE;OAE1B,EAAE,OAAO,EAAE;OAEX,EAAE,MAAM,EAAE;OACV,EAAE,eAAe,EAAE;OACnB,EAAE,MAAM,EAAE;OAEV,EAAE,YAAY,EAAE;OAChB,EAAE,oBAAoB,EAAE;OACxB,EAAE,qBAAqB,EAAE;OACzB,EAAE,kBAAkB,EAAE;OACtB,EAAE,UAAU,EAAE,gBAAgB,EAAE;AAEvC,q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,EAAE,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM;IAMhG,QAAQ,IAAI,OAAO,CAAC,SAAS,CAAC;IAMpC,WAAW,IAAI,kBAAkB;IAUjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,sBAAsB,KAAK,IAAI,GAAG,mBAAmB;IAsB1F,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;IAK3C,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB;IAK1D,aAAa,CAAC,aAAa,EAAE,aAAa,GAAG,mBAAmB;IAKhE,eAAe,CAAC,eAAe,EAAE,eAAe,GAAG,mBAAmB;IAKtE,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,mBAAmB;IAO7D,OAAO,IAAI,qBAAqB;IAe1B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAoB,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/F,eAAe,CACjB,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,GAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAoB,GAC1D,OAAO,CAAC,MAAM,CAAC;CAGrB"}
|
|
@@ -49,14 +49,18 @@ class ChatModelInteractor {
|
|
|
49
49
|
const config = this.config.withPreset(preset);
|
|
50
50
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
const config = this.config.
|
|
52
|
+
contextMode(contextMode) {
|
|
53
|
+
const config = this.config.withContextMode(contextMode);
|
|
54
54
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
55
55
|
}
|
|
56
56
|
contextLength(contextLength) {
|
|
57
57
|
const config = this.config.withContextLength(contextLength);
|
|
58
58
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
59
59
|
}
|
|
60
|
+
prefillStepSize(prefillStepSize) {
|
|
61
|
+
const config = this.config.withPrefillStepSize(prefillStepSize);
|
|
62
|
+
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
63
|
+
}
|
|
60
64
|
samplingSeed(samplingSeed) {
|
|
61
65
|
const config = this.config.withSamplingSeed(samplingSeed);
|
|
62
66
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelInteractor.js","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"chatModelInteractor.js","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":";;;AAKA,gEAA0D;AAE1D,wDAAkD;AAIlD,wDAAkD;AAGlD,sEAAgE;AAChE,gEAA0D;AAG1D,MAAa,mBAAmB;IAK5B,YAAY,gBAAsC,EAAE,KAAkC,EAAE,MAAc;QAClG,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,iBAAiB;IAEjB,WAAW;QACP,MAAM,aAAa,GAAG,CAAC,KAAK,IAAI,EAAE;YAC9B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YACvE,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACnD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,IAAI,uCAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACvD,CAAC;IAED,Q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Y,EAAE,WAA+C,GAAG,EAAE,CAAC,IAAI;QAC/E,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,eAAe,CACjB,QAAmB,EACnB,WAA+C,GAAG,EAAE,CAAC,IAAI;QAEzD,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC;CACJ;AArGD,kDAqGC"}
|
|
@@ -46,14 +46,18 @@ export class ChatModelInteractor {
|
|
|
46
46
|
const config = this.config.withPreset(preset);
|
|
47
47
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
const config = this.config.
|
|
49
|
+
contextMode(contextMode) {
|
|
50
|
+
const config = this.config.withContextMode(contextMode);
|
|
51
51
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
52
52
|
}
|
|
53
53
|
contextLength(contextLength) {
|
|
54
54
|
const config = this.config.withContextLength(contextLength);
|
|
55
55
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
56
56
|
}
|
|
57
|
+
prefillStepSize(prefillStepSize) {
|
|
58
|
+
const config = this.config.withPrefillStepSize(prefillStepSize);
|
|
59
|
+
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
60
|
+
}
|
|
57
61
|
samplingSeed(samplingSeed) {
|
|
58
62
|
const config = this.config.withSamplingSeed(samplingSeed);
|
|
59
63
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelInteractor.mjs","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatModelInteractor.mjs","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":"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 @@ export interface ClassificationFeature {
|
|
|
54
54
|
|
|
55
55
|
export interface Config {
|
|
56
56
|
preset: Preset
|
|
57
|
-
|
|
57
|
+
contextMode: ContextMode
|
|
58
58
|
contextLength: ContextLength
|
|
59
|
+
prefillStepSize: PrefillStepSize
|
|
59
60
|
samplingSeed: SamplingSeed
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -64,6 +65,11 @@ export type ContextLength =
|
|
|
64
65
|
| { type: 'Maximal' }
|
|
65
66
|
| { type: 'Custom', length: number }
|
|
66
67
|
|
|
68
|
+
export type ContextMode =
|
|
69
|
+
| { type: 'None' }
|
|
70
|
+
| { type: 'Static', input: Input }
|
|
71
|
+
| { type: 'Dynamic' }
|
|
72
|
+
|
|
67
73
|
export declare const enum FinishReason {
|
|
68
74
|
Stop = 0,
|
|
69
75
|
Length = 1,
|
package/napi/uzu.js
CHANGED
|
@@ -45,6 +45,7 @@ const {
|
|
|
45
45
|
Text,
|
|
46
46
|
TotalStats,
|
|
47
47
|
ContextLength,
|
|
48
|
+
ContextMode,
|
|
48
49
|
Input,
|
|
49
50
|
LicenseStatus,
|
|
50
51
|
ModelStorageError,
|
|
@@ -81,6 +82,7 @@ module.exports = {
|
|
|
81
82
|
Text,
|
|
82
83
|
TotalStats,
|
|
83
84
|
ContextLength,
|
|
85
|
+
ContextMode,
|
|
84
86
|
Input,
|
|
85
87
|
LicenseStatus,
|
|
86
88
|
ModelStorageError,
|
package/napi/uzu.mjs
CHANGED
package/napi/uzu.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/bridging/config.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Config as NapiConfig } from '../napi/uzu';
|
|
2
2
|
import { ContextLength } from './contextLength';
|
|
3
|
+
import { ContextMode } from './contextMode';
|
|
3
4
|
import { ToNapi } from './napi';
|
|
4
5
|
import { PrefillStepSize } from './prefillStepSize';
|
|
5
6
|
import { Preset } from './preset';
|
|
@@ -7,52 +8,91 @@ import { SamplingSeed } from './samplingSeed';
|
|
|
7
8
|
|
|
8
9
|
export class Config implements ToNapi<NapiConfig> {
|
|
9
10
|
readonly preset: Preset;
|
|
10
|
-
readonly
|
|
11
|
+
readonly contextMode: ContextMode;
|
|
11
12
|
readonly contextLength: ContextLength;
|
|
13
|
+
readonly prefillStepSize: PrefillStepSize;
|
|
12
14
|
readonly samplingSeed: SamplingSeed;
|
|
13
15
|
|
|
14
16
|
constructor(
|
|
15
17
|
preset: Preset,
|
|
16
|
-
|
|
18
|
+
contextMode: ContextMode,
|
|
17
19
|
contextLength: ContextLength,
|
|
20
|
+
prefillStepSize: PrefillStepSize,
|
|
18
21
|
samplingSeed: SamplingSeed,
|
|
19
22
|
) {
|
|
20
23
|
this.preset = preset;
|
|
21
|
-
this.
|
|
24
|
+
this.contextMode = contextMode;
|
|
22
25
|
this.contextLength = contextLength;
|
|
26
|
+
this.prefillStepSize = prefillStepSize;
|
|
23
27
|
this.samplingSeed = samplingSeed;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
static default(): Config {
|
|
27
31
|
return new Config(
|
|
28
32
|
Preset.general(),
|
|
29
|
-
|
|
33
|
+
ContextMode.none(),
|
|
30
34
|
ContextLength.default(),
|
|
35
|
+
PrefillStepSize.default(),
|
|
31
36
|
SamplingSeed.default(),
|
|
32
37
|
);
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
withPreset(preset: Preset): Config {
|
|
36
|
-
return new Config(
|
|
41
|
+
return new Config(
|
|
42
|
+
preset,
|
|
43
|
+
this.contextMode,
|
|
44
|
+
this.contextLength,
|
|
45
|
+
this.prefillStepSize,
|
|
46
|
+
this.samplingSeed,
|
|
47
|
+
);
|
|
37
48
|
}
|
|
38
49
|
|
|
39
|
-
|
|
40
|
-
return new Config(
|
|
50
|
+
withContextMode(contextMode: ContextMode): Config {
|
|
51
|
+
return new Config(
|
|
52
|
+
this.preset,
|
|
53
|
+
contextMode,
|
|
54
|
+
this.contextLength,
|
|
55
|
+
this.prefillStepSize,
|
|
56
|
+
this.samplingSeed,
|
|
57
|
+
);
|
|
41
58
|
}
|
|
42
59
|
|
|
43
60
|
withContextLength(contextLength: ContextLength): Config {
|
|
44
|
-
return new Config(
|
|
61
|
+
return new Config(
|
|
62
|
+
this.preset,
|
|
63
|
+
this.contextMode,
|
|
64
|
+
contextLength,
|
|
65
|
+
this.prefillStepSize,
|
|
66
|
+
this.samplingSeed,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
withPrefillStepSize(prefillStepSize: PrefillStepSize): Config {
|
|
71
|
+
return new Config(
|
|
72
|
+
this.preset,
|
|
73
|
+
this.contextMode,
|
|
74
|
+
this.contextLength,
|
|
75
|
+
prefillStepSize,
|
|
76
|
+
this.samplingSeed,
|
|
77
|
+
);
|
|
45
78
|
}
|
|
46
79
|
|
|
47
80
|
withSamplingSeed(samplingSeed: SamplingSeed): Config {
|
|
48
|
-
return new Config(
|
|
81
|
+
return new Config(
|
|
82
|
+
this.preset,
|
|
83
|
+
this.contextMode,
|
|
84
|
+
this.contextLength,
|
|
85
|
+
this.prefillStepSize,
|
|
86
|
+
samplingSeed,
|
|
87
|
+
);
|
|
49
88
|
}
|
|
50
89
|
|
|
51
90
|
toNapi(): NapiConfig {
|
|
52
91
|
const napiConfig: NapiConfig = {
|
|
53
92
|
preset: this.preset.toNapi(),
|
|
54
|
-
|
|
93
|
+
contextMode: this.contextMode.toNapi(),
|
|
55
94
|
contextLength: this.contextLength.toNapi(),
|
|
95
|
+
prefillStepSize: this.prefillStepSize.toNapi(),
|
|
56
96
|
samplingSeed: this.samplingSeed.toNapi(),
|
|
57
97
|
};
|
|
58
98
|
return napiConfig;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ContextMode as NapiContextMode, Input as NapiInput } from '../napi/uzu';
|
|
2
|
+
import { Input } from './input';
|
|
3
|
+
import { ToNapi } from './napi';
|
|
4
|
+
|
|
5
|
+
export class ContextMode implements ToNapi<NapiContextMode> {
|
|
6
|
+
private readonly napiContextMode: NapiContextMode;
|
|
7
|
+
|
|
8
|
+
private constructor(napiContextMode: NapiContextMode) {
|
|
9
|
+
this.napiContextMode = napiContextMode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static none(): ContextMode {
|
|
13
|
+
const napiContextMode: NapiContextMode = { type: 'None' };
|
|
14
|
+
return new ContextMode(napiContextMode);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static static(input: Input): ContextMode {
|
|
18
|
+
let napiInput: NapiInput = input.toNapi();
|
|
19
|
+
let napiContextMode: NapiContextMode = { type: 'Static', input: napiInput };
|
|
20
|
+
return new ContextMode(napiContextMode);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static dynamic(): ContextMode {
|
|
24
|
+
const napiContextMode: NapiContextMode = { type: 'Dynamic' };
|
|
25
|
+
return new ContextMode(napiContextMode);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
toNapi(): NapiContextMode {
|
|
29
|
+
return this.napiContextMode;
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { ChatSession } from './bridging/chatSession';
|
|
|
3
3
|
export { ClassificationFeature } from './bridging/classificationFeature';
|
|
4
4
|
export { Config } from './bridging/config';
|
|
5
5
|
export { ContextLength } from './bridging/contextLength';
|
|
6
|
+
export { ContextMode } from './bridging/contextMode';
|
|
6
7
|
export { DownloadHandle } from './bridging/downloadHandle';
|
|
7
8
|
export { DownloadProgressUpdate } from './bridging/downloadProgressUpdate';
|
|
8
9
|
export { DownloadPhase, DownloadState } from './bridging/downloadState';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChatModel } from '../bridging/chatModel';
|
|
2
2
|
import { Config } from '../bridging/config';
|
|
3
3
|
import { ContextLength } from '../bridging/contextLength';
|
|
4
|
+
import { ContextMode } from '../bridging/contextMode';
|
|
4
5
|
import { DownloadProgressUpdate } from '../bridging/downloadProgressUpdate';
|
|
5
6
|
import { DownloadPhase } from '../bridging/downloadState';
|
|
6
7
|
import { Message } from '../bridging/message';
|
|
@@ -69,8 +70,8 @@ export class ChatModelInteractor implements Interactor<ChatModel> {
|
|
|
69
70
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
const config = this.config.
|
|
73
|
+
contextMode(contextMode: ContextMode): ChatModelInteractor {
|
|
74
|
+
const config = this.config.withContextMode(contextMode);
|
|
74
75
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -79,6 +80,11 @@ export class ChatModelInteractor implements Interactor<ChatModel> {
|
|
|
79
80
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
prefillStepSize(prefillStepSize: PrefillStepSize): ChatModelInteractor {
|
|
84
|
+
const config = this.config.withPrefillStepSize(prefillStepSize);
|
|
85
|
+
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
86
|
+
}
|
|
87
|
+
|
|
82
88
|
samplingSeed(samplingSeed: SamplingSeed): ChatModelInteractor {
|
|
83
89
|
const config = this.config.withSamplingSeed(samplingSeed);
|
|
84
90
|
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
package/src/napi/uzu.d.ts
CHANGED
|
@@ -54,8 +54,9 @@ export interface ClassificationFeature {
|
|
|
54
54
|
|
|
55
55
|
export interface Config {
|
|
56
56
|
preset: Preset
|
|
57
|
-
|
|
57
|
+
contextMode: ContextMode
|
|
58
58
|
contextLength: ContextLength
|
|
59
|
+
prefillStepSize: PrefillStepSize
|
|
59
60
|
samplingSeed: SamplingSeed
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -64,6 +65,11 @@ export type ContextLength =
|
|
|
64
65
|
| { type: 'Maximal' }
|
|
65
66
|
| { type: 'Custom', length: number }
|
|
66
67
|
|
|
68
|
+
export type ContextMode =
|
|
69
|
+
| { type: 'None' }
|
|
70
|
+
| { type: 'Static', input: Input }
|
|
71
|
+
| { type: 'Dynamic' }
|
|
72
|
+
|
|
67
73
|
export declare const enum FinishReason {
|
|
68
74
|
Stop = 0,
|
|
69
75
|
Length = 1,
|
package/src/napi/uzu.js
CHANGED
|
@@ -45,6 +45,7 @@ const {
|
|
|
45
45
|
Text,
|
|
46
46
|
TotalStats,
|
|
47
47
|
ContextLength,
|
|
48
|
+
ContextMode,
|
|
48
49
|
Input,
|
|
49
50
|
LicenseStatus,
|
|
50
51
|
ModelStorageError,
|
|
@@ -81,6 +82,7 @@ module.exports = {
|
|
|
81
82
|
Text,
|
|
82
83
|
TotalStats,
|
|
83
84
|
ContextLength,
|
|
85
|
+
ContextMode,
|
|
84
86
|
Input,
|
|
85
87
|
LicenseStatus,
|
|
86
88
|
ModelStorageError,
|
package/src/napi/uzu.mjs
CHANGED
package/src/napi/uzu.node
CHANGED
|
Binary file
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.45';
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.45";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.45";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.45';
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|