# pip install "pinecone[grpc]"
from pinecone.grpc import PineconeGRPC as Pinecone
from pinecone import ServerlessSpec
pc = Pinecone(api_key="YOUR_API_KEY")
pc.create_index(
name="docs-example1",
dimension=1536,
metric="cosine",
spec=ServerlessSpec(
cloud="aws",
region="us-east-1",
),
deletion_protection="disabled"
)
# Serverless index
{
"name": "example-serverless-index",
"vector_type": "dense",
"metric": "cosine",
"dimension": 1536,
"status": {
"ready": true,
"state": "Ready"
},
"host": "example-serverless-index-govk0nt.svc.aped-4627-b74a.pinecone.io",
"spec": {
"serverless": {
"region": "us-east-1",
"cloud": "aws"
}
},
"deletion_protection": "disabled",
"tags": {
"example": "tag"
}
}
# BYOC index
{
"name": "example-byoc-index",
"vector_type": "dense",
"metric": "cosine",
"dimension": 1536,
"status": {
"ready": true,
"state": "Ready"
},
"host": "example-byoc-index-govk0nt.svc.private.aped-4627-b74a.pinecone.io",
"spec": {
"byoc": {
"environment": "aws-us-east-1-b921"
}
},
"deletion_protection": "disabled",
"tags": {
"example": "tag"
}
}
Create a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more.
For guidance and examples, see Create an index.
# pip install "pinecone[grpc]"
from pinecone.grpc import PineconeGRPC as Pinecone
from pinecone import ServerlessSpec
pc = Pinecone(api_key="YOUR_API_KEY")
pc.create_index(
name="docs-example1",
dimension=1536,
metric="cosine",
spec=ServerlessSpec(
cloud="aws",
region="us-east-1",
),
deletion_protection="disabled"
)
# Serverless index
{
"name": "example-serverless-index",
"vector_type": "dense",
"metric": "cosine",
"dimension": 1536,
"status": {
"ready": true,
"state": "Ready"
},
"host": "example-serverless-index-govk0nt.svc.aped-4627-b74a.pinecone.io",
"spec": {
"serverless": {
"region": "us-east-1",
"cloud": "aws"
}
},
"deletion_protection": "disabled",
"tags": {
"example": "tag"
}
}
# BYOC index
{
"name": "example-byoc-index",
"vector_type": "dense",
"metric": "cosine",
"dimension": 1536,
"status": {
"ready": true,
"state": "Ready"
},
"host": "example-byoc-index-govk0nt.svc.private.aped-4627-b74a.pinecone.io",
"spec": {
"byoc": {
"environment": "aws-us-east-1-b921"
}
},
"deletion_protection": "disabled",
"tags": {
"example": "tag"
}
}
# pip install "pinecone[grpc]"
from pinecone.grpc import PineconeGRPC as Pinecone
from pinecone import ServerlessSpec
pc = Pinecone(api_key="YOUR_API_KEY")
pc.create_index(
name="docs-example1",
dimension=1536,
metric="cosine",
spec=ServerlessSpec(
cloud="aws",
region="us-east-1",
),
deletion_protection="disabled"
)
# Serverless index
{
"name": "example-serverless-index",
"vector_type": "dense",
"metric": "cosine",
"dimension": 1536,
"status": {
"ready": true,
"state": "Ready"
},
"host": "example-serverless-index-govk0nt.svc.aped-4627-b74a.pinecone.io",
"spec": {
"serverless": {
"region": "us-east-1",
"cloud": "aws"
}
},
"deletion_protection": "disabled",
"tags": {
"example": "tag"
}
}
# BYOC index
{
"name": "example-byoc-index",
"vector_type": "dense",
"metric": "cosine",
"dimension": 1536,
"status": {
"ready": true,
"state": "Ready"
},
"host": "example-byoc-index-govk0nt.svc.private.aped-4627-b74a.pinecone.io",
"spec": {
"byoc": {
"environment": "aws-us-east-1-b921"
}
},
"deletion_protection": "disabled",
"tags": {
"example": "tag"
}
}
The desired configuration for the index.
The configuration needed to create a Pinecone index.
The index has been successfully created.
The IndexModel describes the configuration and status of a Pinecone index.
Was this page helpful?