Semantic Image Similarity Search with 4D.Vector and 4D AI Kit (4D 20 R10).
This demo illustrates how to:
- Generate embeddings (vectors) from text prompts and image descriptions.
- Compare vectors using cosine similarity, dot product, and Euclidean distance.
- Search images by meaning, not by filenames or metadata.
👉 Full explanation available in the blog post.
- Download the latest Release version of 4D: Product Download
- Or the latest Beta version: Beta Program
- Follow activation steps: Installation Guide
- Generate one here: OpenAI API Keys
- Best practices:
- Never share your key publicly (e.g., in GitHub).
- Store securely (environment variables, config files outside version control).
- Monitor usage in the OpenAI dashboard.
- Set limits or alerts to avoid unexpected costs.
- Enable Qodly Studio: Qodly Studio Setup
- Clone or download this repository to your local machine.
- Need help? See Using GitHub with 4D.
- Open the project in 4D:
- Go to File > Open Project (More details here: Open a Project)
- Go to Design > Qodly Studio… > Preview.
- Enter your OpenAI API Key:
- Go to the API Key input field in the Info tab and fill it.
- If you forget, the demo will prompt you with a modal before proceeding.
- Play with the demo:
- Type or select a prompt → The app compares it with stored vectors and returns ranked images.
- Upload images → The app generates a caption & description, then embeds them as vectors.
- Inspect the code:
- Switch to design mode: Mode > Return to Design Mode.