Skip to content

About

Python SDK to use dodil cloud

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DODIL Python SDK

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

Install

pip install dodil

Quick start

Create 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()

VSpace

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.

1) Initialize VSpace

space = c.vspace.connect()
col_name = space.setup(dim=1024)  # Setup space with desired embedding dimension

2) Index data

from 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
)

3) Search data

# 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}")

4) Visualize

space.visualize()

Documentation

Examples

Check out the examples/ directory for more usage scenarios:


Development

uv sync
pytest

Contributing

We 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(...)

About

Python SDK to use dodil cloud

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages