You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Repository navigation
Commit d231f38
Browse filesBrowse the repository at this point in the historyBrowse files
- Persist a `DocumentArray` using a **`DocumentStore`**
147
+
- Persist a `DocArray` using a **`DocumentStore`**
148
148
- Store your Documents in any supported (vector) database: **Elasticsearch**, **Qdrant**, **Weaviate**, **Redis**, **Milvus**, **ANNLite** or **SQLite**
149
149
- Leverage DocumentStores to **perform vector search on your multi-modal data**
150
150
151
151
```python
152
152
#NOTE: DocumentStores are not yet implemented in version 2
153
-
from docarray importDocumentArray
153
+
from docarray importDocArray
154
154
from docarray.documents import ImageDoc
155
155
from docarray.stores import DocumentStore
156
156
import numpy as np
157
157
158
-
da =DocumentArray([ImageDoc(embedding=np.zeros((128,))) for _ inrange(1000)])
158
+
da =DocArray([ImageDoc(embedding=np.zeros((128,))) for _ inrange(1000)])
159
159
store = DocumentStore[ImageDoc](
160
160
storage='qdrant'
161
161
) # create a DocumentStore with Qdrant as backend
162
-
store.insert(da) # insert the DocumentArray into the DocumentStore
162
+
store.insert(da) # insert the DocArray into the DocumentStore
163
163
# find the 10 most similar images based on the 'embedding' field
164
164
match = store.find(ImageDoc(embedding=np.zeros((128,))), field='embedding', top_k=10)
165
165
```
@@ -186,7 +186,7 @@ If you come from Pydantic, you can see Documents as juiced up models, and DocArr
-**Types that are alive**: ImageUrl can `.load()` a URL to image tensor, TextUrl can load and tokenize text documents, etc.
188
188
-**Pre-built Documents** for different data modalities: Image, Text, 3DMesh, Video, Audio and more. Note that all of these will be valid Pydantic models!
189
-
- The concepts of **DocumentArray and DocumentStore**
189
+
- The concepts of **DocArray and DocumentStore**
190
190
- Cloud-ready: Serialization to **Protobuf** for use with microservices and **gRPC**
191
191
- Support for **vector search functionalities**, such as `find()` and `embed()`
192
192
@@ -233,20 +233,20 @@ Not very easy on the eyes if you ask us. And even worse, if you need to add one
233
233
So, now let's see what the same code looks like with DocArray:
234
234
235
235
```python
236
-
from docarray importDocumentArray, BaseDocument
236
+
from docarray importDocArray, BaseDoc
237
237
from docarray.documents import ImageDoc, TextDoc, AudioDoc
238
238
from docarray.typing import TorchTensor
239
239
240
240
import torch
241
241
242
242
243
-
classPodcast(BaseDocument):
243
+
classPodcast(BaseDoc):
244
244
text: TextDoc
245
245
image: ImageDoc
246
246
audio: AudioDoc
247
247
248
248
249
-
classPairPodcast(BaseDocument):
249
+
classPairPodcast(BaseDoc):
250
250
left: Podcast
251
251
right: Podcast
252
252
@@ -258,14 +258,14 @@ class MyPodcastModel(nn.Module):
258
258
self.image_encoder = ImageEncoder()
259
259
self.text_encoder = TextEncoder()
260
260
261
-
defforward_podcast(self, da: DocumentArray[Podcast]) -> DocumentArray[Podcast]:
261
+
defforward_podcast(self, da: DocArray[Podcast]) -> DocArray[Podcast]:
0 commit comments