Skip to content

Commit 371c296

Browse files
committed
chore: add bulk-ai-flow plugin to the dev-demo
1 parent 0ea6cd7 commit 371c296

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

dev-demo/resources/apartments.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import AdminForthAdapterS3Storage from "../../adapters/adminforth-storage-adapte
1919
import AdminForthAdapterLocal from "../../adapters/adminforth-storage-adapter-local/index.js";
2020
import AdminForthStorageAdapterLocalFilesystem from "../../adapters/adminforth-storage-adapter-local/index.js";
2121
import AdminForth from "../../adminforth";
22+
import BulkAiFlowPlugin from "../../plugins/adminforth-bulk-ai-flow/index.js";
23+
import AdminForthImageVisionAdapterOpenAi from "../../adapters/adminforth-image-vision-adapter-openai/index.js";
2224
import { StorageAdapter } from "../../adminforth";
2325

2426

@@ -332,6 +334,29 @@ export default {
332334
plugins: [
333335
...(process.env.AWS_ACCESS_KEY_ID
334336
? [
337+
new BulkAiFlowPlugin({
338+
// askConfirmationBeforeGenerating: true,
339+
actionName: 'Analyze',
340+
attachFiles: async ({ record }: { record: any }) => {
341+
if (!record.apartment_image) {
342+
return [];
343+
}
344+
return [`https://tmpbucket-adminforth.s3.eu-central-1.amazonaws.com/${record.apartment_image}`];
345+
},
346+
visionAdapter: new AdminForthImageVisionAdapterOpenAi(
347+
{
348+
openAiApiKey: process.env.OPENAI_API_KEY as string,
349+
model: 'gpt-4.1-mini',
350+
}
351+
),
352+
fillFieldsFromImages: {
353+
'description': 'describe what is in the image, also take into account that price is {{price}}',
354+
'country': 'In which country it can be located?',
355+
'number_of_rooms': 'How many rooms are in the apartment? Just try to guess what is a typical one. If you do not know, just guess',
356+
'square_meter': 'Try to guess what is the typical square of the apartment in square meters? If you do not know, just guess',
357+
'listed': 'Is the apartment should be listed for sale? If you do not know, just guess, return boolean value',
358+
},
359+
}),
335360
new UploadPlugin({
336361
pathColumnName: "apartment_image",
337362

0 commit comments

Comments
 (0)