Generating Image Embeddings via Textual Summarisation n8n Workflow Template

n8n workflow template · 13 nodes · Google Drive

Generating Image Embeddings via Textual Summarisation is a free n8n workflow template that starts when you run it manually in the n8n editor and works with Google Drive and OpenAI. It has 13 nodes, 7 of them AI nodes (Default Data Loader, Recursive Character Text Splitter, OpenAI Embeddings and OpenAI). The notes inside the workflow say: “Multimodal embedding is not designed analyze medical images for diagnostic features or disease patterns. Please do not use Multimodal embedding for medical purposes.” To run it, you add your own credentials for Google Drive OAuth2 and OpenAI API.

At a glance

Trigger
Manual Trigger (When clicking "Test workflow")
Nodes
13
Apps
Google Drive and OpenAI
AI nodes
7
Credentials
2 types
Category
RAG, documents and vector search

Apps and integrations

  • Google Drive
  • OpenAI

Node types used

  • Manual Trigger
  • Google Drive
  • Edit Image
  • Default Data Loader
  • Recursive Character Text Splitter
  • Merge
  • Edit Fields (Set)
  • OpenAI Embeddings
  • OpenAI
  • In-Memory Vector Store

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Multimodal embedding is not designed analyze medical images for diagnostic features or disease patterns. Please do not use Multimodal embedding for medical purposes.

1. Get the Source Image

In this demo, we just need an image file. We'll pull an image from google drive but you can use all input trigger or source you prefer.

2. Image Embedding Methods

Read more about working with images in n8n

There are a myriad of image embedding techniques some which involve specialised models and some which do a simplified image-to-text representation. In this demo, we'll use the simplified text representation methods: collecting color channel information and using Multimodal LLMs to produce keywords for the image. Together, these will form the document we'll embed to represent our image for search.

Generate Image Keywords

Note, OpenAI Image models work best when image is resized to 512x512.

3. Generate Embedding Doc

It is important to define your metadata for later filtering and retrieval purposes.

3. Store in Vector Store

Read more about vector stores

Once our document is ready, we can just insert into any vector store to make it ready for searching. When searching, be sure to defined the same vector store index used here! Note: Metadata is defined in the document loader which must be mapped manually.

4. Try it out!

Read more about vector stores

Here's a quick test to use a simple text prompt to search for the image. Next step would be to implement image-to-image search by using the "Embedding Doc" to search rather to store in the vector database.

Setup notes

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Try It Out!

This workflow does the following

  • Downloads a selected image from Google Drive.
  • Extracts colour channel information from the image.
  • Generates semantic keywords of the iamge using OpenAI vision model.
  • Combines extracted and generated data to create an embedding document for the image.
  • Inserts this document into a vector store to allow for vector search on the original image.

Need Help?

Join the Discord or ask in the Forum!

Nodes in this workflow

The 13 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. When clicking "Test workflow" (Manual Trigger)
  2. Google Drive (Google Drive)
  3. Get Color Information (Edit Image)
  4. Resize Image (Edit Image)
  5. Default Data Loader (Default Data Loader)
  6. Recursive Character Text Splitter (Recursive Character Text Splitter)
  7. Combine Image Analysis (Merge)
  8. Document for Embedding (Edit Fields (Set))
  9. Embeddings OpenAI1 (OpenAI Embeddings)
  10. Get Image Keywords (OpenAI)
  11. In-Memory Vector Store (In-Memory Vector Store)
  12. Embeddings OpenAI (OpenAI Embeddings)
  13. Search for Image (In-Memory Vector Store)

Credentials you need

  • Google Drive OAuth2 – used by Google Drive
  • OpenAI API – used by Embeddings OpenAI, Embeddings OpenAI1 and Get Image Keywords

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us