@drawbridge/drawbridge-utils 0.0.58 → 0.0.59
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 +3 -1
- package/dist/ai.d.cts +9 -1
- package/dist/ai.d.ts +9 -1
- package/dist/ai.js +3 -1
- package/package.json +1 -1
package/dist/ai.cjs
CHANGED
|
@@ -302,18 +302,20 @@ var google = {
|
|
|
302
302
|
},
|
|
303
303
|
text: async ({
|
|
304
304
|
config = {},
|
|
305
|
+
images = [],
|
|
305
306
|
prompt = []
|
|
306
307
|
}, {
|
|
307
308
|
db,
|
|
308
309
|
user
|
|
309
310
|
}) => {
|
|
310
311
|
const model = models.text;
|
|
312
|
+
const contents = images.length ? { parts: [...images.map((image) => ({ inlineData: { data: image.data, mimeType: image.mimeType } })), { text: prompt.join("\n") }] } : prompt.join("\n");
|
|
311
313
|
const response = await googleCircuit(() => google_client.models.generateContent({
|
|
312
314
|
config: {
|
|
313
315
|
...config,
|
|
314
316
|
responseModalities: ["Text"]
|
|
315
317
|
},
|
|
316
|
-
contents
|
|
318
|
+
contents,
|
|
317
319
|
model
|
|
318
320
|
}));
|
|
319
321
|
const content = response == null ? void 0 : response.text;
|
package/dist/ai.d.cts
CHANGED
|
@@ -265,6 +265,7 @@ const google = {
|
|
|
265
265
|
text : async (
|
|
266
266
|
{
|
|
267
267
|
config = {},
|
|
268
|
+
images = [],
|
|
268
269
|
prompt = []
|
|
269
270
|
},
|
|
270
271
|
{
|
|
@@ -275,12 +276,19 @@ const google = {
|
|
|
275
276
|
|
|
276
277
|
const model = models.text;
|
|
277
278
|
|
|
279
|
+
// When images are supplied (e.g. a page screenshot), send a multimodal
|
|
280
|
+
// parts payload so the model can SEE them alongside the text prompt;
|
|
281
|
+
// otherwise keep the plain-string contents for text-only calls.
|
|
282
|
+
const contents = images.length
|
|
283
|
+
? { parts : [ ...images.map( ( image ) => ({ inlineData : { data : image.data, mimeType : image.mimeType } }) ), { text : prompt.join( '\n' ) } ] }
|
|
284
|
+
: prompt.join( '\n' );
|
|
285
|
+
|
|
278
286
|
const response = await googleCircuit( () => google_client.models.generateContent({
|
|
279
287
|
config : {
|
|
280
288
|
...config,
|
|
281
289
|
responseModalities : [ 'Text' ]
|
|
282
290
|
},
|
|
283
|
-
contents
|
|
291
|
+
contents,
|
|
284
292
|
model
|
|
285
293
|
}) );
|
|
286
294
|
|
package/dist/ai.d.ts
CHANGED
|
@@ -265,6 +265,7 @@ const google = {
|
|
|
265
265
|
text : async (
|
|
266
266
|
{
|
|
267
267
|
config = {},
|
|
268
|
+
images = [],
|
|
268
269
|
prompt = []
|
|
269
270
|
},
|
|
270
271
|
{
|
|
@@ -275,12 +276,19 @@ const google = {
|
|
|
275
276
|
|
|
276
277
|
const model = models.text;
|
|
277
278
|
|
|
279
|
+
// When images are supplied (e.g. a page screenshot), send a multimodal
|
|
280
|
+
// parts payload so the model can SEE them alongside the text prompt;
|
|
281
|
+
// otherwise keep the plain-string contents for text-only calls.
|
|
282
|
+
const contents = images.length
|
|
283
|
+
? { parts : [ ...images.map( ( image ) => ({ inlineData : { data : image.data, mimeType : image.mimeType } }) ), { text : prompt.join( '\n' ) } ] }
|
|
284
|
+
: prompt.join( '\n' );
|
|
285
|
+
|
|
278
286
|
const response = await googleCircuit( () => google_client.models.generateContent({
|
|
279
287
|
config : {
|
|
280
288
|
...config,
|
|
281
289
|
responseModalities : [ 'Text' ]
|
|
282
290
|
},
|
|
283
|
-
contents
|
|
291
|
+
contents,
|
|
284
292
|
model
|
|
285
293
|
}) );
|
|
286
294
|
|
package/dist/ai.js
CHANGED
|
@@ -272,18 +272,20 @@ var google = {
|
|
|
272
272
|
},
|
|
273
273
|
text: async ({
|
|
274
274
|
config = {},
|
|
275
|
+
images = [],
|
|
275
276
|
prompt = []
|
|
276
277
|
}, {
|
|
277
278
|
db,
|
|
278
279
|
user
|
|
279
280
|
}) => {
|
|
280
281
|
const model = models.text;
|
|
282
|
+
const contents = images.length ? { parts: [...images.map((image) => ({ inlineData: { data: image.data, mimeType: image.mimeType } })), { text: prompt.join("\n") }] } : prompt.join("\n");
|
|
281
283
|
const response = await googleCircuit(() => google_client.models.generateContent({
|
|
282
284
|
config: {
|
|
283
285
|
...config,
|
|
284
286
|
responseModalities: ["Text"]
|
|
285
287
|
},
|
|
286
|
-
contents
|
|
288
|
+
contents,
|
|
287
289
|
model
|
|
288
290
|
}));
|
|
289
291
|
const content = response == null ? void 0 : response.text;
|
package/package.json
CHANGED