opsveritas-sdk 0.1.1 → 0.1.3
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/dist/index.js +46 -1
- package/dist/index.mjs +46 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -143,8 +143,15 @@ var PRICING = {
|
|
|
143
143
|
"claude-3-sonnet": [3, 15],
|
|
144
144
|
"claude-3-haiku": [0.25, 1.25],
|
|
145
145
|
// ── Groq ───────────────────────────────────────────────────────────────────
|
|
146
|
-
//
|
|
146
|
+
// Llama 3.3
|
|
147
147
|
"llama-3.3-70b": [0.59, 0.79],
|
|
148
|
+
// Llama 3.2 — must appear before llama-3.1 to avoid wrong substring match
|
|
149
|
+
"llama-3.2-90b": [0.9, 0.9],
|
|
150
|
+
"llama-3.2-11b": [0.18, 0.18],
|
|
151
|
+
"llama-3.2-3b": [0.06, 0.06],
|
|
152
|
+
"llama-3.2-1b": [0.04, 0.04],
|
|
153
|
+
// Llama 3.1
|
|
154
|
+
"llama-3.1-405b": [5, 5],
|
|
148
155
|
"llama-3.1-70b": [0.59, 0.79],
|
|
149
156
|
"llama-3.1-8b": [0.05, 0.08],
|
|
150
157
|
// Legacy naming: llama3-…
|
|
@@ -152,6 +159,27 @@ var PRICING = {
|
|
|
152
159
|
"llama3-8b": [0.05, 0.08],
|
|
153
160
|
"mixtral-8x7b": [0.24, 0.24],
|
|
154
161
|
"gemma2-9b": [0.2, 0.2],
|
|
162
|
+
"gemma-7b": [0.07, 0.07],
|
|
163
|
+
// ── Meta Llama 4 (Groq / Together) ────────────────────────────────────────
|
|
164
|
+
"llama-4-maverick": [0.5, 0.77],
|
|
165
|
+
"llama-4-scout": [0.11, 0.34],
|
|
166
|
+
// ── Mistral ────────────────────────────────────────────────────────────────
|
|
167
|
+
"mistral-large": [2, 6],
|
|
168
|
+
"mistral-small": [0.1, 0.3],
|
|
169
|
+
"codestral": [0.2, 0.6],
|
|
170
|
+
"mistral-7b": [0.25, 0.25],
|
|
171
|
+
"mixtral-8x22b": [0.9, 0.9],
|
|
172
|
+
// ── DeepSeek ───────────────────────────────────────────────────────────────
|
|
173
|
+
"deepseek-reasoner": [0.55, 2.19],
|
|
174
|
+
"deepseek-chat": [0.27, 1.1],
|
|
175
|
+
"deepseek-coder": [0.27, 1.1],
|
|
176
|
+
// ── Cohere ─────────────────────────────────────────────────────────────────
|
|
177
|
+
"command-r-plus": [2.5, 10],
|
|
178
|
+
"command-r": [0.15, 0.6],
|
|
179
|
+
"command": [0.15, 0.6],
|
|
180
|
+
// ── Qwen (Alibaba) ─────────────────────────────────────────────────────────
|
|
181
|
+
"qwen-2.5-72b": [0.9, 0.9],
|
|
182
|
+
"qwen-2.5-7b": [0.1, 0.1],
|
|
155
183
|
// ── Google Gemini ──────────────────────────────────────────────────────────
|
|
156
184
|
"gemini-2.5-pro": [1.25, 10],
|
|
157
185
|
"gemini-2.5-flash": [0.15, 0.6],
|
|
@@ -241,6 +269,20 @@ async function trace(agentName, fn, options) {
|
|
|
241
269
|
|
|
242
270
|
// src/wrap.ts
|
|
243
271
|
var PATCHED = /* @__PURE__ */ Symbol("opsveritas.patched");
|
|
272
|
+
function extractOutput(resp) {
|
|
273
|
+
if (!resp) return void 0;
|
|
274
|
+
const choices = resp.choices;
|
|
275
|
+
if (Array.isArray(choices) && choices[0]) {
|
|
276
|
+
const content = choices[0].message?.content;
|
|
277
|
+
if (typeof content === "string" && content.trim()) return content.slice(0, 300);
|
|
278
|
+
}
|
|
279
|
+
const blocks = resp.content;
|
|
280
|
+
if (Array.isArray(blocks)) {
|
|
281
|
+
const tb = blocks.find((b) => b.type === "text");
|
|
282
|
+
if (typeof tb?.text === "string" && tb.text.trim()) return tb.text.slice(0, 300);
|
|
283
|
+
}
|
|
284
|
+
return void 0;
|
|
285
|
+
}
|
|
244
286
|
function patchOpenAI(client, opts) {
|
|
245
287
|
const completions = client.chat?.completions;
|
|
246
288
|
if (!completions || completions[PATCHED]) return;
|
|
@@ -283,6 +325,7 @@ function patchOpenAI(client, opts) {
|
|
|
283
325
|
tool_calls: toolCalls,
|
|
284
326
|
cost_usd,
|
|
285
327
|
error_message: errorMessage ?? null,
|
|
328
|
+
output_summary: extractOutput(resp),
|
|
286
329
|
user_id: opts.userId
|
|
287
330
|
});
|
|
288
331
|
}
|
|
@@ -331,6 +374,7 @@ function patchAnthropic(client, opts) {
|
|
|
331
374
|
tool_calls: toolCalls,
|
|
332
375
|
cost_usd,
|
|
333
376
|
error_message: errorMessage ?? null,
|
|
377
|
+
output_summary: extractOutput(resp),
|
|
334
378
|
user_id: opts.userId
|
|
335
379
|
});
|
|
336
380
|
}
|
|
@@ -376,6 +420,7 @@ function patchGemini(client, opts) {
|
|
|
376
420
|
output_tokens,
|
|
377
421
|
cost_usd,
|
|
378
422
|
error_message: errorMessage ?? null,
|
|
423
|
+
output_summary: extractOutput(resp),
|
|
379
424
|
user_id: opts.userId
|
|
380
425
|
});
|
|
381
426
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -112,8 +112,15 @@ var PRICING = {
|
|
|
112
112
|
"claude-3-sonnet": [3, 15],
|
|
113
113
|
"claude-3-haiku": [0.25, 1.25],
|
|
114
114
|
// ── Groq ───────────────────────────────────────────────────────────────────
|
|
115
|
-
//
|
|
115
|
+
// Llama 3.3
|
|
116
116
|
"llama-3.3-70b": [0.59, 0.79],
|
|
117
|
+
// Llama 3.2 — must appear before llama-3.1 to avoid wrong substring match
|
|
118
|
+
"llama-3.2-90b": [0.9, 0.9],
|
|
119
|
+
"llama-3.2-11b": [0.18, 0.18],
|
|
120
|
+
"llama-3.2-3b": [0.06, 0.06],
|
|
121
|
+
"llama-3.2-1b": [0.04, 0.04],
|
|
122
|
+
// Llama 3.1
|
|
123
|
+
"llama-3.1-405b": [5, 5],
|
|
117
124
|
"llama-3.1-70b": [0.59, 0.79],
|
|
118
125
|
"llama-3.1-8b": [0.05, 0.08],
|
|
119
126
|
// Legacy naming: llama3-…
|
|
@@ -121,6 +128,27 @@ var PRICING = {
|
|
|
121
128
|
"llama3-8b": [0.05, 0.08],
|
|
122
129
|
"mixtral-8x7b": [0.24, 0.24],
|
|
123
130
|
"gemma2-9b": [0.2, 0.2],
|
|
131
|
+
"gemma-7b": [0.07, 0.07],
|
|
132
|
+
// ── Meta Llama 4 (Groq / Together) ────────────────────────────────────────
|
|
133
|
+
"llama-4-maverick": [0.5, 0.77],
|
|
134
|
+
"llama-4-scout": [0.11, 0.34],
|
|
135
|
+
// ── Mistral ────────────────────────────────────────────────────────────────
|
|
136
|
+
"mistral-large": [2, 6],
|
|
137
|
+
"mistral-small": [0.1, 0.3],
|
|
138
|
+
"codestral": [0.2, 0.6],
|
|
139
|
+
"mistral-7b": [0.25, 0.25],
|
|
140
|
+
"mixtral-8x22b": [0.9, 0.9],
|
|
141
|
+
// ── DeepSeek ───────────────────────────────────────────────────────────────
|
|
142
|
+
"deepseek-reasoner": [0.55, 2.19],
|
|
143
|
+
"deepseek-chat": [0.27, 1.1],
|
|
144
|
+
"deepseek-coder": [0.27, 1.1],
|
|
145
|
+
// ── Cohere ─────────────────────────────────────────────────────────────────
|
|
146
|
+
"command-r-plus": [2.5, 10],
|
|
147
|
+
"command-r": [0.15, 0.6],
|
|
148
|
+
"command": [0.15, 0.6],
|
|
149
|
+
// ── Qwen (Alibaba) ─────────────────────────────────────────────────────────
|
|
150
|
+
"qwen-2.5-72b": [0.9, 0.9],
|
|
151
|
+
"qwen-2.5-7b": [0.1, 0.1],
|
|
124
152
|
// ── Google Gemini ──────────────────────────────────────────────────────────
|
|
125
153
|
"gemini-2.5-pro": [1.25, 10],
|
|
126
154
|
"gemini-2.5-flash": [0.15, 0.6],
|
|
@@ -210,6 +238,20 @@ async function trace(agentName, fn, options) {
|
|
|
210
238
|
|
|
211
239
|
// src/wrap.ts
|
|
212
240
|
var PATCHED = /* @__PURE__ */ Symbol("opsveritas.patched");
|
|
241
|
+
function extractOutput(resp) {
|
|
242
|
+
if (!resp) return void 0;
|
|
243
|
+
const choices = resp.choices;
|
|
244
|
+
if (Array.isArray(choices) && choices[0]) {
|
|
245
|
+
const content = choices[0].message?.content;
|
|
246
|
+
if (typeof content === "string" && content.trim()) return content.slice(0, 300);
|
|
247
|
+
}
|
|
248
|
+
const blocks = resp.content;
|
|
249
|
+
if (Array.isArray(blocks)) {
|
|
250
|
+
const tb = blocks.find((b) => b.type === "text");
|
|
251
|
+
if (typeof tb?.text === "string" && tb.text.trim()) return tb.text.slice(0, 300);
|
|
252
|
+
}
|
|
253
|
+
return void 0;
|
|
254
|
+
}
|
|
213
255
|
function patchOpenAI(client, opts) {
|
|
214
256
|
const completions = client.chat?.completions;
|
|
215
257
|
if (!completions || completions[PATCHED]) return;
|
|
@@ -252,6 +294,7 @@ function patchOpenAI(client, opts) {
|
|
|
252
294
|
tool_calls: toolCalls,
|
|
253
295
|
cost_usd,
|
|
254
296
|
error_message: errorMessage ?? null,
|
|
297
|
+
output_summary: extractOutput(resp),
|
|
255
298
|
user_id: opts.userId
|
|
256
299
|
});
|
|
257
300
|
}
|
|
@@ -300,6 +343,7 @@ function patchAnthropic(client, opts) {
|
|
|
300
343
|
tool_calls: toolCalls,
|
|
301
344
|
cost_usd,
|
|
302
345
|
error_message: errorMessage ?? null,
|
|
346
|
+
output_summary: extractOutput(resp),
|
|
303
347
|
user_id: opts.userId
|
|
304
348
|
});
|
|
305
349
|
}
|
|
@@ -345,6 +389,7 @@ function patchGemini(client, opts) {
|
|
|
345
389
|
output_tokens,
|
|
346
390
|
cost_usd,
|
|
347
391
|
error_message: errorMessage ?? null,
|
|
392
|
+
output_summary: extractOutput(resp),
|
|
348
393
|
user_id: opts.userId
|
|
349
394
|
});
|
|
350
395
|
}
|