Create a free pod index in Pinecone using Python

Pinecone documentation is quite good, but when I wanted to create a free pod index in Pinecone using Python I didn’t know what parameters I should supply.

Specifically, I couldn’t understand what values would be the values for environment and pod_type

After a bit of digging (looking at the WebUI) here is how to do it

from pinecone import Pinecone, PodSpec

pc = Pinecone(api_key='<<PINECONE_API_KEY>>')
pc.create_index(
    name="example-index", 
    dimension=1536, 
    metric="cosine", 
    spec=PodSpec(
        environment='gcp-starter', 
        pod_type='s1.x1'
    )
)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.