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
Copy file name to clipboardExpand all lines: README.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,4 +179,46 @@ You can perform a santity check to ensure the index was created by querying for
179
179
180
180
```bash
181
181
> query indexes
182
+
```
183
+
184
+
## Search Data
185
+
186
+
Now that the data has been indexed, you can perform similarity searches using the vector search index.
187
+
188
+
You can use the `/search` endpoint provided in this repository to search for similar items based on a query item. The endpoint will return the top 5 most similar items.
189
+
190
+
The Codespace environment already has all the dependencies installed. You can start the Express.js application by running the following command:
191
+
192
+
```bash
193
+
node server.js
194
+
```
195
+
196
+
Once the server is running, you can either search using the provided query with the embedding already generated or you can provide your own query item.
197
+
198
+
### Search with the provided query
199
+
200
+
You can search for similar items based on the provided query item by making a POST request to the `/search` endpoint.
201
+
202
+
Here is an example cURL command to search for similar items based on the provided query item:
203
+
204
+
```bash
205
+
curl -X POST http://localhost:3000/search \
206
+
-H "Content-Type: application/json" \
207
+
-d '{"q": "", "useLocalEmbedding": true}'
208
+
```
209
+
210
+
As you can see, we use the `useLocalEmbedding` flag to indicate that we want to use the provided query item and we keep the `q` field empty.
211
+
212
+
### Search with your own query
213
+
214
+
If you want to search forsimilar items based on your own query item, you can provide the query itemin the request body.
215
+
216
+
The query will be automatically converted into a vector embedding using the OpenAI API. You need to provide your OpenAI API key in the `.env` file before starting the Express.js application.
217
+
218
+
Here is an example cURL command to search for similar items based on your own query item:
0 commit comments