Skip to content

Commit 3fc1521

Browse files
authored
Merge pull request #55 from Eigen-DB/chore/updating-quickstart
Update quickstart in docs
2 parents 15f70f2 + 6f6bb2c commit 3fc1521

File tree

2 files changed

+105
-14
lines changed

2 files changed

+105
-14
lines changed

apps/docs/quickstart.mdx

Lines changed: 100 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@ description: 'Getting started'
44
icon: terminal
55
---
66

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
128

13-
2. Inside the repo, run:
9+
1. Clone the [repo](https://github.com/Eigen-DB/eigen-db) from GitHub:
1410

1511
```sh
16-
./apps/eigendb/setup_index.py
12+
git clone --recurse-submodules https://github.com/Eigen-DB/eigen-db
1713
```
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.
2014

21-
3. To finally start the EigenDB, run:
15+
2. To start EigenDB, run:
2216

2317
```sh
2418
docker compose up -d
@@ -30,9 +24,104 @@ Omit the `-d` flag if you don't want to run the it in the background.
3024
You can test the connection to your instance by running:
3125

3226
```sh
33-
curl http://localhost:8080/health
27+
curl http://localhost:8080/api/v1/health
3428
```
3529

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+
36125
{/*
37126
<Info>
38127
**Prerequisite** You should have installed Node.js (version 18.10.0 or

apps/docs/sdks/python.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ icon: python
66

77
## Installation
88

9-
```bash
10-
pip install eigen-client
11-
```
9+
<CodeGroup>
10+
```bash pip
11+
pip install eigen-client
12+
```
13+
</CodeGroup>
1214

1315
## Usage
1416

0 commit comments

Comments
 (0)