The DODIL Python SDK lets you interact with DODIL services from Python.
Currently supported services:
- VNG: multi-modal vector ingestion
- VBase: vector database (Milvus-backed)
- VSpace: integrated embedding + storage structure
pip install dodilCreate a client using a service account:
from dodil import Client
c = Client(
profile="staging", # or "prod"
service_account_id="...",
service_account_secret="...",
)VBase (connect + list collections):
from dodil import VBaseConfig
vbase = c.vbase.connect(
VBaseConfig(
host="vbase-db-<id>.infra.dodil.cloud",
port=443,
scheme="https",
db_name="db_<id>",
)
)
print(vbase.list_collections())
vbase.close()
c.close()For varied use cases involving embedding + storage, the SDK provides a VSpace structure. This allows you to embed texts via VNG and store/search them in VBase with single commands.
space = c.vspace.connect()
col_name = space.setup(dim=1024) # Setup space with desired embedding dimensionfrom dodil.vng import EmbeddingTask
space.add(
data=[
"apple",
"banana",
# Example: embedding an image from URL
"https://example.com/cherry.jpg"
],
ids=[1, 2, 3], # Optional manually assigned IDs
vng_task=EmbeddingTask.INDEX
)# Search with text
results = space.search(
query="fruit",
limit=5,
vng_task=EmbeddingTask.QUERY,
output_fields=["text", "id"]
)
print(f"Found {len(results)} results:")
for i, hit in enumerate(results):
print(f"\nResult {i+1}:")
print(f" Score: {hit.get('distance'):.4f}")space.visualize()Check out the examples/ directory for more usage scenarios:
uv sync
pytestWe welcome issues and pull requests.
– Keep public APIs stable (prefer additive changes).
– Maintain backward compatibility where possible.
- Add tests for bug fixes and new features.
- Format and lint before opening a PR.
Project conventions
- Root client: Client
- Services are accessed through handles (e.g. client.vng, client.vbase).
- Bound service clients are created via .connect(...)