Introduction to Pinecone indexes
1. Introduction to Pinecone indexes
Hi, welcome to this course on Pinecone!2. Pinecone
Pinecone is a leading fully-managed vector database solution for building and scaling generative AI applications. Like other vector databases, it uses embeddings to store and retrieve data based on their semantic similarity, which is often integrated into chatbots, search engines, recommendation engines, or other AI systems. In this course, we'll learn to ingest vectors into Pinecone indexes, and retrieve and query these vectors to create systems very similar to what is used in common AI applications. Let's dive in!3. Indexes
Indexes are one of the core components of the Pinecone infrastructure. They are used to store vectors and serve queries and other manipulations over the vectors it contains. We can think of indexes like draws in a filing cabinet: each draw contains folders of information, and indexes contain records. Each vector is contained in a record, and the record also stores additional metadata that can be used in querying. It's also possible to create multiple indexes to house different datasets, like the different draws in the cabinet.4. Serverless vs. pod-based indexes
There are two types of indexes in Pinecone: serverless and pod-based indexes. In pod-based indexes, we choose one or more pre-configured units of hardware, called pods, in which to create the index. Depending on the pod type chosen, we get different amounts of storage, query latency, and query throughput. Serverless indexes don't require managing resources; instead, they scale automatically depending on usage. Serverless indexes run as a managed service on a cloud platform, like AWS, and the vectors are stored in blob storage on that platform. In many cases, serverless indexes result in lower costs than pod-based indexes, which is leading many organizations to switch to serverless. In this course, we'll be using serverless indexes, as these are accessible with Pinecone's free starter plan. However, much of what we'll learn will also apply to pod-based indexes.5. Creating a Pinecone API key
To work with Pinecone in Python, and complete the exercises in this course, you'll need to create a Pinecone account and API key. To create a Pinecone account, navigate to pinecone.io and sign up for a Starter account. Once registration is complete, head to the "API Keys" page, and copy your API key. This can be used throughout the course in the exercises, and won't be stored anywhere.6. Creating a serverless index
The first step to working with Pinecone in Python is to import the Pinecone API client. This client is used to configure the environment to work with the API, including specifying the API key. We also import ServerlessSpec, which is used for creating a serverless index. To create the index, we call the .create_index() method on the client and specify what we should name the index. When creating an index, we also need to specify the dimensionality of the vectors it will store; this index can store vectors represented by 1536 numbers. Finally, we indicate we want to create a serverless index by passing the ServerlessSpec function to the spec argument. Inside, we specify the cloud provider and region we wish to store the indexes in.7. Checking our indexes
We can verify our index was created by calling the .list_indexes() method on the client. There we have it!8. Let's practice!
Time to create your first Pinecone index!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.