Skip to content

Commit 7787827

Browse files
Merge pull request #31 from epsilla-cloud/dev
support Epsilla Enterprise
2 parents 4b0798d + 8853102 commit 7787827

17 files changed

Lines changed: 668 additions & 47 deletions
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: 🐞 Bug
2+
description: Report a bug or an issue you've found with the Epsilla Python Client
3+
title: "[Bug] <title>"
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this bug report!
10+
- type: checkboxes
11+
attributes:
12+
label: Is this a new bug in the Epsilla Python Client?
13+
description: >
14+
In other words, is this an error, flaw, failure or fault in the Python client?
15+
16+
If this is a request for help or troubleshooting code in your own project, please join [the Epsilla Discord](https://discord.com/invite/cDaY2CxZc5)
17+
18+
Please search to see if an issue already exists for the bug you encountered.
19+
options:
20+
- label: I believe this is a new bug in the Epsilla Python Client
21+
required: true
22+
- label: I have searched the existing issues, and I could not find an existing issue for this bug
23+
required: true
24+
- type: textarea
25+
attributes:
26+
label: Current Behavior
27+
description: A concise description of what you're experiencing.
28+
validations:
29+
required: true
30+
- type: textarea
31+
attributes:
32+
label: Expected Behavior
33+
description: A concise description of what you expected to happen.
34+
validations:
35+
required: true
36+
- type: textarea
37+
attributes:
38+
label: Steps To Reproduce
39+
description: Steps to reproduce the behavior.
40+
placeholder: |
41+
1. In this environment...
42+
2. With this config...
43+
3. Run '...'
44+
4. See error...
45+
validations:
46+
required: true
47+
- type: textarea
48+
id: logs
49+
attributes:
50+
label: Relevant log output
51+
description: |
52+
If applicable, log output to help explain your problem.
53+
render: shell
54+
validations:
55+
required: false
56+
- type: textarea
57+
attributes:
58+
label: Environment
59+
description: |
60+
examples:
61+
- **OS**: Ubuntu 20.04
62+
- **Python**: 3.11.6 (`python3 --version`)
63+
- **pyepsilla**: 2.2.1
64+
value: |
65+
- OS:
66+
- Python:
67+
- pyepsilla:
68+
render: markdown
69+
validations:
70+
required: false
71+
- type: textarea
72+
attributes:
73+
label: Additional Context
74+
description: |
75+
Links? References? Anything that will give us more context about the issue you are encountering!
76+
77+
validations:
78+
required: false
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: ✨ Feature
2+
description: Propose a feature request of the epsilla python client
3+
title: "[Feature] <title>"
4+
labels: ["enhancement", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this feature request!
10+
- type: checkboxes
11+
attributes:
12+
label: Is this your first time submitting a feature request?
13+
description: >
14+
We want to make sure that features are distinct and discoverable,
15+
so that other members of the community can find them and offer their thoughts.
16+
17+
Issues are the right place to request straightforward extensions of existing functionality.
18+
options:
19+
- label: I have searched the existing issues, and I could not find an existing issue for this feature
20+
required: true
21+
- label: I am requesting a straightforward extension of existing client functionality
22+
- type: textarea
23+
attributes:
24+
label: Describe the feature
25+
description: A clear and concise description of what you want to happen.
26+
validations:
27+
required: true
28+
- type: textarea
29+
attributes:
30+
label: Describe alternatives you've considered
31+
description: |
32+
A clear and concise description of any alternative solutions or features you've considered.
33+
validations:
34+
required: false
35+
- type: textarea
36+
attributes:
37+
label: Who will this benefit?
38+
description: |
39+
What kind of use case will this feature be useful for? Please be specific and provide examples, this will help us prioritize properly.
40+
validations:
41+
required: false
42+
- type: input
43+
attributes:
44+
label: Are you interested in contributing this feature?
45+
description: Let us know if you want to write some code, and how we can help.
46+
validations:
47+
required: false
48+
- type: textarea
49+
attributes:
50+
label: Anything else?
51+
description: |
52+
Links? References? Anything that will give us more context about the feature you are suggesting!
53+
validations:
54+
required: false

.github/workflows/pypi-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
with:
2828
github_token: ${{ secrets.PAT_TOKEN }}
2929
tag_prefix: ""
30-
dry_run: false
30+
dry_run: true
3131

3232
- name: Set up Python
3333
uses: actions/setup-python@v3

.github/workflows/pypi-publish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@v3
23+
- name: Bump version and push tag
24+
id: tag_version
25+
uses: mathieudutour/github-tag-action@v6.1
26+
with:
27+
github_token: ${{ secrets.PAT_TOKEN }}
28+
tag_prefix: ""
29+
dry_run: false
2330
- name: Set up Python
2431
uses: actions/setup-python@v3
2532
with:

CHANGELOG.md

Whitespace-only changes.

CONTRIBUTING.md

Whitespace-only changes.
File renamed without changes.

examples/hello_epsilla_cloud.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding:utf-8 -*-
33

4-
# Try this simple example for epsilla cloud
4+
# Try this simple example for epsilla cloud
55
# 1. create project and db on epsilla cloud
66
# 2. create a table with schema in db
77
# 3. get the api key with project id, run this program
@@ -10,7 +10,9 @@
1010
from pyepsilla import cloud
1111

1212
# Connect to Epsilla Cloud
13-
client = cloud.Client(project_id="32ef3a3f-fcb0-4c4b-98bb-fca01bca0d0a", api_key="epsilla")
13+
client = cloud.Client(
14+
project_id="32ef3a3f-fcb0-4c4b-98bb-fca01bca0d0a", api_key="epsilla"
15+
)
1416

1517
# Connect to Vectordb
1618
db = client.vectordb(db_id="df7431d0-806b-4654-8b45-4bdb20038e26")
@@ -21,30 +23,29 @@
2123

2224
# Insert new vector records into table
2325
status_code, response = db.insert(
24-
table_name="MyTable",
25-
records=[
26-
{"ID": 1, "Doc": "Berlin", "Embedding": [0.05, 0.61, 0.76, 0.74]},
27-
{"ID": 2, "Doc": "London", "Embedding": [0.19, 0.81, 0.75, 0.11]},
28-
{"ID": 3, "Doc": "Moscow", "Embedding": [0.36, 0.55, 0.47, 0.94]},
29-
{"ID": 4, "Doc": "San Francisco", "Embedding": [0.18, 0.01, 0.85, 0.80]},
30-
{"ID": 5, "Doc": "Shanghai", "Embedding": [0.24, 0.18, 0.22, 0.44]}
31-
]
26+
table_name="MyTable",
27+
records=[
28+
{"ID": 1, "Doc": "Berlin", "Embedding": [0.05, 0.61, 0.76, 0.74]},
29+
{"ID": 2, "Doc": "London", "Embedding": [0.19, 0.81, 0.75, 0.11]},
30+
{"ID": 3, "Doc": "Moscow", "Embedding": [0.36, 0.55, 0.47, 0.94]},
31+
{"ID": 4, "Doc": "San Francisco", "Embedding": [0.18, 0.01, 0.85, 0.80]},
32+
{"ID": 5, "Doc": "Shanghai", "Embedding": [0.24, 0.18, 0.22, 0.44]},
33+
],
3234
)
33-
print(response)
35+
print(status_code, response)
3436

3537
# Query Vectors with specific response field, otherwise it will return all fields
3638
status_code, response = db.query(
37-
table_name="MyTable",
38-
query_field="Embedding",
39-
query_vector=[0.35, 0.55, 0.47, 0.94],
40-
response_fields = ["Doc"],
41-
limit=2
39+
table_name="MyTable",
40+
query_field="Embedding",
41+
query_vector=[0.35, 0.55, 0.47, 0.94],
42+
response_fields=["Doc"],
43+
limit=2,
4244
)
43-
print(response)
45+
print(status_code, response)
4446

4547

4648
# Delete specific records from table
4749
status_code, response = db.delete(table_name="MyTable", primary_keys=[4, 5])
48-
status_code, response = client.delete(table_name="MyTable", filter="Doc <> 'San Francisco'")
49-
print(response)
50-
50+
status_code, response = db.delete(table_name="MyTable", filter="Doc <> 'San Francisco'")
51+
print(status_code, response)
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/usr/bin/env python
2+
# -*- coding:utf-8 -*-
3+
4+
import time
5+
6+
from pyepsilla import enterprise
7+
8+
# Connect to Epsilla Enterprise API EndPoint
9+
client = enterprise.Client(base_url="https://api.epsilla.com")
10+
client.hello()
11+
12+
# Get DB List
13+
# db_list = client.get_db_list()
14+
# print("db_list:", db_list)
15+
16+
db_name = "helloepsilla"
17+
db_id = "helloepsilla-1234567890"
18+
table_name = "HelloEpsilla"
19+
20+
21+
# Create a new db
22+
status_code, response = client.create_db(db_name, db_id)
23+
print(status_code, response)
24+
25+
# Get info of db
26+
status_code, response = client.get_db_info(db_id)
27+
print(status_code, response)
28+
29+
time.sleep(5)
30+
# Load db
31+
status_code, response = client.load_db(db_id)
32+
print(status_code, response)
33+
34+
# Connect to an existing db
35+
db = client.vectordb(db_id)
36+
37+
# Create table with schema
38+
status_code, response = db.create_table(
39+
table_name="MyTable",
40+
table_fields=[
41+
{"name": "ID", "dataType": "INT", "primaryKey": True},
42+
{"name": "Doc", "dataType": "STRING"},
43+
{"name": "Embedding", "dataType": "VECTOR_FLOAT", "dimensions": 4},
44+
],
45+
)
46+
print(status_code, response)
47+
48+
49+
# Insert new vector records into table
50+
status_code, response = db.insert(
51+
table_name="MyTable",
52+
records=[
53+
{"ID": 11, "Doc": "Berlin", "Embedding": [0.05, 0.61, 0.76, 0.74]},
54+
{"ID": 12, "Doc": "London", "Embedding": [0.19, 0.81, 0.75, 0.11]},
55+
{"ID": 13, "Doc": "Moscow", "Embedding": [0.36, 0.55, 0.47, 0.94]},
56+
{"ID": 14, "Doc": "San Francisco", "Embedding": [0.18, 0.01, 0.85, 0.80]},
57+
{"ID": 15, "Doc": "Shanghai", "Embedding": [0.24, 0.18, 0.22, 0.44]},
58+
],
59+
)
60+
print(status_code, response)
61+
62+
# Query Vectors with specific response field
63+
status_code, response = db.query(
64+
table_name="MyTable",
65+
query_field="Embedding",
66+
query_vector=[0.35, 0.55, 0.47, 0.94],
67+
response_fields=["Doc"],
68+
limit=2,
69+
)
70+
print(status_code, response)
71+
72+
# Query Vectors without specific response field, then it will return all fields
73+
status_code, response = db.query(
74+
table_name="MyTable",
75+
query_field="Embedding",
76+
query_vector=[0.35, 0.55, 0.47, 0.94],
77+
limit=2,
78+
)
79+
print(status_code, response)
80+
81+
# Get
82+
status_code, response = db.get(
83+
table_name="MyTable",
84+
response_fields=["Doc", "Embedding"],
85+
filter="Doc <> 'San Francisco'",
86+
limit=5,
87+
)
88+
print(status_code, response)
89+
90+
91+
# Delete specific records from table
92+
status_code, response = db.delete(table_name="MyTable", primary_keys=[4, 5])
93+
print(status_code, response)
94+
status_code, response = db.delete(table_name="MyTable", filter="Doc <> 'San Francisco'")
95+
print(status_code, response)
96+
97+
98+
# Drop table
99+
status_code, response = db.drop_table("MyTable")
100+
print(response)
101+
102+
# Delete db
103+
status_code, response = client.drop_db(db_id)
104+
print(status_code, response)

pyepsilla/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33

44
from . import vectordb
55
from . import cloud
6+
from . import enterprise

0 commit comments

Comments
 (0)