開始使用免費開始

查詢命名空間

你已經建立了獨立的命名空間並導入多租戶架構,現在該收穫成果了!在本練習中,你將查詢其中一個新命名空間,只在完整索引中的特定區段進行搜尋。

本練習屬於課程

使用 Pinecone 構建 AI 應用

檢視課程

練習說明

  • 以你的 API 金鑰初始化 Pinecone 連線。
  • 使用提供的 vector 查詢 "namespace1",並回傳排名前面「3」筆結果。

動手互動練習

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

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

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

# Query namespace1 with the vector provided
query_result = ____
print(query_result)
編輯並執行程式碼