|
187 | 187 | { |
188 | 188 | "data": { |
189 | 189 | "text/plain": [ |
190 | | - "[<Record id=UUID('393ef5c7-1587-468e-870c-b9a6a6716321') metadata='{\"action\": \"jump\", \"animal\": \"fox\"}' contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>,\n", |
191 | | - " <Record id=UUID('7bec0df8-463f-4ea9-8d50-197906f9237e') metadata='{\"animal\": \"fox\"}' contents='the brown fox' embedding=array([1. , 1.3], dtype=float32) distance=0.14489260377438218>]" |
| 190 | + "[<Record id=UUID('0c2aceca-9375-4c04-b5b4-01db19eea3c8') metadata='{\"action\": \"jump\", \"animal\": \"fox\"}' contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>,\n", |
| 191 | + " <Record id=UUID('4954646e-2677-49c3-91e8-fdc38b8eee75') metadata='{\"animal\": \"fox\"}' contents='the brown fox' embedding=array([1. , 1.3], dtype=float32) distance=0.14489260377438218>]" |
192 | 192 | ] |
193 | 193 | }, |
194 | 194 | "execution_count": null, |
|
215 | 215 | { |
216 | 216 | "data": { |
217 | 217 | "text/plain": [ |
218 | | - "[<Record id=UUID('393ef5c7-1587-468e-870c-b9a6a6716321') metadata='{\"action\": \"jump\", \"animal\": \"fox\"}' contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>]" |
| 218 | + "[<Record id=UUID('0c2aceca-9375-4c04-b5b4-01db19eea3c8') metadata='{\"action\": \"jump\", \"animal\": \"fox\"}' contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>]" |
219 | 219 | ] |
220 | 220 | }, |
221 | 221 | "execution_count": null, |
|
242 | 242 | { |
243 | 243 | "data": { |
244 | 244 | "text/plain": [ |
245 | | - "[<Record id=UUID('393ef5c7-1587-468e-870c-b9a6a6716321') metadata='{\"action\": \"jump\", \"animal\": \"fox\"}' contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>]" |
| 245 | + "[<Record id=UUID('0c2aceca-9375-4c04-b5b4-01db19eea3c8') metadata='{\"action\": \"jump\", \"animal\": \"fox\"}' contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>]" |
246 | 246 | ] |
247 | 247 | }, |
248 | 248 | "execution_count": null, |
|
254 | 254 | "await vec.search([1.0, 9.0], k=1, filter={\"action\": \"jump\"})" |
255 | 255 | ] |
256 | 256 | }, |
| 257 | + { |
| 258 | + "cell_type": "markdown", |
| 259 | + "metadata": {}, |
| 260 | + "source": [ |
| 261 | + "You can access the fields as follows" |
| 262 | + ] |
| 263 | + }, |
| 264 | + { |
| 265 | + "cell_type": "code", |
| 266 | + "execution_count": null, |
| 267 | + "metadata": {}, |
| 268 | + "outputs": [ |
| 269 | + { |
| 270 | + "data": { |
| 271 | + "text/plain": [ |
| 272 | + "UUID('0c2aceca-9375-4c04-b5b4-01db19eea3c8')" |
| 273 | + ] |
| 274 | + }, |
| 275 | + "execution_count": null, |
| 276 | + "metadata": {}, |
| 277 | + "output_type": "execute_result" |
| 278 | + } |
| 279 | + ], |
| 280 | + "source": [ |
| 281 | + "records = await vec.search([1.0, 9.0], k=1, filter={\"action\": \"jump\"})\n", |
| 282 | + "records[0][client.SEARCH_RESULT_ID_IDX]" |
| 283 | + ] |
| 284 | + }, |
| 285 | + { |
| 286 | + "cell_type": "code", |
| 287 | + "execution_count": null, |
| 288 | + "metadata": {}, |
| 289 | + "outputs": [ |
| 290 | + { |
| 291 | + "data": { |
| 292 | + "text/plain": [ |
| 293 | + "'{\"action\": \"jump\", \"animal\": \"fox\"}'" |
| 294 | + ] |
| 295 | + }, |
| 296 | + "execution_count": null, |
| 297 | + "metadata": {}, |
| 298 | + "output_type": "execute_result" |
| 299 | + } |
| 300 | + ], |
| 301 | + "source": [ |
| 302 | + "records[0][client.SEARCH_RESULT_METADATA_IDX]" |
| 303 | + ] |
| 304 | + }, |
| 305 | + { |
| 306 | + "cell_type": "code", |
| 307 | + "execution_count": null, |
| 308 | + "metadata": {}, |
| 309 | + "outputs": [ |
| 310 | + { |
| 311 | + "data": { |
| 312 | + "text/plain": [ |
| 313 | + "'jumped over the'" |
| 314 | + ] |
| 315 | + }, |
| 316 | + "execution_count": null, |
| 317 | + "metadata": {}, |
| 318 | + "output_type": "execute_result" |
| 319 | + } |
| 320 | + ], |
| 321 | + "source": [ |
| 322 | + "records[0][client.SEARCH_RESULT_CONTENTS_IDX]" |
| 323 | + ] |
| 324 | + }, |
| 325 | + { |
| 326 | + "cell_type": "code", |
| 327 | + "execution_count": null, |
| 328 | + "metadata": {}, |
| 329 | + "outputs": [ |
| 330 | + { |
| 331 | + "data": { |
| 332 | + "text/plain": [ |
| 333 | + "array([ 1. , 10.8], dtype=float32)" |
| 334 | + ] |
| 335 | + }, |
| 336 | + "execution_count": null, |
| 337 | + "metadata": {}, |
| 338 | + "output_type": "execute_result" |
| 339 | + } |
| 340 | + ], |
| 341 | + "source": [ |
| 342 | + "records[0][client.SEARCH_RESULT_EMBEDDING_IDX]" |
| 343 | + ] |
| 344 | + }, |
| 345 | + { |
| 346 | + "cell_type": "code", |
| 347 | + "execution_count": null, |
| 348 | + "metadata": {}, |
| 349 | + "outputs": [ |
| 350 | + { |
| 351 | + "data": { |
| 352 | + "text/plain": [ |
| 353 | + "0.00016793422934946456" |
| 354 | + ] |
| 355 | + }, |
| 356 | + "execution_count": null, |
| 357 | + "metadata": {}, |
| 358 | + "output_type": "execute_result" |
| 359 | + } |
| 360 | + ], |
| 361 | + "source": [ |
| 362 | + "records[0][client.SEARCH_RESULT_DISTANCE_IDX]" |
| 363 | + ] |
| 364 | + }, |
257 | 365 | { |
258 | 366 | "cell_type": "markdown", |
259 | 367 | "metadata": {}, |
|
0 commit comments