From 346775c13b64f653d02d13b248e0509a8dade779 Mon Sep 17 00:00:00 2001 From: epsilla-eric Date: Tue, 24 Oct 2023 14:46:37 +0000 Subject: [PATCH 01/11] update readme.md --- README.md | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6d480aa..bcbe7a0 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,13 @@ pip3 install --upgrade pyepsilla ## Documentation -### Run epsilla vectordb on localhost +### 1.1 Run epsilla vectordb on localhost ```shell docker pull epsilla/vectordb docker run -d -p 8888:8888 epsilla/vectordb ``` -### Use pyepsilla to connect to and interact with vector database +### 1.2 Use pyepsilla to connect to and interact with local vector database ```python from pyepsilla import vectordb @@ -67,7 +67,7 @@ status_code, response = client.query( ) print(response) -# search without specific response field, then it will return all fields +## search without specific response field, then it will return all fields status_code, response = client.query( table_name="MyTable", query_field="Embedding", @@ -77,6 +77,14 @@ status_code, response = client.query( print(response) + +## delete records by primary_keys (and filter) +# status_code, response = client.delete(table_name="MyTable", ids=[3]) +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") @@ -84,6 +92,26 @@ print(response) #client.unload_db("MyDB") ``` + + +### 2 Run epsilla vectordb on epsilla cloud + +```python3 + +from pyepsilla import cloud + +# Connect to Epsilla Cloud +client = cloud.Client(project_id="32ef3a3f-****-****-****-************", api_key="epsilla*****") + +# Connect to Vectordb +db = client.vectordb(db_id="df7431d0-****-****-****-************") + +``` +Please check https://github.com/epsilla-cloud/epsilla-python-client/blob/main/examples/hello_epsilla_cloud.py for detail. + + + + ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/epsilla-cloud/epsilla-python-client/ From 7acdb1ad22307c4fc6575ef66ebfa3b5b06b5bb1 Mon Sep 17 00:00:00 2001 From: epsilla-eric Date: Thu, 26 Oct 2023 16:04:38 +0000 Subject: [PATCH 02/11] add demo.epsilla.com into example --- examples/hello_epsilla.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/hello_epsilla.py b/examples/hello_epsilla.py index 81110fd..8f757fb 100644 --- a/examples/hello_epsilla.py +++ b/examples/hello_epsilla.py @@ -10,11 +10,14 @@ from pyepsilla import vectordb # Connect to Epsilla VectorDB -client = vectordb.Client(host='127.0.0.1', port='8888') +client = vectordb.Client(protocol='http', host='127.0.0.1', port='8888') + +# You can also use Epsilla Cloud +# client = vectordb.Client(protocol='https', host='demo.epsilla.com', port='443') # Load DB with path ## pay attention to change db_path to persistent volume for production environment -status_code, response = client.load_db(db_name="MyDB", db_path="/tmp/epsilla") +status_code, response = client.load_db(db_name="MyDB", db_path="/data/epsilla_demo") print(response) # Set DB to current DB From 7b0f762fa96962dca13b2bd07b1061ec21688c16 Mon Sep 17 00:00:00 2001 From: epsilla-eric Date: Fri, 27 Oct 2023 16:04:21 +0000 Subject: [PATCH 03/11] add github-tag --- .github/workflows/pypi-dev.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/pypi-dev.yaml b/.github/workflows/pypi-dev.yaml index 760bdc9..a282334 100644 --- a/.github/workflows/pypi-dev.yaml +++ b/.github/workflows/pypi-dev.yaml @@ -14,12 +14,18 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Set up Python uses: actions/setup-python@v3 with: python-version: '3.x' - name: Install dependencies run: | + echo "new tag: " ${{ steps.tag_version.outputs.new_tag }} pip install -r requirements.txt python -m pip install --upgrade pip twine build python -m build --sdist --wheel --outdir dist/ . From efeaf8bfbdeb143b5121f805aea7eab443eed9be Mon Sep 17 00:00:00 2001 From: epsilla-eric Date: Fri, 27 Oct 2023 16:07:06 +0000 Subject: [PATCH 04/11] update --- .github/workflows/pypi-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-dev.yaml b/.github/workflows/pypi-dev.yaml index a282334..412f923 100644 --- a/.github/workflows/pypi-dev.yaml +++ b/.github/workflows/pypi-dev.yaml @@ -18,7 +18,7 @@ jobs: id: tag_version uses: mathieudutour/github-tag-action@v6.1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.PAT_TOKEN }} - name: Set up Python uses: actions/setup-python@v3 with: From 22eded77f27e484323652c94227d3b06629acd42 Mon Sep 17 00:00:00 2001 From: epsilla-eric Date: Fri, 27 Oct 2023 16:14:18 +0000 Subject: [PATCH 05/11] uupdate --- .github/workflows/pypi-dev.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-dev.yaml b/.github/workflows/pypi-dev.yaml index 412f923..1a52840 100644 --- a/.github/workflows/pypi-dev.yaml +++ b/.github/workflows/pypi-dev.yaml @@ -18,14 +18,17 @@ jobs: id: tag_version uses: mathieudutour/github-tag-action@v6.1 with: - github_token: ${{ secrets.PAT_TOKEN }} + github_token: ${{ secrets.PAT_TOKEN }} + tag_prefix: "" + dry_run: true - name: Set up Python uses: actions/setup-python@v3 with: python-version: '3.x' - name: Install dependencies run: | - echo "new tag: " ${{ steps.tag_version.outputs.new_tag }} + echo "new tag: " ${{ steps.tag_version.outputs.new_tag }} "," ${{ steps.tag_version.outputs.new_version }} + #v0.1.21-dev.0 pip install -r requirements.txt python -m pip install --upgrade pip twine build python -m build --sdist --wheel --outdir dist/ . From e63585c2c8732e8debca1bd08402bc6505216b36 Mon Sep 17 00:00:00 2001 From: Eric <132873174+eric-epsilla@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:24:04 +0800 Subject: [PATCH 06/11] Update pypi-dev.yaml --- .github/workflows/pypi-dev.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/pypi-dev.yaml b/.github/workflows/pypi-dev.yaml index 1a52840..d2aa012 100644 --- a/.github/workflows/pypi-dev.yaml +++ b/.github/workflows/pypi-dev.yaml @@ -21,10 +21,12 @@ jobs: github_token: ${{ secrets.PAT_TOKEN }} tag_prefix: "" dry_run: true + - name: Set up Python uses: actions/setup-python@v3 with: python-version: '3.x' + - name: Install dependencies run: | echo "new tag: " ${{ steps.tag_version.outputs.new_tag }} "," ${{ steps.tag_version.outputs.new_version }} @@ -33,3 +35,9 @@ jobs: python -m pip install --upgrade pip twine build python -m build --sdist --wheel --outdir dist/ . + - name: Create a GitHub release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.tag_version.outputs.new_tag }} + name: Release ${{ steps.tag_version.outputs.new_tag }} + body: ${{ steps.tag_version.outputs.changelog }} From 702f93827d1526b79341fd4ffb5e0e07dac03f38 Mon Sep 17 00:00:00 2001 From: Eric <132873174+eric-epsilla@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:26:12 +0800 Subject: [PATCH 07/11] Update pypi-dev.yaml --- .github/workflows/pypi-dev.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pypi-dev.yaml b/.github/workflows/pypi-dev.yaml index d2aa012..103b45f 100644 --- a/.github/workflows/pypi-dev.yaml +++ b/.github/workflows/pypi-dev.yaml @@ -7,6 +7,9 @@ on: push: branches: [ "dev" ] +permissions: + contents: write + jobs: deploy: From a2a1bfbd2b762ebe92ca5022d95c4151c9e1911a Mon Sep 17 00:00:00 2001 From: Eric <132873174+eric-epsilla@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:27:13 +0800 Subject: [PATCH 08/11] Update pypi-dev.yaml --- .github/workflows/pypi-dev.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-dev.yaml b/.github/workflows/pypi-dev.yaml index 103b45f..5d4c5b3 100644 --- a/.github/workflows/pypi-dev.yaml +++ b/.github/workflows/pypi-dev.yaml @@ -14,7 +14,11 @@ jobs: deploy: runs-on: ubuntu-latest - + # permissions: + # contents: write + # pull-requests: write + # repository-projects: write + steps: - uses: actions/checkout@v3 - name: Bump version and push tag From a26556355adaa4db15bcfb2b2122e9b646f68aed Mon Sep 17 00:00:00 2001 From: Eric <132873174+eric-epsilla@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:28:54 +0800 Subject: [PATCH 09/11] Update pypi-dev.yaml --- .github/workflows/pypi-dev.yaml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pypi-dev.yaml b/.github/workflows/pypi-dev.yaml index 5d4c5b3..8a068d7 100644 --- a/.github/workflows/pypi-dev.yaml +++ b/.github/workflows/pypi-dev.yaml @@ -27,7 +27,7 @@ jobs: with: github_token: ${{ secrets.PAT_TOKEN }} tag_prefix: "" - dry_run: true + dry_run: false - name: Set up Python uses: actions/setup-python@v3 @@ -37,14 +37,13 @@ jobs: - name: Install dependencies run: | echo "new tag: " ${{ steps.tag_version.outputs.new_tag }} "," ${{ steps.tag_version.outputs.new_version }} - #v0.1.21-dev.0 pip install -r requirements.txt python -m pip install --upgrade pip twine build python -m build --sdist --wheel --outdir dist/ . - - name: Create a GitHub release - uses: ncipollo/release-action@v1 - with: - tag: ${{ steps.tag_version.outputs.new_tag }} - name: Release ${{ steps.tag_version.outputs.new_tag }} - body: ${{ steps.tag_version.outputs.changelog }} + # - name: Create a GitHub release + # uses: ncipollo/release-action@v1 + # with: + # tag: ${{ steps.tag_version.outputs.new_tag }} + # name: Release ${{ steps.tag_version.outputs.new_tag }} + # body: ${{ steps.tag_version.outputs.changelog }} From 6e1e887e546f0a41d67245c4d81809b37645218c Mon Sep 17 00:00:00 2001 From: epsilla-eric Date: Wed, 1 Nov 2023 07:27:45 +0000 Subject: [PATCH 10/11] update query function of pyepsilla cloud client --- pyepsilla/cloud/client.py | 25 +++++++++++++++---------- pyepsilla/vectordb/version.py | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/pyepsilla/cloud/client.py b/pyepsilla/cloud/client.py index 2085230..626fc24 100644 --- a/pyepsilla/cloud/client.py +++ b/pyepsilla/cloud/client.py @@ -96,18 +96,23 @@ def insert(self, table_name: str, records: list[dict]): body = res.json() return status_code, body - ## query data from table - def query(self, table_name: str, query_field: str = "", query_vector: list = None, response_fields: list = None, limit: int = 1, with_distance: bool = False): + def query(self, table_name: str, query_field: str = None, query_vector: list = None, response_fields: Optional[list] = None, limit: int = 2, filter: Optional[str] = None, with_distance: Optional[bool] = False): req_url = "{}/data/query".format(self._baseurl) - req_data = { - "table": table_name, - "queryField": query_field, - "queryVector": query_vector, - "response": response_fields, - "limit": limit, - "withDistance": with_distance - } + req_data = { "table": table_name } + if query_field != None: + req_data["queryField"] = query_field + if query_vector != None: + req_data["queryVector"] = query_vector + if response_fields != None: + req_data["response"] = response_fields + if limit != None: + req_data["limit"] = limit + if filter != None: + req_data["filter"] = filter + if with_distance != None: + req_data["withDistance"] = with_distance + res = requests.post(url=req_url, data=json.dumps(req_data), headers=self._header) status_code = res.status_code body = res.json() diff --git a/pyepsilla/vectordb/version.py b/pyepsilla/vectordb/version.py index e160d93..dccb61c 100644 --- a/pyepsilla/vectordb/version.py +++ b/pyepsilla/vectordb/version.py @@ -1 +1 @@ -__version__ = '0.1.20' +__version__ = '0.1.21' From 6a891c619d9ba4e38d2c8e3e20ffe25fc4deddef Mon Sep 17 00:00:00 2001 From: epsilla-eric Date: Wed, 1 Nov 2023 07:30:06 +0000 Subject: [PATCH 11/11] update --- pyepsilla/cloud/client.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pyepsilla/cloud/client.py b/pyepsilla/cloud/client.py index 626fc24..866617f 100644 --- a/pyepsilla/cloud/client.py +++ b/pyepsilla/cloud/client.py @@ -96,6 +96,7 @@ def insert(self, table_name: str, records: list[dict]): body = res.json() return status_code, body + ## query data from table def query(self, table_name: str, query_field: str = None, query_vector: list = None, response_fields: Optional[list] = None, limit: int = 2, filter: Optional[str] = None, with_distance: Optional[bool] = False): req_url = "{}/data/query".format(self._baseurl) @@ -160,19 +161,14 @@ def get(self, table_name: str, response_fields: Optional[list] = None, primary_k primary_keys = ids req_data = {"table": table_name} - if response_fields != None: req_data["response"] = response_fields - if primary_keys != None: req_data["primaryKeys"] = primary_keys - if filter != None: req_data["filter"] = filter - if skip != None: req_data["skip"] = skip - if limit != None: req_data["limit"] = limit