Run with Docker

You can locally deploy the open-source Epsilla vector database by using its Docker image.

1. Installation

To run the pre-built Epsilla docker image on your machine, make sure Docker is installed on your system. Then download image from Dockerhub.

docker pull epsilla/vectordb

Start the docker as the backend service

docker run --pull=always -d -p 8888:8888 epsilla/vectordb

Your Epsilla service is up and running. You can use REST API to interact with Epsilla, or install a Python/JavaScript client.

pip3 install --upgrade pyepsilla

2. Connect to Epsilla server

from pyepsilla import vectordb

## connect to vectordb
db = vectordb.Client(
  host='localhost',
  port='8888'
)

Hint: if you are connecting to a secure server, use protocol parameter:

db = vectordb.Client(
  protocol='https',
  host=...
)

3. Create or load a database

db.load_db(db_name="MyDB", db_path="/tmp/epsilla")
db.use_db(db_name="MyDB")

4. Create a table

db.create_table(
  table_name="MyTable",
  table_fields=[
    {"name": "ID", "dataType": "INT", "primaryKey": True},
    {"name": "Doc", "dataType": "STRING"}
  ],
  indices=[
    {"name": "Index", "field": "Doc"}
  ]
)

5. Insert new records

You can insert multiple records in a batch.

db.insert(
  table_name="MyTable",
  records=[
    {"ID": 1, "Doc": "The garden was blooming with vibrant flowers, attracting butterflies and bees with their sweet nectar."},
    {"ID": 2, "Doc": "In the busy city streets, people rushed to and fro, hardly noticing the beauty of the day."},
    {"ID": 3, "Doc": "The library was a quiet haven, filled with the scent of old books and the soft rustling of pages."},
    {"ID": 4, "Doc": "High in the mountains, the air was crisp and clear, revealing breathtaking views of the valley below."},
    {"ID": 5, "Doc": "At the beach, children played joyfully in the sand, building castles and chasing the waves."},
    {"ID": 6, "Doc": "Deep in the forest, a deer cautiously stepped out, its ears alert for any signs of danger."},
    {"ID": 7, "Doc": "The old town's historical architecture spoke volumes about its rich cultural past."},
    {"ID": 8, "Doc": "Night fell, and the sky was a canvas of stars, shining brightly in the moon's soft glow."},
    {"ID": 9, "Doc": "A cozy cafe on the corner served the best hot chocolate, warming the hands and hearts of its visitors."},
    {"ID": 10, "Doc": "The artist's studio was cluttered but inspiring, filled with unfinished canvases and vibrant paints."}
  ]
)
status_code, response = db.query(
  table_name="MyTable",
  query_text="Where can I find a serene environment, ideal for relaxation and introspection?",
  limit=2
)
print(response)

Output

{
  'message': 'Query search successfully.',
  'result': [
    {'Doc': 'The library was a quiet haven, filled with the scent of old books and the soft rustling of pages.', 'ID': 3},
    {'Doc': 'High in the mountains, the air was crisp and clear, revealing breathtaking views of the valley below.', 'ID': 4}
  ],
  'statusCode': 200
}

7. Drop a table

db.drop_table("MyTable")

5. Unload a database

Offload a database that is not in use to release memory (the database files are still on disk).

db.unload_db("MyDB")

Next steps

Epsilla is designed to be simple enough to get started. Refer to Vector Database for more flexibility and options on each API.

We are tirelessly working to enhance Epsilla with more features. Please consult our Roadmap to glimpse into the future developments.

Last updated