@drawbridge/drawbridge-utils 0.0.44 → 0.0.45
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/ai.cjs +8 -20
- package/dist/ai.d.cts +13 -23
- package/dist/ai.d.ts +13 -23
- package/dist/ai.js +8 -20
- package/package.json +1 -1
package/dist/ai.cjs
CHANGED
|
@@ -293,16 +293,10 @@ var google = {
|
|
|
293
293
|
if (!content) {
|
|
294
294
|
throw new Error("Could not generate from prompt. Please try again with a different prompt.");
|
|
295
295
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
model,
|
|
301
|
-
usage: tokensFromMetadata(response == null ? void 0 : response.usageMetadata),
|
|
302
|
-
tools: toolsFromResponse(response)
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
return { content };
|
|
296
|
+
const usage = tokensFromMetadata(response == null ? void 0 : response.usageMetadata);
|
|
297
|
+
const tools = toolsFromResponse(response);
|
|
298
|
+
const bill = (user == null ? void 0 : user.id) ? () => billRequest({ db, user, model, usage, tools }) : () => Promise.resolve();
|
|
299
|
+
return { content, bill };
|
|
306
300
|
},
|
|
307
301
|
text: async ({
|
|
308
302
|
config = {},
|
|
@@ -324,16 +318,10 @@ var google = {
|
|
|
324
318
|
if (!content) {
|
|
325
319
|
throw new Error("Could not generate from prompt. Please try again with a different prompt.");
|
|
326
320
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
model,
|
|
332
|
-
usage: tokensFromMetadata(response == null ? void 0 : response.usageMetadata),
|
|
333
|
-
tools: toolsFromResponse(response)
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
return { content };
|
|
321
|
+
const usage = tokensFromMetadata(response == null ? void 0 : response.usageMetadata);
|
|
322
|
+
const tools = toolsFromResponse(response);
|
|
323
|
+
const bill = (user == null ? void 0 : user.id) ? () => billRequest({ db, user, model, usage, tools }) : () => Promise.resolve();
|
|
324
|
+
return { content, bill };
|
|
337
325
|
}
|
|
338
326
|
};
|
|
339
327
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/ai.d.cts
CHANGED
|
@@ -247,19 +247,14 @@ const google = {
|
|
|
247
247
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
const usage = tokensFromMetadata( response?.usageMetadata );
|
|
251
|
+
const tools = toolsFromResponse( response );
|
|
251
252
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
model,
|
|
256
|
-
usage : tokensFromMetadata( response?.usageMetadata ),
|
|
257
|
-
tools : toolsFromResponse( response )
|
|
258
|
-
});
|
|
253
|
+
const bill = user?.id
|
|
254
|
+
? () => billRequest({ db, user, model, usage, tools })
|
|
255
|
+
: () => Promise.resolve();
|
|
259
256
|
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return { content };
|
|
257
|
+
return { content, bill };
|
|
263
258
|
|
|
264
259
|
},
|
|
265
260
|
|
|
@@ -287,25 +282,20 @@ const google = {
|
|
|
287
282
|
|
|
288
283
|
const content = response?.text;
|
|
289
284
|
|
|
290
|
-
if( !content ){
|
|
285
|
+
if( ! content ){
|
|
291
286
|
|
|
292
287
|
throw new Error( 'Could not generate from prompt. Please try again with a different prompt.' );
|
|
293
288
|
|
|
294
289
|
}
|
|
295
290
|
|
|
296
|
-
|
|
291
|
+
const usage = tokensFromMetadata( response?.usageMetadata );
|
|
292
|
+
const tools = toolsFromResponse( response );
|
|
297
293
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
model,
|
|
302
|
-
usage : tokensFromMetadata( response?.usageMetadata ),
|
|
303
|
-
tools : toolsFromResponse( response )
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
}
|
|
294
|
+
const bill = user?.id
|
|
295
|
+
? () => billRequest({ db, user, model, usage, tools })
|
|
296
|
+
: () => Promise.resolve();
|
|
307
297
|
|
|
308
|
-
return { content };
|
|
298
|
+
return { content, bill };
|
|
309
299
|
|
|
310
300
|
}
|
|
311
301
|
|
package/dist/ai.d.ts
CHANGED
|
@@ -247,19 +247,14 @@ const google = {
|
|
|
247
247
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
const usage = tokensFromMetadata( response?.usageMetadata );
|
|
251
|
+
const tools = toolsFromResponse( response );
|
|
251
252
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
model,
|
|
256
|
-
usage : tokensFromMetadata( response?.usageMetadata ),
|
|
257
|
-
tools : toolsFromResponse( response )
|
|
258
|
-
});
|
|
253
|
+
const bill = user?.id
|
|
254
|
+
? () => billRequest({ db, user, model, usage, tools })
|
|
255
|
+
: () => Promise.resolve();
|
|
259
256
|
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return { content };
|
|
257
|
+
return { content, bill };
|
|
263
258
|
|
|
264
259
|
},
|
|
265
260
|
|
|
@@ -287,25 +282,20 @@ const google = {
|
|
|
287
282
|
|
|
288
283
|
const content = response?.text;
|
|
289
284
|
|
|
290
|
-
if( !content ){
|
|
285
|
+
if( ! content ){
|
|
291
286
|
|
|
292
287
|
throw new Error( 'Could not generate from prompt. Please try again with a different prompt.' );
|
|
293
288
|
|
|
294
289
|
}
|
|
295
290
|
|
|
296
|
-
|
|
291
|
+
const usage = tokensFromMetadata( response?.usageMetadata );
|
|
292
|
+
const tools = toolsFromResponse( response );
|
|
297
293
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
model,
|
|
302
|
-
usage : tokensFromMetadata( response?.usageMetadata ),
|
|
303
|
-
tools : toolsFromResponse( response )
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
}
|
|
294
|
+
const bill = user?.id
|
|
295
|
+
? () => billRequest({ db, user, model, usage, tools })
|
|
296
|
+
: () => Promise.resolve();
|
|
307
297
|
|
|
308
|
-
return { content };
|
|
298
|
+
return { content, bill };
|
|
309
299
|
|
|
310
300
|
}
|
|
311
301
|
|
package/dist/ai.js
CHANGED
|
@@ -263,16 +263,10 @@ var google = {
|
|
|
263
263
|
if (!content) {
|
|
264
264
|
throw new Error("Could not generate from prompt. Please try again with a different prompt.");
|
|
265
265
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
model,
|
|
271
|
-
usage: tokensFromMetadata(response == null ? void 0 : response.usageMetadata),
|
|
272
|
-
tools: toolsFromResponse(response)
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
return { content };
|
|
266
|
+
const usage = tokensFromMetadata(response == null ? void 0 : response.usageMetadata);
|
|
267
|
+
const tools = toolsFromResponse(response);
|
|
268
|
+
const bill = (user == null ? void 0 : user.id) ? () => billRequest({ db, user, model, usage, tools }) : () => Promise.resolve();
|
|
269
|
+
return { content, bill };
|
|
276
270
|
},
|
|
277
271
|
text: async ({
|
|
278
272
|
config = {},
|
|
@@ -294,16 +288,10 @@ var google = {
|
|
|
294
288
|
if (!content) {
|
|
295
289
|
throw new Error("Could not generate from prompt. Please try again with a different prompt.");
|
|
296
290
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
model,
|
|
302
|
-
usage: tokensFromMetadata(response == null ? void 0 : response.usageMetadata),
|
|
303
|
-
tools: toolsFromResponse(response)
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
return { content };
|
|
291
|
+
const usage = tokensFromMetadata(response == null ? void 0 : response.usageMetadata);
|
|
292
|
+
const tools = toolsFromResponse(response);
|
|
293
|
+
const bill = (user == null ? void 0 : user.id) ? () => billRequest({ db, user, model, usage, tools }) : () => Promise.resolve();
|
|
294
|
+
return { content, bill };
|
|
307
295
|
}
|
|
308
296
|
};
|
|
309
297
|
export {
|
package/package.json
CHANGED