A high-performance Vector Search API built with Go, designed to efficiently store and search through document embeddings using semantic similarity. The API leverages MinIO for scalable object storage and implements concurrent processing for optimal performance.
- High-Performance Vector Search: Optimized similarity search using cosine similarity
- Concurrent Processing: Parallel processing of documents and search operations
- Scalable Storage: MinIO integration for reliable and scalable object storage
- Collection Management: Create, search, and delete document collections
- Multi-Collection Search: Search across multiple collections simultaneously
- Async Operations: Non-blocking storage and deletion operations
- Environment Configuration: Secure credential management through environment variables
- Go 1.20 or higher
- MinIO instance (self-hosted or cloud service)
- Git
- Clone the repository:
git clone https://github.com/dist-bit/nebuia_vector_db
cd vector-search-api
- Install dependencies:
go mod download
- Create and configure your
.env
file:
cp .env.example .env
- Update the
.env
file with your MinIO credentials:
MINIO_ENDPOINT=your-minio-endpoint
MINIO_ACCESS_KEY=your-access-key
MINIO_SECRET_KEY=your-secret-key
MINIO_BUCKET_NAME=your-bucket-name
APP_PORT=5489
- Build the application:
go build -o vector-search-api
./vector-search-api
The API will be available at http://localhost:5489
(or your configured port).
POST /store
Content-Type: application/json
{
"collection_name": "my_collection",
"documents": [
{
"text": "Document content",
"metadata": {
"source": "source_name",
"name": "doc_name"
},
"chunks": [
{
"text": "Chunk content",
"embedding": {
"vector": [0.1, 0.2, 0.3, ...]
},
"metadata": {
"source": "chunk_source",
"name": "chunk_name"
}
}
]
}
]
}
POST /search
Content-Type: application/json
{
"collection_name": "my_collection",
"query_embedding": {
"vector": [0.1, 0.2, 0.3, ...]
},
"top_k": 5
}
POST /multi_search
Content-Type: application/json
{
"collections": ["collection1", "collection2"],
"query_embedding": {
"vector": [0.1, 0.2, 0.3, ...]
},
"top_k": 5
}
POST /delete_collection
Content-Type: application/json
{
"collection_name": "my_collection"
}
The API is built with the following components:
- Fiber: High-performance web framework
- MinIO: Distributed object storage
- go-json: Optimized JSON encoder/decoder
- sync.Map: Thread-safe concurrent map implementation
- Context: Context-based operation management
- UUID: Unique identifier generation
The application can be configured through environment variables:
Variable | Description | Required | Default |
---|---|---|---|
MINIO_ENDPOINT | MinIO server endpoint | Yes | - |
MINIO_ACCESS_KEY | MinIO access key | Yes | - |
MINIO_SECRET_KEY | MinIO secret key | Yes | - |
MINIO_BUCKET_NAME | MinIO bucket name | Yes | - |
APP_PORT | Application port | No | 5489 |
- Concurrent document processing
- Connection pooling for MinIO operations
- Efficient vector similarity calculations
- Optimized JSON encoding/decoding
- Pre-allocated slices for search results
- Secure credential management through environment variables
- TLS encryption for MinIO connections
- Request rate limiting and timeouts
- Input validation for all endpoints
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For more detailed documentation, please refer to the Wiki.
For support, please open an issue in the GitHub repository or contact the maintainers.
Made with ❤️ by NebuIA