擷取向量

使用 Pinecone 構建 AI 應用

James Chapman

Curriculum Manager, DataCamp

回顧…

建立索引。

使用 Pinecone 構建 AI 應用

回顧…

多筆紀錄匯入索引。加入後索引使用量上升。

使用 Pinecone 構建 AI 應用

存取向量

 

Fetching

  • 依 ID 取回向量

依 ISBN 取回書籍。

 

Querying

  • 取回與輸入向量相似的向量

Amazon 書籍推薦。

使用 Pinecone 構建 AI 應用

取回向量(fetch)

index.fetch(

ids=['0', '1']
)
{'namespace': '',
 'usage': {'read_units': 1},
 'vectors': {'0': {'id': '0',
                   'metadata': {"genre": "productivity", "year": 2020},
                   'values': [0.025525547564029694, ...]},
             '1': {'id': '1',
                   'metadata': {"genre": "action", "year": 2023},
                   'values': [-0.0131468913, ...]}}
}
1 https://docs.pinecone.io/guides/data/fetch-data
使用 Pinecone 構建 AI 應用

讀取單位(Read units)

 

  • 讀取作業所耗資源的量測:
    • Fetching → 1RU / 10 筆紀錄
    • Querying
    • Listing

 

Pinecone 入門帳戶定價。

1 https://www.pinecone.io/pricing/
使用 Pinecone 構建 AI 應用

從命名空間取回向量

index.fetch(
    ids=['0', '1']

namespace='namespace1'
)
{'namespace': 'namespace1',
 'usage': {'read_units': 1},
 'vectors': {'0': {'id': '0',
                   'metadata': {"genre": "productivity", "year": 2020},
                   'values': [0.025525547564029694, ...]},
             '1': {'id': '1',
                   'metadata': {"genre": "action", "year": 2023},
                   'values': [-0.0131468913, ...]}}
}
使用 Pinecone 構建 AI 應用

一起來練習吧!

使用 Pinecone 構建 AI 應用

Preparing Video For Download...