@@ -4,21 +4,15 @@ description: 'Getting started'
4
4
icon : terminal
5
5
---
6
6
7
- 1 . Clone the [ repo] ( https://github.com/Eigen-DB/eigen-db ) from GitHub:
8
-
9
- ``` sh
10
- git clone https://github.com/Eigen-DB/eigen-db
11
- ```
7
+ ## Getting it up and running
12
8
13
- 2 . Inside the repo, run :
9
+ 1 . Clone the [ repo] ( https://github.com/Eigen-DB/eigen-db ) from GitHub :
14
10
15
11
``` sh
16
- ./apps/eigendb/setup_index.py
12
+ git clone --recurse-submodules https://github.com/Eigen-DB/eigen-db
17
13
```
18
- This will provide you with a menu, allowing you to choose from a set of supported embedding models to use for the vectorization of your data.
19
- Based on your choice, a configuration file at ` /apps/eigendb/eigen/config.yml ` will be created with the appropriate configurations.
20
14
21
- 3 . To finally start the EigenDB, run:
15
+ 2 . To start EigenDB, run:
22
16
23
17
``` sh
24
18
docker compose up -d
@@ -30,9 +24,104 @@ Omit the `-d` flag if you don't want to run the it in the background.
30
24
You can test the connection to your instance by running:
31
25
32
26
``` sh
33
- curl http://localhost:8080/health
27
+ curl http://localhost:8080/api/v1/ health
34
28
```
35
29
30
+ ## Creating your first index
31
+
32
+ EigenDB can be interfaced with through our Python SDK or its robust REST API.
33
+
34
+ <AccordionGroup >
35
+ <Accordion title = " Python SDK" >
36
+ <Info >
37
+ To install the Python SDK, check out this [ page] ( /sdks/python ) .
38
+ </Info >
39
+
40
+ ``` python python
41
+ import os
42
+ from eigen_client.client import Client
43
+ from eigen_client.data_types import Document
44
+
45
+ client = Client(
46
+ url = " http://localhost:8080" ,
47
+ api_key = " eigendb-***" ,
48
+ )
49
+
50
+ index = client.create_index_from_model(
51
+ index_name = " food-facts" ,
52
+ model_name = " text-embedding-3-small" ,
53
+ model_provider = " openai" ,
54
+ model_provider_api_key = " your openai api key..."
55
+ )
56
+
57
+ documents = [
58
+ Document(id = 1 , data = " Fresh herbs boost flavor." , metadata = {" recipe_id" : " 123" }),
59
+ Document(id = 2 , data = " Slow simmer blends soup." , metadata = {" recipe_id" : " 456" }),
60
+ Document(id = 3 , data = " Homemade bread smells great." , metadata = {" recipe_id" : " 789" }),
61
+ Document(id = 4 , data = " Grilled veggies taste sweeter." , metadata = {" recipe_id" : " 987" }),
62
+ Document(id = 5 , data = " Cast iron sears steak well." , metadata = {" recipe_id" : " 654" })
63
+ ]
64
+
65
+ index.upsert_docs(documents)
66
+
67
+ results = index.search_docs(
68
+ string = " Baking" ,
69
+ k = 3
70
+ )
71
+
72
+ print (results)
73
+ ```
74
+ </Accordion >
75
+ <Accordion title = " REST API" >
76
+ To first create an index:
77
+
78
+ ``` bash curl
79
+ curl -X PUT http://localhost:8080/api/v1/indexes/[INDEX-NAME]/create \
80
+ -H " Content-Type: application/json" \
81
+ -H " X-Eigen-API-Key: eigendb-***" \
82
+ -d ' {
83
+ "dimensions": 1536,
84
+ "metric": "cosine"
85
+ }'
86
+ ```
87
+
88
+ To upsert your embeddings:
89
+
90
+ ``` bash curl
91
+ curl -X PUT http://localhost:8080/api/v1/embeddings/[INDEX-NAME]/upsert \
92
+ -H " Content-Type: application/json" \
93
+ -H " X-Eigen-API-Key: eigendb-***" \
94
+ -d ' {
95
+ "embeddings": [
96
+ {
97
+ "id": 1,
98
+ "data": [0.1, 0.2, 0.3, ..., 0.384],
99
+ "metadata": {"recipe_id": "123"}
100
+ },
101
+ {
102
+ "id": 2,
103
+ "data": [0.2, 0.1, 0.4, ..., 0.385],
104
+ "metadata": {"recipe_id": "456"}
105
+ },
106
+ ...
107
+ ]
108
+ }'
109
+ ```
110
+
111
+ To search for similar embeddings:
112
+
113
+ ``` bash curl
114
+ curl -X POST http://localhost:8080/api/v1/embeddings/[INDEX-NAME]/search \
115
+ -H " Content-Type: application/json" \
116
+ -H " X-Eigen-API-Key: eigendb-***" \
117
+ -d ' {
118
+ "queryVector": [0.1, 0.2, 0.3, ..., 0.384],
119
+ "k": 3
120
+ }'
121
+ ```
122
+ </Accordion >
123
+ </AccordionGroup >
124
+
36
125
{ /*
37
126
<Info>
38
127
**Prerequisite** You should have installed Node.js (version 18.10.0 or
0 commit comments