rice-node-sdk 1.0.4 → 1.0.6
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 +52 -17
- package/dist/index.d.ts +531 -0
- package/dist/state/tools.d.ts +532 -0
- package/dist/state/tools.js +2 -0
- package/dist/tools/anthropic.d.ts +179 -0
- package/dist/tools/anthropic.js +94 -0
- package/dist/tools/execute.js +14 -0
- package/dist/tools/google.d.ts +160 -0
- package/dist/tools/google.js +83 -0
- package/dist/tools/openai.d.ts +191 -0
- package/dist/tools/openai.js +115 -0
- package/dist/tools/vercel.d.ts +91 -0
- package/dist/tools/vercel.js +343 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -272,9 +272,38 @@ The SDK provides pre-built tool definitions tailored for popular LLM providers.
|
|
|
272
272
|
|
|
273
273
|
### Available Imports
|
|
274
274
|
|
|
275
|
-
- `rice-node-sdk/tools/anthropic`
|
|
276
|
-
- `rice-node-sdk/tools/google`
|
|
277
|
-
- `rice-node-sdk/tools/openai`
|
|
275
|
+
- `rice-node-sdk/tools/anthropic` - Anthropic Claude format
|
|
276
|
+
- `rice-node-sdk/tools/google` - Google Gemini format
|
|
277
|
+
- `rice-node-sdk/tools/openai` - OpenAI function calling format
|
|
278
|
+
- `rice-node-sdk/tools/vercel` - Vercel AI SDK format (with bound execute functions)
|
|
279
|
+
|
|
280
|
+
### Example Usage (Vercel AI SDK)
|
|
281
|
+
|
|
282
|
+
The Vercel AI SDK tools come with execute functions pre-bound to your StateClient, making integration seamless.
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
import { generateText, stepCountIs } from "ai";
|
|
286
|
+
import { google } from "@ai-sdk/google";
|
|
287
|
+
import { Client, statetool } from "rice-node-sdk";
|
|
288
|
+
|
|
289
|
+
const client = new Client({ runId: "my-agent-session" });
|
|
290
|
+
await client.connect();
|
|
291
|
+
|
|
292
|
+
// Create tools bound to your StateClient
|
|
293
|
+
const tools = statetool.createVercelTools(client.state);
|
|
294
|
+
|
|
295
|
+
// Use with generateText - tools are auto-executed!
|
|
296
|
+
const result = await generateText({
|
|
297
|
+
model: google("gemini-2.0-flash"),
|
|
298
|
+
tools,
|
|
299
|
+
stopWhen: stepCountIs(5),
|
|
300
|
+
system: `You are an assistant with persistent memory.
|
|
301
|
+
Use 'remember' to store facts and 'recall' to search memories.`,
|
|
302
|
+
prompt: "Remember that I prefer Python for ML projects.",
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
console.log(result.text);
|
|
306
|
+
```
|
|
278
307
|
|
|
279
308
|
### Example Usage (Anthropic)
|
|
280
309
|
|
|
@@ -359,20 +388,26 @@ if (call) {
|
|
|
359
388
|
|
|
360
389
|
### Tools Included
|
|
361
390
|
|
|
362
|
-
| Tool
|
|
363
|
-
|
|
|
364
|
-
| `focus`
|
|
365
|
-
| `
|
|
366
|
-
| `
|
|
367
|
-
| `
|
|
368
|
-
| `
|
|
369
|
-
| `
|
|
370
|
-
| `
|
|
371
|
-
| `
|
|
372
|
-
| `
|
|
373
|
-
| `
|
|
374
|
-
| `
|
|
375
|
-
| `
|
|
391
|
+
| Tool | Purpose | SDK Method |
|
|
392
|
+
| ----------------- | ------------------------------------------------ | -------------------------------- |
|
|
393
|
+
| `focus` | Store information in short-term working memory | `client.state.focus()` |
|
|
394
|
+
| `drift` | Read current items from short-term memory | `client.state.drift()` |
|
|
395
|
+
| `remember` | Store information in long-term persistent memory | `client.state.commit()` |
|
|
396
|
+
| `recall` | Retrieve relevant memories from long-term memory | `client.state.reminisce()` |
|
|
397
|
+
| `trigger` | Trigger a registered skill or procedure | `client.state.trigger()` |
|
|
398
|
+
| `setVariable` | Set a structured variable in working memory | `client.state.setVariable()` |
|
|
399
|
+
| `getVariable` | Get a structured variable from working memory | `client.state.getVariable()` |
|
|
400
|
+
| `listVariables` | List all variables in working memory | `client.state.listVariables()` |
|
|
401
|
+
| `deleteVariable` | Delete a variable from working memory | `client.state.deleteVariable()` |
|
|
402
|
+
| `defineConcept` | Define a concept with JSON schema | `client.state.defineConcept()` |
|
|
403
|
+
| `listConcepts` | List all defined concepts | `client.state.listConcepts()` |
|
|
404
|
+
| `addGoal` | Add a new goal to the agent's goal stack | `client.state.addGoal()` |
|
|
405
|
+
| `updateGoal` | Update the status of an existing goal | `client.state.updateGoal()` |
|
|
406
|
+
| `listGoals` | List all goals, optionally filtered by status | `client.state.listGoals()` |
|
|
407
|
+
| `submitAction` | Submit an action for execution and logging | `client.state.submitAction()` |
|
|
408
|
+
| `getActionLog` | Get the action log for the current run | `client.state.getActionLog()` |
|
|
409
|
+
| `runCycle` | Run a decision cycle with action candidates | `client.state.runCycle()` |
|
|
410
|
+
| `getCycleHistory` | Get history of decision cycles | `client.state.getCycleHistory()` |
|
|
376
411
|
|
|
377
412
|
## API Reference
|
|
378
413
|
|