This project combines Chromia Vector DB with CoinGecko API to create a cryptocurrency research agent that provides historical context and current market data.
Live Demo - https://vector-db-agent-sandbox.vercel.app/
Video Demo
- Vector Database: Store and retrieve cryptocurrency historical information using Chromia's vector database
- CoinGecko Integration: Access real-time cryptocurrency market data
- Conversational Agent: Ask questions about cryptocurrencies and get AI-generated responses
- Docker (for running local Chromia node)
- Python 3.8+
- OpenAI API key
- Chromia tools (pmc, chr)
-
Clone this repository:
git clone https://github.com/yourusername/chromia-vector-db-extension.git cd chromia-vector-db-extension
-
Install Python dependencies:
pip install fastapi uvicorn openai pydantic pyyaml aiohttp
-
Set your OpenAI API key:
export OPENAI_API_KEY="your-openai-api-key"
-
Start a local Chromia node (see LOCAL.md for detailed instructions):
docker run --rm -it -p 7740:7740 registry.gitlab.com/chromaway/example-projects/directory1-example/managed-single:latest
-
Deploy the Vector DB blockchain (see LOCAL.md)
Run the startup script which handles the full setup process:
sh start_vector_db.sh
This script will:
- Install the local Chromia node if not already installed
- Set up the blockchain and build the dapp with the local node
- Run the API backend server automatically
No need to manually run separate scripts for embedding data or starting the API server.
The cryptocurrency research agent provides the following REST API endpoints:
Embeds text into the vector database.
- Request Body:
{ "text": "String of text to embed" }
- Response: Success status and error message if applicable
Searches the vector database for similar text.
- Request Body:
{ "text": "Text to search for", "max_results": 5 }
- Response: List of results with text and distance metrics
Submit a question about cryptocurrencies and get an AI-powered response.
- Request Body:
{ "question": "What is Bitcoin?", "top_k": 3 }
- Response: Answer with related information and market data if available
Retrieve recent conversation history.
- Query Parameters:
limit
: Maximum number of conversations to return (default: 10)
- Response: List of recent conversations with questions, answers, and timestamps
Check the health and status of the API and connected services.
- Response: Status information about the API, Docker container, and vector blockchain