{"id":21094008,"url":"https://github.com/epsilla-cloud/epsilla-python-client","last_synced_at":"2025-04-09T23:15:00.920Z","repository":{"id":184757841,"uuid":"670249127","full_name":"epsilla-cloud/epsilla-python-client","owner":"epsilla-cloud","description":"Python client for Epsilla Vector Database","archived":false,"fork":false,"pushed_at":"2025-03-02T06:53:37.000Z","size":320,"stargazers_count":16,"open_issues_count":1,"forks_count":12,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T23:14:55.908Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://epsilla.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/epsilla-cloud.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-24T16:06:40.000Z","updated_at":"2025-03-13T06:23:44.000Z","dependencies_parsed_at":"2023-10-11T22:02:09.141Z","dependency_job_id":"aef06591-392d-4afc-b671-69181f0f2d2a","html_url":"https://github.com/epsilla-cloud/epsilla-python-client","commit_stats":{"total_commits":262,"total_committers":12,"mean_commits":"21.833333333333332","dds":"0.15267175572519087","last_synced_commit":"591710be22df9ffff105be90af4e7d8b2d2d1d95"},"previous_names":["epsilla-cloud/pyepsilla"],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epsilla-cloud%2Fepsilla-python-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epsilla-cloud%2Fepsilla-python-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epsilla-cloud%2Fepsilla-python-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epsilla-cloud%2Fepsilla-python-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epsilla-cloud","download_url":"https://codeload.github.com/epsilla-cloud/epsilla-python-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125591,"owners_count":21051770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T22:15:41.306Z","updated_at":"2025-04-09T23:15:00.893Z","avatar_url":"https://github.com/epsilla-cloud.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg width=\"275\" alt=\"Epsilla Logo\" src=\"https://epsilla-misc.s3.amazonaws.com/epsilla-horizontal.png\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003ePython Client for \u003ca href=\"https://github.com/epsilla-cloud/vectordb\"\u003eEpsilla\u003c/a\u003e Vector Database\u003c/b\u003e\n\u003c/p\u003e\n\n\u003chr /\u003e\n\nWelcome to Python SDK for Epsilla Vector Database!\n- \u003ca href=\"https://epsilla-inc.gitbook.io/epsilladb/vector-database/connect-to-a-database\"\u003eQuickStart\u003c/a\u003e\n- \u003ca href=\"https://pypi.org/project/pyepsilla/#history\"\u003eRelease History\u003c/a\u003e\n\n## Install pyepsilla\n```shell\npip3 install --upgrade pyepsilla\n```\n\n## Connect to Epsilla Vector Database\n\n#### Run epsilla vectordb on localhost\n```shell\ndocker pull epsilla/vectordb\ndocker run -d -p 8888:8888 epsilla/vectordb\n```\n\n#### When Port 8888 conflicted with Jupyter Notebook\nIf you are using Jupyter Notebook on localhost, the port 8888 maybe conflict!\n\nSo you can change the vectordb port to another number, such as 18888\n```\ndocker run -d -p 18888:8888 epsilla/vectordb\n```\n\n#### Use pyepsilla to connect to and interact with local vector database\n\n```python\nfrom pyepsilla import vectordb\n\ndb_name = \"MyDB\"\ndb_path = \"/tmp/epsilla\"\ntable_name = \"MyTable\"\n\n## 1.Connect to vectordb\nclient = vectordb.Client(\n  host='localhost',\n  port='8888'\n)\n\n## 2.Load and use a database\nclient.load_db(db_name, db_path)\nclient.use_db(db_name)\n\n## 3.Create a table in the current database\nclient.create_table(\n  table_name=table_name,\n  table_fields=[\n    {\"name\": \"ID\", \"dataType\": \"INT\", \"primaryKey\": True},\n    {\"name\": \"Doc\", \"dataType\": \"STRING\"},\n    {\"name\": \"Embedding\", \"dataType\": \"VECTOR_FLOAT\", \"dimensions\": 4}\n  ]\n)\n\n## 4.Insert records\nclient.insert(\n  table_name=table_name,\n  records=[\n    {\"ID\": 1, \"Doc\": \"Berlin\", \"Embedding\": [0.05, 0.61, 0.76, 0.74]},\n    {\"ID\": 2, \"Doc\": \"London\", \"Embedding\": [0.19, 0.81, 0.75, 0.11]},\n    {\"ID\": 3, \"Doc\": \"Moscow\", \"Embedding\": [0.36, 0.55, 0.47, 0.94]},\n    {\"ID\": 4, \"Doc\": \"San Francisco\", \"Embedding\": [0.18, 0.01, 0.85, 0.80]},\n    {\"ID\": 5, \"Doc\": \"Shanghai\", \"Embedding\": [0.24, 0.18, 0.22, 0.44]}\n  ]\n)\n\n## 5.Search with specific response field\nstatus_code, response = client.query(\n  table_name=table_name,\n  query_field=\"Embedding\",\n  query_vector=[0.35, 0.55, 0.47, 0.94],\n  response_fields = [\"Doc\"],\n  limit=2\n)\nprint(response)\n\n## 6.Search without specific response field, then it will return all fields\nstatus_code, response = client.query(\n  table_name=table_name,\n  query_field=\"Embedding\",\n  query_vector=[0.35, 0.55, 0.47, 0.94],\n  limit=2\n)\nprint(response)\n\n## 7.Delete records by primary_keys (and filter)\nstatus_code, response =  client.delete(table_name=table_name, primary_keys=[3, 4])\nstatus_code, response =  client.delete(table_name=table_name, filter=\"Doc \u003c\u003e 'San Francisco'\")\nprint(response)\n\n\n## 8.Drop a table\nclient.drop_table(table_name)\n\n## 9.Unload a database from memory\nclient.unload_db(db_name)\n```\n\n\n## Connect to Epsilla Cloud\n\n#### Register and create vectordb on Epsilla Cloud\nhttps://cloud.epsilla.com\n\n#### Use Epsilla Cloud module to connect with the vectordb\nPlease get the project_id, db_id, epsilla_api_key from Epsilla Cloud at first\n```python3\nfrom pyepsilla import cloud\n\nepsilla_api_key = os.getenv(\"EPSILLA_API_KEY\", \"Your-Epsilla-API-Key\")\nproject_id = os.getenv(\"EPSILLA_PROJECT_ID\", \"Your-Project-ID\")\ndb_id = os.getenv(\"EPSILLA_DB_ID\", \"Your-DB-ID\")\n\n\n# 1.Connect to Epsilla Cloud\ncloud_client = cloud.Client(project_id=\"*****-****-****-****-************\", api_key=\"eps_**********\")\n\n# 2.Connect to Vectordb\ndb_client = cloud_client.vectordb(db_id)\n\n# 3.Create a table with schema\nstatus_code, response = db.create_table(\n    table_name=\"MyTable\",\n    table_fields=[\n        {\"name\": \"ID\", \"dataType\": \"INT\", \"primaryKey\": True},\n        {\"name\": \"Doc\", \"dataType\": \"STRING\"},\n        {\"name\": \"Embedding\", \"dataType\": \"VECTOR_FLOAT\", \"dimensions\": 4},\n    ],\n)\nprint(status_code, response)\n\n# 4.Insert new vector records into table\nstatus_code, response = db.insert(\n    table_name=\"MyTable\",\n    records=[\n        {\"ID\": 1, \"Doc\": \"Berlin\", \"Embedding\": [0.05, 0.61, 0.76, 0.74]},\n        {\"ID\": 2, \"Doc\": \"London\", \"Embedding\": [0.19, 0.81, 0.75, 0.11]},\n        {\"ID\": 3, \"Doc\": \"Moscow\", \"Embedding\": [0.36, 0.55, 0.47, 0.94]},\n        {\"ID\": 4, \"Doc\": \"San Francisco\", \"Embedding\": [0.18, 0.01, 0.85, 0.80]},\n        {\"ID\": 5, \"Doc\": \"Shanghai\", \"Embedding\": [0.24, 0.18, 0.22, 0.44]},\n    ],\n)\nprint(status_code, response)\n\n\n# 5.Query Vectors with specific response field, otherwise it will return all fields\nstatus_code, response = db.query(\n    table_name=\"MyTable\",\n    query_field=\"Embedding\",\n    query_vector=[0.35, 0.55, 0.47, 0.94],\n    response_fields=[\"Doc\"],\n    limit=2,\n)\nprint(status_code, response)\n\n\n# 6.Delete specific records from table\nstatus_code, response = db.delete(table_name=\"MyTable\", primary_keys=[4, 5])\nstatus_code, response = db.delete(table_name=\"MyTable\", filter=\"Doc \u003c\u003e 'San Francisco'\")\nprint(status_code, response)\n\n# 7.Drop table\nstatus_code, response = db.drop_table(table_name=\"MyTable\")\nprint(status_code, response)\n\n\n```\n\n\n## Connect to Epsilla RAG\nPlease get the project_id, epsilla_api_key, ragapp_id, converstation_id(optional) from Epsilla Cloud at first\nThe resp will contains answer as well as contexts, like {\"answer\": \"****\", \"contexts\": ['context1','context2', ...]}\n\n```python3\nfrom pyepsilla import cloud\n\nepsilla_api_key = os.getenv(\"EPSILLA_API_KEY\", \"Your-Epsilla-API-Key\")\nproject_id = os.getenv(\"EPSILLA_PROJECT_ID\", \"Your-Project-ID\")\nragapp_id = os.getenv(\"EPSILLA_RAGAPP_ID\", \"Your-RAGAPP-ID\")\nconversation_id = os.getenv(\"EPSILLA_CONVERSATION_ID\", \"Your-CONVERSATION-ID\")\n\n# 1.Connect to Epsilla RAG\nclient = cloud.RAG(\n    project_id=project_id,\n    api_key=epsilla_api_key,\n    ragapp_id=ragapp_id,\n    conversation_id=conversation_id,\n)\n\n# 2.Start a new conversation with RAG\nclient.start_new_conversation()\nresp = client.query(\"What's RAG?\")\n\nprint(\"[INFO] response is\", resp)\n```\n\n\n## Contributing\nBug reports and pull requests are welcome on GitHub at [here](https://github.com/epsilla-cloud/epsilla-python-client)\n\nIf you have any question or problem, please join our [discord](https://discord.com/invite/cDaY2CxZc5)\n\nWe love your \u003ca href=\"https://forms.gle/z73ra1sGBxH9wiUR8\"\u003eFeedback\u003c/a\u003e!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepsilla-cloud%2Fepsilla-python-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepsilla-cloud%2Fepsilla-python-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepsilla-cloud%2Fepsilla-python-client/lists"}