連線至索引
若要在你新建立的 Pinecone 索引中開始匯入向量並進行向量操作,你需要先連線到該索引!連線後取得的索引物件,在 Python 中提供多種方法可用來匯入、操作,以及探索索引內容。
Pinecone 類別已為你匯入,並會在整門課程中可用。
本練習屬於課程
使用 Pinecone 構建 AI 應用
練習說明
- 使用你的 API 金鑰初始化 Pinecone 連線。
- 連線到
"my-first-index"索引。 - 使用索引方法列印索引的重點統計資訊。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Set up the client with your API key
pc = Pinecone(api_key="____")
# Connect to your index
index = pc.____("____")
# Print the index statistics
print(index.____)