開始使用免費開始

你的第一個 Pinecone 索引

你已經完成 Pinecone 用戶端的初始化,現在可以開始建立一個索引(index)了!索引用來儲存記錄,包括向量(vectors)及其對應的中繼資料(metadata),也用來服務查詢(queries)與其他操作。隨著課程進行,你會看到這些步驟如何組合成以向量資料庫(vector database)為基礎的現代 AI 系統。

Pinecone 類別已替你匯入。

本練習屬於課程

使用 Pinecone 構建 AI 應用

檢視課程

練習說明

  • pinecone 匯入 ServerlessSpec 類別。
  • 使用你的 API 金鑰初始化 Pinecone 連線。
  • 建立一個名為 "my-first-index" 的無伺服器索引,用來存放 256 維度的向量,並將索引設定為使用 'aws' 雲端平台與 'us-east-1' 區域。

動手互動練習

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

# Import ServerlessSpec
from pinecone import ____

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

# Create your Pinecone index
pc.____(
    name="____",
    dimension=____,
    spec=____(
        cloud='____',
        region='____'
    )
)
編輯並執行程式碼