File tree Expand file tree Collapse file tree 1 file changed +24
-22
lines changed
learn/search/semantic-search Expand file tree Collapse file tree 1 file changed +24
-22
lines changed Original file line number Diff line number Diff line change 155
155
},
156
156
"outputs" : [],
157
157
"source" : [
158
+ " import os\n " ,
158
159
" from pinecone import Pinecone\n " ,
159
160
" \n " ,
160
161
" api_key = os.environ.get('PINECONE_API_KEY') or 'PINECONE_API_KEY'\n " ,
194
195
},
195
196
{
196
197
"cell_type" : " code" ,
198
+ "execution_count" : null ,
199
+ "metadata" : {
200
+ "id" : " Z355VLWFqumq"
201
+ },
202
+ "outputs" : [],
197
203
"source" : [
198
204
" query = 'which city is the most populated in the world?'\n " ,
199
205
" \n " ,
209
215
" \n " ,
210
216
" # Print the first 5 vectors as a sanity check\n " ,
211
217
" xq[:5]"
212
- ],
213
- "metadata" : {
214
- "id" : " Z355VLWFqumq"
215
- },
216
- "execution_count" : null ,
217
- "outputs" : []
218
+ ]
218
219
},
219
220
{
220
221
"cell_type" : " markdown" ,
318
319
"cell_type" : " code" ,
319
320
"execution_count" : null ,
320
321
"metadata" : {
322
+ "id" : " nzhBBX2PjoaF" ,
321
323
"tags" : [
322
324
" parameters"
323
- ],
324
- "id" : " nzhBBX2PjoaF"
325
+ ]
325
326
},
326
327
"outputs" : [],
327
328
"source" : [
370
371
},
371
372
{
372
373
"cell_type" : " code" ,
374
+ "execution_count" : null ,
375
+ "metadata" : {
376
+ "id" : " 7o6rdgU8olqd"
377
+ },
378
+ "outputs" : [],
373
379
"source" : [
374
380
" from tqdm.auto import tqdm\n " ,
375
381
" \n " ,
399
405
" records = zip(ids, embeddings, metadatas)\n " ,
400
406
" # upsert to Pinecone\n " ,
401
407
" index.upsert(vectors=records)"
402
- ],
403
- "metadata" : {
404
- "id" : " 7o6rdgU8olqd"
405
- },
406
- "execution_count" : null ,
407
- "outputs" : []
408
+ ]
408
409
},
409
410
{
410
411
"cell_type" : " markdown" ,
426
427
},
427
428
{
428
429
"cell_type" : " code" ,
430
+ "execution_count" : null ,
431
+ "metadata" : {
432
+ "id" : " SNa4WHoJ0COt"
433
+ },
434
+ "outputs" : [],
429
435
"source" : [
430
436
" query = \" which city has the largest population in the world?\"\n " ,
431
437
" \n " ,
442
448
" # now query\n " ,
443
449
" xc = index.query(vector=xq, top_k=5, include_metadata=True)\n " ,
444
450
" xc"
445
- ],
446
- "metadata" : {
447
- "id" : " SNa4WHoJ0COt"
448
- },
449
- "execution_count" : null ,
450
- "outputs" : []
451
+ ]
451
452
},
452
453
{
453
454
"cell_type" : " markdown" ,
551
552
"name" : " python3"
552
553
},
553
554
"language_info" : {
554
- "name" : " python"
555
+ "name" : " python" ,
556
+ "version" : " 3.8.10"
555
557
}
556
558
},
557
559
"nbformat" : 4 ,
558
560
"nbformat_minor" : 0
559
- }
561
+ }
You can’t perform that action at this time.
0 commit comments