risicare 0.5.2 → 0.6.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/README.md +11 -6
- package/dist/frameworks/instructor.cjs.map +1 -1
- package/dist/frameworks/instructor.js.map +1 -1
- package/dist/frameworks/langchain.cjs.map +1 -1
- package/dist/frameworks/langchain.js.map +1 -1
- package/dist/frameworks/langgraph.cjs.map +1 -1
- package/dist/frameworks/langgraph.js.map +1 -1
- package/dist/frameworks/llamaindex.cjs.map +1 -1
- package/dist/frameworks/llamaindex.js.map +1 -1
- package/dist/index.cjs +19 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/dist/providers/anthropic/index.cjs.map +1 -1
- package/dist/providers/anthropic/index.js.map +1 -1
- package/dist/providers/bedrock/index.cjs.map +1 -1
- package/dist/providers/bedrock/index.js.map +1 -1
- package/dist/providers/cerebras/index.cjs.map +1 -1
- package/dist/providers/cerebras/index.js.map +1 -1
- package/dist/providers/cohere/index.cjs.map +1 -1
- package/dist/providers/cohere/index.js.map +1 -1
- package/dist/providers/google/index.cjs.map +1 -1
- package/dist/providers/google/index.js.map +1 -1
- package/dist/providers/groq/index.cjs.map +1 -1
- package/dist/providers/groq/index.js.map +1 -1
- package/dist/providers/huggingface/index.cjs.map +1 -1
- package/dist/providers/huggingface/index.js.map +1 -1
- package/dist/providers/mistral/index.cjs.map +1 -1
- package/dist/providers/mistral/index.js.map +1 -1
- package/dist/providers/ollama/index.cjs.map +1 -1
- package/dist/providers/ollama/index.js.map +1 -1
- package/dist/providers/openai/index.cjs.map +1 -1
- package/dist/providers/openai/index.js.map +1 -1
- package/dist/providers/together/index.cjs.map +1 -1
- package/dist/providers/together/index.js.map +1 -1
- package/dist/providers/vercel-ai/index.cjs.map +1 -1
- package/dist/providers/vercel-ai/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,9 +142,10 @@ import {
|
|
|
142
142
|
init({ apiKey, endpoint }) // Initialize SDK
|
|
143
143
|
agent({ name }, fn) // Wrap function with agent identity
|
|
144
144
|
session({ sessionId, userId }, fn) // Group traces into user sessions
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
// These are WRAPPER FACTORIES: they return a function you then call.
|
|
146
|
+
await traceThink('analyze', async () => {...})() // note the trailing ()
|
|
147
|
+
await traceDecide('choose', async () => {...})()
|
|
148
|
+
await traceAct('execute', async () => {...})()
|
|
148
149
|
reportError(error) // Report caught errors for diagnosis
|
|
149
150
|
score(traceId, 'quality', 0.92) // Record evaluation score [0.0-1.0]
|
|
150
151
|
tracedStream(asyncIterable, 'stream') // Trace async iterators
|
|
@@ -179,18 +180,22 @@ try {
|
|
|
179
180
|
Structure your traces to see how your agent thinks, decides, and acts:
|
|
180
181
|
|
|
181
182
|
```typescript
|
|
183
|
+
// traceThink / traceDecide / traceAct RETURN A WRAPPED FUNCTION — they do not
|
|
184
|
+
// run your callback themselves. Call the result (the trailing `()` below).
|
|
185
|
+
// Omitting it is silent: you get a function back, your callback never runs,
|
|
186
|
+
// and no span is emitted.
|
|
182
187
|
const myAgent = agent({ name: 'planner', role: 'coordinator' }, async (input) => {
|
|
183
188
|
const analysis = await traceThink('analyze', async () => {
|
|
184
189
|
return await openai.chat.completions.create({ /* ... */ });
|
|
185
|
-
});
|
|
190
|
+
})();
|
|
186
191
|
|
|
187
192
|
const decision = await traceDecide('choose-action', async () => {
|
|
188
193
|
return pickBestAction(analysis);
|
|
189
|
-
});
|
|
194
|
+
})();
|
|
190
195
|
|
|
191
196
|
return await traceAct('execute', async () => {
|
|
192
197
|
return executeAction(decision);
|
|
193
|
-
});
|
|
198
|
+
})();
|
|
194
199
|
});
|
|
195
200
|
```
|
|
196
201
|
|