Skip to main content

No project description provided

Project description

Epsilla Logo

Python Client for Epsilla Vector Database


Welcome to Python SDK for Epsilla Vector Database!

Install pyepsilla

pip3 install --upgrade pyepsilla

Connect to Epsilla Vector Database

Run epsilla vectordb on localhost

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

Use pyepsilla to connect to and interact with local vector database

from pyepsilla import vectordb

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

## load and use a database
client.load_db(db_name="MyDB", db_path="/tmp/epsilla")
client.use_db(db_name="MyDB")

## create a table in the current database
client.create_table(
  table_name="MyTable",
  table_fields=[
    {"name": "ID", "dataType": "INT", "primaryKey": True},
    {"name": "Doc", "dataType": "STRING"},
    {"name": "Embedding", "dataType": "VECTOR_FLOAT", "dimensions": 4}
  ]
)

## insert records
client.insert(
  table_name="MyTable",
  records=[
    {"ID": 1, "Doc": "Berlin", "Embedding": [0.05, 0.61, 0.76, 0.74]},
    {"ID": 2, "Doc": "London", "Embedding": [0.19, 0.81, 0.75, 0.11]},
    {"ID": 3, "Doc": "Moscow", "Embedding": [0.36, 0.55, 0.47, 0.94]},
    {"ID": 4, "Doc": "San Francisco", "Embedding": [0.18, 0.01, 0.85, 0.80]},
    {"ID": 5, "Doc": "Shanghai", "Embedding": [0.24, 0.18, 0.22, 0.44]}
  ]
)

## search with specific response field
status_code, response = client.query(
  table_name="MyTable",
  query_field="Embedding",
  query_vector=[0.35, 0.55, 0.47, 0.94],
  response_fields = ["Doc"],
  limit=2
)
print(response)

## search without specific response field, then it will return all fields
status_code, response = client.query(
  table_name="MyTable",
  query_field="Embedding",
  query_vector=[0.35, 0.55, 0.47, 0.94],
  limit=2
)
print(response)

## delete records by primary_keys (and filter)
status_code, response =  client.delete(table_name="MyTable", primary_keys=[3, 4])
status_code, response =  client.delete(table_name="MyTable", filter="Doc <> 'San Francisco'")
print(response)


## drop a table
client.drop_table("MyTable")

## unload a database from memory
client.unload_db("MyDB")

Connect to Epsilla Cloud

Register and create vectordb on Epsilla Cloud

https://cloud.epsilla.com

Use Epsilla Cloud module to connect with the vectordb

Please check example for detail.

from pyepsilla import cloud

# Connect to Epsilla Cloud
client = cloud.Client(project_id="32ef3a3f-****-****-****-************", api_key="eps_**********")

# Connect to Vectordb
db = client.vectordb(db_id="df7431d0-****-****-****-************")

Connect to Epsilla RAG

The resp will contains answer as well as contexts, like {"answer": "****", "contexts": ['context1','context2', ...]}

from pyepsilla import cloud

# Connect to Epsilla RAG
client = cloud.RAG(
    project_id="ce07c6fc-****-****-b7bd-b7819f22bcff",
    api_key="eps_**********",
    ragapp_id="153a5a49-****-****-b2b8-496451eda8b5",
    conversation_id="6fa22a6a-****-****-b1c3-5c795d0f45ef",
)

# Start a new conversation with RAG
client.start_new_conversation()
resp = client.query("What's RAG?")

print("[INFO] response is", resp)

Contributing

Bug reports and pull requests are welcome on GitHub at here

If you have any question or problem, please join our discord

We love your Feedback!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyepsilla-0.3.9.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

pyepsilla-0.3.9-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file pyepsilla-0.3.9.tar.gz.

File metadata

  • Download URL: pyepsilla-0.3.9.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for pyepsilla-0.3.9.tar.gz
Algorithm Hash digest
SHA256 82349097d63c558088487523edc144d6ab632923253c93af6224c0af621aad31
MD5 8c73d3faee5293076de6b5e0df9f6c7f
BLAKE2b-256 55d86dd04ae9a0170e72d6c542ba73a2cabe835539b95de238ea3c5a006abf54

See more details on using hashes here.

File details

Details for the file pyepsilla-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: pyepsilla-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for pyepsilla-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 23a4bb41022bedd791acb5620bc7179a15ebe4528dda73b817debbf0fad7f8d2
MD5 5b761a13c74ca2bafbea273a4a40e971
BLAKE2b-256 8eb450b55608efb624d188b6e4ee2a5165fefc35062d4f294bbf92b7d0116e34

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page