I’m excited to announce SemaDbAPI.jl, a new Julia client package for interacting with SemaDB, a high-performance vector database designed for similarity search and semantic operations.
Why SemaDbAPI.jl?
Vector databases are becoming increasingly important for AI applications, semantic search, and similarity-based operations. While several vector databases exist, there hasn’t been a well-integrated Julia solution—until now. SemaDbAPI.jl provides a strongly-typed, idiomatic Julia interface to SemaDB, making it easy to incorporate vector search capabilities into your Julia workflows.
Key Features
Multiple Indexing Strategies:
- Vamana (graph-based approximate nearest neighbor search)
- Flat (exact search)
- Text indexing for semantic search
- Binary and Product quantization options
Rich Query Capabilities:
- Vector similarity search with multiple distance metrics
- Metadata filtering with complex AND/OR compositions
- Sorting, pagination, and field selection
- Hybrid search combining vector and text queries
Julia-First Experience:
- Strongly-typed interface generated via OpenAPI.jl
- Compile-time parameter validation
- Comprehensive error handling
- Idiomatic Julia syntax
Installation
using Pkg
Pkg.add("SemaDbAPI")
Quick Start
using SemaDbAPI
using UUIDs
# Initialize client
client = SemaDBClient("http://localhost:8081/v2")
# Create a collection with Vamana indexing
ivvp = IndexVectorVamanaParameters(
vectorSize = 2,
distanceMetric = "euclidean",
searchSize = 75,
degreeBound = 64,
alpha = 1.2
)
ischema = Dict("vector" => IndexSchemaValue(
type = "vectorVamana",
vectorVamana = ivvp
))
req = CreateCollectionRequest(id = "mycollection", indexSchema = ischema)
create_collection(client, "Julia", req)
# Insert points
points = [
Dict("_id" => string(uuid4()), "vector" => [1.0, 2.0], "metadata" => "first point"),
Dict("_id" => string(uuid4()), "vector" => [3.0, 4.0], "metadata" => "second point")
]
insert_req = InsertPointsRequest(points = points)
insert_point(client, "Julia", "mycollection", insert_req)
# Perform search
search_opts = SearchVectorVamanaOptions(vector = [1, 2], operator = "near")
query = Query(property = "vector", vectorVamana = search_opts)
search_req = SearchRequest(query = query, limit = 10)
search_res = search_point(client, "Julia", "mycollection", search_req)
# Clean up
delete_collection(client, "Julia", "mycollection")
Advanced Usage
SemaDbAPI.jl supports sophisticated operations like hybrid search (combining vector and text search):
# Vector part of the search
vector_query = Query(
property = "vector",
vectorVamana = SearchVectorVamanaOptions(vector = [0.1, 0.2, 0.3], weight = 0.7)
)
# Text part of the search
text_query = Query(
property = "description",
text = SearchTextOptions(query = "programming language", weight = 0.3)
)
# Combine both queries
combined_query = Query(_and = [vector_query, text_query])
search_req = SearchRequest(query = combined_query, limit = 10)
results = search_point(client, "user1", "hybrid_collection", search_req)
Documentation & Resources
Why This Matters for Julia Users
This package bridges Julia’s high-performance computing capabilities with modern vector database technology. Whether you’re building:
- Recommendation systems
- Semantic search applications
- Similarity-based analysis tools
- AI-powered applications requiring efficient vector search
SemaDbAPI.jl provides the type-safe, efficient interface you need to integrate these capabilities directly into your Julia workflow.
Try It Out!
SemaDbAPI.jl is ready for use and includes a comprehensive test suite. I’d love to hear your feedback, suggestions, and contributions!
Special thanks to the OpenAPI.jl team for providing the foundation that made this package possible with its strong typing and validation capabilities.