開始使用免費開始

更新向量中繼資料

這次你要在 datacamp-index 這個 Pinecone 索引中,練習以新的中繼資料更新向量。你會再次透過擷取該向量並檢查其中繼資料,來驗證更新是否成功。

本練習屬於課程

使用 Pinecone 構建 AI 應用

檢視課程

練習說明

  • 使用你的 API 金鑰初始化 Pinecone 連線。
  • 將 ID 為 "7" 的向量更新為以下中繼資料:"genre""thriller""year"2024
  • 抓取該向量以確認中繼資料是否已更新。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Initialize the Pinecone client with your API key
pc = Pinecone(api_key="____")

index = pc.Index('datacamp-index')

# Update the metadata of vector ID 7
____

# Fetch vector ID 7
fetched_vector = ____
print(fetched_vector)
編輯並執行程式碼