@gmickel/gno 1.34.1 → 1.34.3
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 +1 -1
- package/browser-extension/artifacts/{gno-browser-clipper-v1.34.1.zip → gno-browser-clipper-v1.34.3.zip} +0 -0
- package/browser-extension/artifacts/gno-browser-clipper-v1.34.3.zip.sha256 +1 -0
- package/browser-extension/dist/manifest.json +1 -1
- package/package.json +1 -1
- package/src/llm/nodeLlamaCpp/generation.ts +31 -3
- package/browser-extension/artifacts/gno-browser-clipper-v1.34.1.zip.sha256 +0 -1
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ gno daemon --detach # headless indexing + resident MCP gateway
|
|
|
117
117
|
|
|
118
118
|
<!-- public-truth:current-version -->
|
|
119
119
|
|
|
120
|
-
> Current release: **v1.34.
|
|
120
|
+
> Current release: **v1.34.3** — see [CHANGELOG.md](./CHANGELOG.md)
|
|
121
121
|
|
|
122
122
|
<!-- /public-truth -->
|
|
123
123
|
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9d23588e6deda45725d324ca310d4b8afb2a79a8ecdb0353972c376853b35244 gno-browser-clipper-v1.34.3.zip
|
package/package.json
CHANGED
|
@@ -60,6 +60,29 @@ const DEFAULT_TEMPERATURE = 0;
|
|
|
60
60
|
const DEFAULT_SEED = 42;
|
|
61
61
|
const DEFAULT_MAX_TOKENS = 256;
|
|
62
62
|
|
|
63
|
+
// Context sizing: without an explicit contextSize, node-llama-cpp defaults to
|
|
64
|
+
// "auto", which grows the KV cache to fill available VRAM up to the model's
|
|
65
|
+
// trained context length (OOM risk on small GPUs — see issue #189). Instead,
|
|
66
|
+
// size the context to what the call actually needs: prompt tokens + output
|
|
67
|
+
// budget + margin for chat-template wrapping and special tokens.
|
|
68
|
+
const GEN_CONTEXT_MARGIN_TOKENS = 512;
|
|
69
|
+
const GEN_CONTEXT_MIN_TOKENS = 1024;
|
|
70
|
+
|
|
71
|
+
export const resolveGenContextSize = (input: {
|
|
72
|
+
promptTokenCount: number;
|
|
73
|
+
maxTokens: number;
|
|
74
|
+
trainContextSize?: number;
|
|
75
|
+
}): number => {
|
|
76
|
+
const needed = Math.max(
|
|
77
|
+
GEN_CONTEXT_MIN_TOKENS,
|
|
78
|
+
input.promptTokenCount + input.maxTokens + GEN_CONTEXT_MARGIN_TOKENS
|
|
79
|
+
);
|
|
80
|
+
if (input.trainContextSize && input.trainContextSize > 0) {
|
|
81
|
+
return Math.min(needed, input.trainContextSize);
|
|
82
|
+
}
|
|
83
|
+
return needed;
|
|
84
|
+
};
|
|
85
|
+
|
|
63
86
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
64
87
|
// Implementation
|
|
65
88
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -97,9 +120,14 @@ export class NodeLlamaCppGeneration implements GenerationPort {
|
|
|
97
120
|
await this.manager.getLlama()
|
|
98
121
|
).createGrammarForJsonSchema(params.jsonSchema as JsonGrammarSchema)
|
|
99
122
|
: undefined;
|
|
100
|
-
|
|
101
|
-
params?.contextSize
|
|
102
|
-
|
|
123
|
+
const contextSize =
|
|
124
|
+
params?.contextSize ??
|
|
125
|
+
resolveGenContextSize({
|
|
126
|
+
promptTokenCount: llamaModel.tokenize(prompt).length,
|
|
127
|
+
maxTokens: params?.maxTokens ?? DEFAULT_MAX_TOKENS,
|
|
128
|
+
trainContextSize: llamaModel.trainContextSize,
|
|
129
|
+
});
|
|
130
|
+
context = await llamaModel.createContext({ contextSize });
|
|
103
131
|
// Import LlamaChatSession dynamically
|
|
104
132
|
const { LlamaChatSession } = await import("node-llama-cpp");
|
|
105
133
|
const session = new LlamaChatSession({
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
72e70b96bc421db0d18489837817d4ed147bb57888f087bf13afb4cfb814cdb9 gno-browser-clipper-v1.34.1.zip
|