CommencerCommencer gratuitement

Your first Pinecone index

With your Pinecone client initialized, you're all set to begin creating an index! Indexes are used to store records, including the vectors and associated metadata, as well as serving queries and other manipulations. As you progress through the course, you'll see how these different steps build up to a modern AI system built on a vector database.

If you accidentally create a valid index that doesn't meet the specifications detailed in the instructions, you'll need to add the following code before your .create_index() code to delete it and re-create it:

pc.delete_index('my-first-index')

The Pinecone class has already been imported for you.

Cet exercice fait partie du cours

Vector Databases for Embeddings with Pinecone

Afficher le cours

Instructions

  • Import the ServerlessSpec class from pinecone.
  • Initialize the Pinecone connection using your API key.
  • Create a serverless index called "my-first-index" to hold vectors with 256 dimensions, and configure the index for the 'aws' cloud platform in the 'us-east-1' region.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# 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='____'
    )
)
Modifier et exécuter le code