Astro ChromaDB Search is a showcase project that demonstrates the integration of ChromaDB, a vector database, with the Astro framework. The goal of this project is to create an efficient and cost-effective indexing system for embeddings, showcasing the power of combining these technologies.
The project aims to perform semantic search over markdown files using the Astro framework and ChromaDB. By storing documents as vectors in a high-dimensional space, it enables semantic searches to return documents with similar meanings to the input query. This setup utilizes OpenAI embeddings and supports various embeddings from Hugging Face.
- src
- components
- search.ts
- content
- layout
- main-layout.astro
- pages
- api/search.ts
- posts/[...slug].astro
- index-builder.js
Make sure you have the following prerequisites installed:
- Astro ๐
- Tailwind ๐
- React โ๏ธ
- ChromaDB for vector search
pip
ordocker-compose
for installing ChromaDB
To run the application, follow these steps:
- Install dependencies: Run
yarn
to install the required dependencies. - Install ChromaDB: Install ChromaDB by running
pip install chromadb
or via Docker Compose from the official ChromaDB repository. - Start ChromaDB: Run
yarn start:chroma
to start ChromaDB by runningchroma run --path ./chromadb
(adjust the./chromadb
path to your desired location). - Create embeddings: Run
node src/index-builder.js
to process MDX files in thecontent
folder and create the necessary embeddings. - Perform searches: Use the UI or the
/api/search?query={phrase}
endpoint to perform searches based on the provided query.
The project demonstrates good code quality and follows best practices. Contributions are always welcome! Feel free to fork the repository and submit pull requests with your improvements.
Here are some additional resources for learning more about Astro and ChromaDB:
๐จโ๐ป Created by Aren Hovsepyan