dimies 0.1.1 → 0.1.2

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 CHANGED
@@ -43,11 +43,16 @@ trackConversation({
43
43
  trace: [
44
44
  { id: "llm-1", name: "vera.llm", type: "llm",
45
45
  model: "gpt-4o", tokens_in: 1240, tokens_out: 85,
46
+ cost: 0.0017, // optional — exact spend; omit and Dimies estimates it
46
47
  input: prompt, output: completion },
47
48
  ],
48
49
  });
49
50
  ```
50
51
 
51
- Field names are **exact** — `prompt`/`completion`/`response` are silently dropped, so a span sent that way shows *"No payload recorded"*. Merge is field-level and keyed by `id`: resend the same `id` to update a span (e.g. `{ id: "llm-1", status: "error" }`) and only the fields you include change — the rest is preserved. Full span schema: `<your-instance>/llms.txt`.
52
+ Field names are **exact** — `prompt`/`completion`/`response` are silently dropped, so a span sent that way shows *"No payload recorded"*. Merge is field-level and keyed by `id`: resend the same `id` to update a span (e.g. `{ id: "llm-1", status: "error" }`) and only the fields you include change — the rest is preserved.
53
+
54
+ **Cost accuracy:** set `model`, `tokens_in`, `tokens_out` on `llm` spans and the **Costs** dashboard prices them at list rates. For **exact** spend (negotiated rates, caching), also send `cost` in USD from your provider's usage — it's used verbatim instead of the estimate.
55
+
56
+ Full span schema: `<your-instance>/llms.txt`.
52
57
 
53
58
  MIT.
package/bin/dimies.js CHANGED
@@ -67,10 +67,11 @@ type DimiesSpan = {
67
67
  input?: unknown; // the payload shown when you click the span. llm: the prompt/messages;
68
68
  output?: unknown; // tool: args/result; retrieval: query/docs. Names are exact — "prompt"
69
69
  // or "completion" are dropped. Resend only the fields you change.
70
- model?: string;
71
- tokens_in?: number;
72
- tokens_out?: number;
73
- cost?: number;
70
+ model?: string; // llm spans: the model id, e.g. "gpt-4o", "kimi-k2"
71
+ tokens_in?: number; // prompt tokens (needed for cost)
72
+ tokens_out?: number; // completion tokens (needed for cost)
73
+ cost?: number; // USD. Send it for EXACT spend in the Costs dashboard;
74
+ // if omitted, Dimies estimates from model + tokens at list prices.
74
75
  status?: "ok" | "error";
75
76
  error?: string;
76
77
  metadata?: Record<string, unknown>;
@@ -178,8 +179,10 @@ const AGENT_PROMPT = (baseUrl) => `Integrate Dimies conversation analytics into
178
179
  (span schema in the spec) so executions are debuggable. On each span set
179
180
  "input" and "output" (exact field names) to the payload — for an llm span that
180
181
  is the prompt and the completion; for a tool span the args and the result.
181
- Without them the span shows "No payload recorded". Give every span a stable
182
- "id" and resend only the fields you change.
182
+ On llm spans also set "model", "tokens_in", "tokens_out" (from the provider's
183
+ usage) for cost analytics — and "cost" in USD if you want exact spend instead
184
+ of an estimate. Without payload the span shows "No payload recorded". Give
185
+ every span a stable "id" and resend only the fields you change.
183
186
  6. Verify: run the app, trigger one conversation, and confirm it appears at
184
187
  ${baseUrl}/app (or run \`npx dimies test --key $DIMIES_API_KEY\`).
185
188
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dimies",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Integrate Dimies (conversation analytics for AI agents) into any codebase in one command — human- and AI-coding-agent-friendly.",
5
5
  "bin": {
6
6
  "dimies": "bin/dimies.js"