keyring-agent-core 0.3.14 → 0.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/index.d.ts +35 -14
- package/dist/index.js +53 -50
- package/dist/index.native.js +129 -126
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ class FaqTool extends BaseTool {
|
|
|
65
65
|
const agent = new AgentCore({
|
|
66
66
|
llm: {
|
|
67
67
|
apiKey: process.env.GEMINI_API_KEY!,
|
|
68
|
-
model: 'gemini-2.5-flash
|
|
68
|
+
model: 'gemini-2.5-flash',
|
|
69
69
|
},
|
|
70
70
|
maxIterations: 8,
|
|
71
71
|
maxHistoryMessages: 40,
|
|
@@ -150,7 +150,7 @@ agent.restoreHistory(saved);
|
|
|
150
150
|
secretKey?: string; // required unless llm.apiKey is set
|
|
151
151
|
llm: {
|
|
152
152
|
apiKey?: string; // your own Gemini key → calls Google directly
|
|
153
|
-
model?: string; // default: 'gemini-2.5-flash
|
|
153
|
+
model?: string; // default: 'gemini-2.5-flash'
|
|
154
154
|
maxTokens?: number; // default: 4096
|
|
155
155
|
temperature?: number; // default: 0.7
|
|
156
156
|
baseUrl?: string; // override the endpoint
|
|
@@ -164,10 +164,10 @@ agent.restoreHistory(saved);
|
|
|
164
164
|
|
|
165
165
|
### LLM access: two modes
|
|
166
166
|
|
|
167
|
-
| Mode
|
|
168
|
-
|
|
|
169
|
-
| **Bring your own key** | `llm.apiKey` set | `https://generativelanguage.googleapis.com` — called directly with your key. `secretKey` is not required.
|
|
170
|
-
| **Keyring proxy**
|
|
167
|
+
| Mode | Config | Endpoint |
|
|
168
|
+
| ---------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
169
|
+
| **Bring your own key** | `llm.apiKey` set | `https://generativelanguage.googleapis.com` — called directly with your key. `secretKey` is not required. |
|
|
170
|
+
| **Keyring proxy** | no `llm.apiKey` | `https://nft.keyring.app/api/gemini-stable` — we authenticate for you. Requires a valid `secretKey`; the first `chat()` throws otherwise. |
|
|
171
171
|
|
|
172
172
|
`llm.baseUrl` overrides the endpoint in either mode.
|
|
173
173
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1883,7 +1883,7 @@ interface VectorKBConfig {
|
|
|
1883
1883
|
provider?: KnowledgeBaseProvider;
|
|
1884
1884
|
}
|
|
1885
1885
|
interface LLMProviderConfig {
|
|
1886
|
-
/** Model name, e.g. "gemini-2.5-flash
|
|
1886
|
+
/** Model name, e.g. "gemini-2.5-flash" */
|
|
1887
1887
|
model?: string;
|
|
1888
1888
|
/** Max tokens for generation */
|
|
1889
1889
|
maxTokens?: number;
|
|
@@ -1903,6 +1903,17 @@ interface LLMProviderConfig {
|
|
|
1903
1903
|
* "https://generativelanguage.googleapis.com" when {@link apiKey} is set.
|
|
1904
1904
|
*/
|
|
1905
1905
|
baseUrl?: string;
|
|
1906
|
+
/**
|
|
1907
|
+
* Provider-wide default Gemini thinking budget, used by every call that does
|
|
1908
|
+
* not pass its own {@link ChatOptions.thinkingBudget}. Defaults to `0`
|
|
1909
|
+
* (thinking OFF): on `gemini-2.5-flash` thinking is otherwise dynamic and its
|
|
1910
|
+
* reasoning tokens are generated sequentially before any visible output — the
|
|
1911
|
+
* single biggest per-call latency cost. The agent's prompts are tuned for
|
|
1912
|
+
* no-thinking (the Flash-Lite default). `null` omits `thinkingConfig` entirely
|
|
1913
|
+
* (the model's native default); a positive number sets a fixed budget. Models
|
|
1914
|
+
* whose thinking cannot be disabled (e.g. 2.5 Pro, floor 128) need a value here.
|
|
1915
|
+
*/
|
|
1916
|
+
thinkingBudget?: number | null;
|
|
1906
1917
|
}
|
|
1907
1918
|
interface AgentConfig {
|
|
1908
1919
|
/**
|
|
@@ -2182,7 +2193,16 @@ interface LLMResponse {
|
|
|
2182
2193
|
promptTokens: number;
|
|
2183
2194
|
completionTokens: number;
|
|
2184
2195
|
totalTokens: number;
|
|
2196
|
+
/** Reasoning tokens spent before the visible output (Gemini 2.5 thinking). */
|
|
2197
|
+
thoughtsTokens?: number;
|
|
2198
|
+
/** Prompt tokens served from Gemini's (implicit) context cache. */
|
|
2199
|
+
cachedTokens?: number;
|
|
2185
2200
|
};
|
|
2201
|
+
/**
|
|
2202
|
+
* Why generation stopped (Gemini `finishReason`, e.g. "STOP", "MAX_TOKENS").
|
|
2203
|
+
* `MAX_TOKENS` means `text` was cut off mid-output by the token cap.
|
|
2204
|
+
*/
|
|
2205
|
+
finishReason?: string;
|
|
2186
2206
|
}
|
|
2187
2207
|
/** Optional flags for an LLM call */
|
|
2188
2208
|
interface ChatOptions {
|
|
@@ -2203,17 +2223,16 @@ interface ChatOptions {
|
|
|
2203
2223
|
maxOutputTokens?: number;
|
|
2204
2224
|
/**
|
|
2205
2225
|
* Gemini 2.5 thinking budget, in tokens. These models spend reasoning
|
|
2206
|
-
* ("thinking") tokens that count AGAINST `maxOutputTokens`
|
|
2207
|
-
* output — so
|
|
2208
|
-
*
|
|
2209
|
-
*
|
|
2210
|
-
*
|
|
2211
|
-
*
|
|
2212
|
-
*
|
|
2213
|
-
*
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
thinkingBudget?: number;
|
|
2226
|
+
* ("thinking") tokens that count AGAINST `maxOutputTokens` and are generated
|
|
2227
|
+
* before any visible output — so thinking is pure added latency on calls that
|
|
2228
|
+
* don't need it, and a tight cap can be consumed entirely by reasoning
|
|
2229
|
+
* (`MAX_TOKENS` with no output). Thinking is therefore OFF by default for every
|
|
2230
|
+
* call (see {@link LLMProviderConfig.thinkingBudget}). Override per call: `0`
|
|
2231
|
+
* forces it off, `-1` dynamic, a positive number a fixed budget, and `null`
|
|
2232
|
+
* omits `thinkingConfig` so the model's native default applies. Leave unset to
|
|
2233
|
+
* use the provider default.
|
|
2234
|
+
*/
|
|
2235
|
+
thinkingBudget?: number | null;
|
|
2217
2236
|
/**
|
|
2218
2237
|
* Force the model to call one of the supplied `tools` instead of answering in
|
|
2219
2238
|
* text (Gemini `functionCallingConfig.mode = "ANY"`). Used by action subagents
|
|
@@ -3033,8 +3052,8 @@ declare class WebsiteTrustKeyringAgent {
|
|
|
3033
3052
|
* without ever truncating a valid reply. Omit to fall back to the provider
|
|
3034
3053
|
* default (4096).
|
|
3035
3054
|
* - `thinkingBudget` controls the Gemini 2.5 reasoning budget (tokens count
|
|
3036
|
-
* AGAINST `maxOutputTokens`). The provider defaults it to 0
|
|
3037
|
-
*
|
|
3055
|
+
* AGAINST `maxOutputTokens`). The provider defaults it to 0 (off), so a
|
|
3056
|
+
* formatting/extraction call spends its
|
|
3038
3057
|
* whole budget on real output. The one call that needs real reasoning —
|
|
3039
3058
|
* {@link investigate}, which must correctly judge official vs. look-alike —
|
|
3040
3059
|
* passes an explicit positive budget AND a cap wide enough to hold thinking +
|
|
@@ -3251,6 +3270,8 @@ declare class GeminiProvider implements LLMProvider {
|
|
|
3251
3270
|
private model;
|
|
3252
3271
|
private maxTokens;
|
|
3253
3272
|
private temperature;
|
|
3273
|
+
/** Default thinking budget for calls that don't set one. `null` = model default. */
|
|
3274
|
+
private thinkingBudget;
|
|
3254
3275
|
private baseUrl;
|
|
3255
3276
|
/** Caller's own Gemini key. Empty when running through the proxy. */
|
|
3256
3277
|
private apiKey;
|