Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Jul 14, 2023
1 parent a3a4a72 commit 133f088
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ from docarray.typing import NdArray

class ToyDoc(BaseDoc):
text: str = ''
embedding: NdArray[float, 128]
embedding: NdArray[128]
```

2. Opt for a pre-built database (like `InMemoryExactNNVectorDB` or `HNSWVectorDB`), and apply the schema:
Expand Down Expand Up @@ -136,19 +136,12 @@ Start by embedding your database instance or class into a Python file:
```python
# example.py
from docarray import BaseDoc
from docarray.typing import NdArray
from vectordb import InMemoryExactNNVectorDB


class MyDoc(BaseDoc):
text: str
embedding: NdArray[128]


db = InMemoryExactNNVectorDB[MyDoc](workspace='./vectordb') # notice how `db` is the instance that we want to serve
db = InMemoryExactNNVectorDB[ToyDoc](workspace='./vectordb') # notice how `db` is the instance that we want to serve

if __name__ == '__main__':
# make sure to protect this part of the code
# IMPORTANT: make sure to protect this part of the code using __main__ guard
with db.serve() as service:
service.block()
```
Expand Down

0 comments on commit 133f088

Please sign in to comment.