risicare 0.5.0 → 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 +44 -6
- package/dist/frameworks/instructor.cjs +9 -0
- package/dist/frameworks/instructor.cjs.map +1 -1
- package/dist/frameworks/instructor.js +9 -0
- package/dist/frameworks/instructor.js.map +1 -1
- package/dist/frameworks/langchain.cjs +9 -0
- package/dist/frameworks/langchain.cjs.map +1 -1
- package/dist/frameworks/langchain.js +9 -0
- package/dist/frameworks/langchain.js.map +1 -1
- package/dist/frameworks/langgraph.cjs +9 -0
- package/dist/frameworks/langgraph.cjs.map +1 -1
- package/dist/frameworks/langgraph.js +9 -0
- package/dist/frameworks/langgraph.js.map +1 -1
- package/dist/frameworks/llamaindex.cjs +9 -0
- package/dist/frameworks/llamaindex.cjs.map +1 -1
- package/dist/frameworks/llamaindex.js +9 -0
- package/dist/frameworks/llamaindex.js.map +1 -1
- package/dist/index.cjs +685 -313
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +685 -313
- package/dist/index.js.map +1 -1
- package/dist/providers/anthropic/index.cjs +9 -0
- package/dist/providers/anthropic/index.cjs.map +1 -1
- package/dist/providers/anthropic/index.js +9 -0
- package/dist/providers/anthropic/index.js.map +1 -1
- package/dist/providers/bedrock/index.cjs +9 -0
- package/dist/providers/bedrock/index.cjs.map +1 -1
- package/dist/providers/bedrock/index.js +9 -0
- package/dist/providers/bedrock/index.js.map +1 -1
- package/dist/providers/cerebras/index.cjs +9 -0
- package/dist/providers/cerebras/index.cjs.map +1 -1
- package/dist/providers/cerebras/index.js +9 -0
- package/dist/providers/cerebras/index.js.map +1 -1
- package/dist/providers/cohere/index.cjs +9 -0
- package/dist/providers/cohere/index.cjs.map +1 -1
- package/dist/providers/cohere/index.js +9 -0
- package/dist/providers/cohere/index.js.map +1 -1
- package/dist/providers/google/index.cjs +9 -0
- package/dist/providers/google/index.cjs.map +1 -1
- package/dist/providers/google/index.js +9 -0
- package/dist/providers/google/index.js.map +1 -1
- package/dist/providers/groq/index.cjs +9 -0
- package/dist/providers/groq/index.cjs.map +1 -1
- package/dist/providers/groq/index.js +9 -0
- package/dist/providers/groq/index.js.map +1 -1
- package/dist/providers/huggingface/index.cjs +9 -0
- package/dist/providers/huggingface/index.cjs.map +1 -1
- package/dist/providers/huggingface/index.js +9 -0
- package/dist/providers/huggingface/index.js.map +1 -1
- package/dist/providers/mistral/index.cjs +9 -0
- package/dist/providers/mistral/index.cjs.map +1 -1
- package/dist/providers/mistral/index.js +9 -0
- package/dist/providers/mistral/index.js.map +1 -1
- package/dist/providers/ollama/index.cjs +9 -0
- package/dist/providers/ollama/index.cjs.map +1 -1
- package/dist/providers/ollama/index.js +9 -0
- package/dist/providers/ollama/index.js.map +1 -1
- package/dist/providers/openai/index.cjs +9 -0
- package/dist/providers/openai/index.cjs.map +1 -1
- package/dist/providers/openai/index.js +9 -0
- package/dist/providers/openai/index.js.map +1 -1
- package/dist/providers/together/index.cjs +9 -0
- package/dist/providers/together/index.cjs.map +1 -1
- package/dist/providers/together/index.js +9 -0
- package/dist/providers/together/index.js.map +1 -1
- package/dist/providers/vercel-ai/index.cjs +9 -0
- package/dist/providers/vercel-ai/index.cjs.map +1 -1
- package/dist/providers/vercel-ai/index.js +9 -0
- package/dist/providers/vercel-ai/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -45,6 +45,39 @@ await shutdown();
|
|
|
45
45
|
|
|
46
46
|
**That's it.** Your agent's LLM calls, latency, token usage, and costs now appear in the [Risicare dashboard](https://app.risicare.ai).
|
|
47
47
|
|
|
48
|
+
## Prompt content is NOT captured by default
|
|
49
|
+
|
|
50
|
+
**Since 0.5.1, `traceContent` defaults to `false`.** Your prompts and completions
|
|
51
|
+
stay in your process. Everything else — model, token counts, latency, cost,
|
|
52
|
+
message roles, errors, and any attributes you set — is captured as normal, so the
|
|
53
|
+
dashboard, cost tracking and error diagnosis all work unchanged.
|
|
54
|
+
|
|
55
|
+
To send prompt and completion text as well, opt in:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
init({ apiKey: 'rsk-...', traceContent: true });
|
|
59
|
+
// or set RISICARE_TRACE_CONTENT=true
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Upgrading from 0.5.0 or earlier?** This is a behaviour change: content that
|
|
63
|
+
used to be sent is no longer sent unless you opt in. In those versions the flag
|
|
64
|
+
also did not work for content you set by hand — `traceContent: false` did not
|
|
65
|
+
stop a `span.setAttribute('gen_ai.prompt.0.content', ...)` from reaching us.
|
|
66
|
+
Both are fixed together.
|
|
67
|
+
|
|
68
|
+
When capture is off, content-bearing attributes are **replaced** with
|
|
69
|
+
`<risicare:content-omitted>` rather than removed, so "no prompt was sent" stays
|
|
70
|
+
distinguishable from "capture is off".
|
|
71
|
+
|
|
72
|
+
If you want content captured but redacted first, use the `mask` hook — it is
|
|
73
|
+
independent of this switch and runs on every content-bearing field before
|
|
74
|
+
export:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
init({ apiKey: 'rsk-...', traceContent: true, mask: (key, value) => value });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
|
|
48
81
|
## Features
|
|
49
82
|
|
|
50
83
|
- **12 LLM providers** — OpenAI, Anthropic, Google, Mistral, Groq, Cohere, Together, Ollama, HuggingFace, Cerebras, Bedrock, Vercel AI
|
|
@@ -109,9 +142,10 @@ import {
|
|
|
109
142
|
init({ apiKey, endpoint }) // Initialize SDK
|
|
110
143
|
agent({ name }, fn) // Wrap function with agent identity
|
|
111
144
|
session({ sessionId, userId }, fn) // Group traces into user sessions
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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 () => {...})()
|
|
115
149
|
reportError(error) // Report caught errors for diagnosis
|
|
116
150
|
score(traceId, 'quality', 0.92) // Record evaluation score [0.0-1.0]
|
|
117
151
|
tracedStream(asyncIterable, 'stream') // Trace async iterators
|
|
@@ -146,18 +180,22 @@ try {
|
|
|
146
180
|
Structure your traces to see how your agent thinks, decides, and acts:
|
|
147
181
|
|
|
148
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.
|
|
149
187
|
const myAgent = agent({ name: 'planner', role: 'coordinator' }, async (input) => {
|
|
150
188
|
const analysis = await traceThink('analyze', async () => {
|
|
151
189
|
return await openai.chat.completions.create({ /* ... */ });
|
|
152
|
-
});
|
|
190
|
+
})();
|
|
153
191
|
|
|
154
192
|
const decision = await traceDecide('choose-action', async () => {
|
|
155
193
|
return pickBestAction(analysis);
|
|
156
|
-
});
|
|
194
|
+
})();
|
|
157
195
|
|
|
158
196
|
return await traceAct('execute', async () => {
|
|
159
197
|
return executeAction(decision);
|
|
160
|
-
});
|
|
198
|
+
})();
|
|
161
199
|
});
|
|
162
200
|
```
|
|
163
201
|
|
|
@@ -123,6 +123,15 @@ var NOOP_SPAN = Object.freeze({
|
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
+
// src/runtime/taxonomy.generated.ts
|
|
127
|
+
var SUPPLEMENTAL_RULES = [
|
|
128
|
+
{ re: new RegExp("timeout|timedout|aborted", "i"), code: "TOOL.EXECUTION.TIMEOUT" },
|
|
129
|
+
{ re: new RegExp("rate.?limit|\\b429\\b|too many requests", "i"), code: "TOOL.EXECUTION.RATE_LIMITED" },
|
|
130
|
+
{ re: new RegExp("connection|econnrefused|econnreset|enotfound|fetch failed|unreachable|broken pipe", "i"), code: "TOOL.EXECUTION.DEPENDENCY_FAILED" },
|
|
131
|
+
{ re: new RegExp("\\bauth|unauthorized|forbidden|permission|\\b401\\b|\\b403\\b", "i"), code: "TOOL.INVOCATION.PERMISSION_DENIED" },
|
|
132
|
+
{ re: new RegExp("json|syntaxerror|unexpected token|decodeerror", "i"), code: "PERCEPTION.PARSING.JSON_INVALID" }
|
|
133
|
+
];
|
|
134
|
+
|
|
126
135
|
// src/runtime/applier.ts
|
|
127
136
|
var import_node_crypto2 = require("crypto");
|
|
128
137
|
|