Skip to content

Commit 08519ff

Browse files
authored
Merge pull request #54 from epsilla-cloud/dev
add Epsilla RAG support
2 parents 21be869 + 6e1d512 commit 08519ff

16 files changed

Lines changed: 846 additions & 94 deletions

README.md

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
1-
# Epsilla Python SDK
1+
<p align="center">
2+
<img width="275" alt="Epsilla Logo" src="https://epsilla-misc.s3.amazonaws.com/epsilla-horizontal.png">
3+
</p>
24

3-
Welcome to Python SDK for Epsilla Vector Database!
4-
https://pypi.org/project/pyepsilla/#history
5+
<p align="center">
6+
<b>Python Client for <a href="https://github.com/epsilla-cloud/vectordb">Epsilla</a> Vector Database</b>
7+
</p>
58

6-
## Installation
7-
```shell
8-
pip3 install pyepsilla
9-
```
10-
or
9+
<hr />
10+
11+
Welcome to Python SDK for Epsilla Vector Database!
12+
- <a href="https://epsilla-inc.gitbook.io/epsilladb/vector-database/connect-to-a-database">QuickStart</a>
13+
- <a href="https://pypi.org/project/pyepsilla/#history">Release History</a>
14+
15+
## Install pyepsilla
1116
```shell
1217
pip3 install --upgrade pyepsilla
1318
```
1419

15-
## Documentation
20+
## Connect to Epsilla Vector Database
1621

17-
### 1.1 Run epsilla vectordb on localhost
22+
#### Run epsilla vectordb on localhost
1823
```shell
1924
docker pull epsilla/vectordb
2025
docker run -d -p 8888:8888 epsilla/vectordb
2126
```
2227

23-
### 1.2 Use pyepsilla to connect to and interact with local vector database
28+
#### Use pyepsilla to connect to and interact with local vector database
2429

2530
```python
2631
from pyepsilla import vectordb
@@ -76,46 +81,65 @@ status_code, response = client.query(
7681
)
7782
print(response)
7883

79-
80-
8184
## delete records by primary_keys (and filter)
82-
# status_code, response = client.delete(table_name="MyTable", ids=[3])
8385
status_code, response = client.delete(table_name="MyTable", primary_keys=[3, 4])
84-
# status_code, response = client.delete(table_name="MyTable", filter="Doc <> 'San Francisco'")
86+
status_code, response = client.delete(table_name="MyTable", filter="Doc <> 'San Francisco'")
8587
print(response)
8688

8789

8890
## drop a table
89-
#client.drop_table("MyTable")
91+
client.drop_table("MyTable")
9092

9193
## unload a database from memory
92-
#client.unload_db("MyDB")
94+
client.unload_db("MyDB")
9395
```
9496

9597

98+
## Connect to Epsilla Cloud
9699

97-
### 2 Run epsilla vectordb on epsilla cloud
100+
#### Register and create vectordb on Epsilla Cloud
101+
https://cloud.epsilla.com
98102

103+
#### Use Epsilla Cloud module to connect with the vectordb
104+
Please check <a href="https://github.com/epsilla-cloud/epsilla-python-client/blob/main/examples/hello_epsilla_cloud.py">example</a> for detail.
99105
```python3
100-
101106
from pyepsilla import cloud
102107

103108
# Connect to Epsilla Cloud
104-
client = cloud.Client(project_id="32ef3a3f-****-****-****-************", api_key="epsilla*****")
109+
client = cloud.Client(project_id="32ef3a3f-****-****-****-************", api_key="eps_**********")
105110

106111
# Connect to Vectordb
107112
db = client.vectordb(db_id="df7431d0-****-****-****-************")
108-
109113
```
110-
Please check https://github.com/epsilla-cloud/epsilla-python-client/blob/main/examples/hello_epsilla_cloud.py for detail.
111114

112115

116+
## Connect to Epsilla RAG
117+
118+
The resp will contains answer as well as contexts, like {"answer": "****", "contexts": ['context1','context2', ...]}
119+
120+
```python3
121+
from pyepsilla import cloud
122+
123+
# Connect to Epsilla RAG
124+
client = cloud.RAG(
125+
project_id="ce07c6fc-****-****-b7bd-b7819f22bcff",
126+
api_key="eps_**********",
127+
ragapp_id="153a5a49-****-****-b2b8-496451eda8b5",
128+
conversation_id="6fa22a6a-****-****-b1c3-5c795d0f45ef",
129+
)
130+
131+
# Start a new conversation with RAG
132+
client.start_new_conversation()
133+
resp = client.query("What's RAG?")
134+
135+
print("[INFO] response is", resp)
136+
```
113137

114138

115139
## Contributing
116-
Bug reports and pull requests are welcome on GitHub at https://github.com/epsilla-cloud/epsilla-python-client/
140+
Bug reports and pull requests are welcome on GitHub at [here](https://github.com/epsilla-cloud/epsilla-python-client)
117141

118-
If you have any question or problem, please join our discord https://discord.com/invite/cDaY2CxZc5
142+
If you have any question or problem, please join our [discord](https://discord.com/invite/cDaY2CxZc5)
119143

120-
## We love your <a href="https://forms.gle/z73ra1sGBxH9wiUR8">Feedback</a>!
144+
We love your <a href="https://forms.gle/z73ra1sGBxH9wiUR8">Feedback</a>!
121145

examples/hello_epsilla.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# client = vectordb.Client(protocol='https', host='demo.epsilla.com', port='443')
1717

1818
# Load DB with path
19-
## pay attention to change db_path to persistent volume for production environment
19+
# pay attention to change db_path to persistent volume for production environment
2020
status_code, response = client.load_db(db_name="MyDB", db_path="/data/epsilla_demo")
2121
print(response)
2222

examples/hello_epsilla_cloud.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
66
# 2. create a table with schema in db
77
# 3. get the api key with project id, run this program
88

9-
import sys
10-
119
from pyepsilla import cloud
1210

1311
# Connect to Epsilla Cloud
1412
client = cloud.Client(
15-
project_id="7a68814c-f839-4a67-9ec6-93c027c865e6",
13+
project_id="7a68814c-f839-4a67-9ec6-93c027c865e0",
1614
api_key="epsilla-cloud-api-key",
1715
)
1816

1917
# Connect to Vectordb
20-
db = client.vectordb(db_id="6accafb1-476d-43b0-aa64-12ebfbf7442d")
18+
db = client.vectordb(db_id="6accafb1-476d-43b0-aa64-12ebfbf7441d")
2119

2220

2321
# Create a table with schema

examples/hello_epsilla_rag.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
# -*- coding:utf-8 -*-
3+
4+
# Try this simple example for epsilla rag
5+
# 1. create client to connect to epsilla rag
6+
# 2. launch a new converstation with epsilla rag
7+
# 3. send a query and wait the response from epsilla ragg
8+
9+
from pyepsilla import cloud
10+
11+
# Connect to Epsilla RAG
12+
client = cloud.RAG(
13+
project_id="**********",
14+
api_key="eps_**********",
15+
ragapp_id="**********",
16+
conversation_id="**********",
17+
)
18+
19+
# Start a new conversation with RAG
20+
client.start_new_conversation()
21+
resp = client.query("What's RAG?")
22+
23+
print(f"[INFO] response is {resp}")

0 commit comments

Comments
 (0)