POST
https://api.pinecone.io
/
indexes
/
create-for-model
# pip install --upgrade pinecone
from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

index_name = "docs-example"

index_model = pc.create_index_for_model(
    name=index_name,
    cloud="aws",
    region="us-east-1",
    embed={
        "model":"llama-text-embed-v2",
        "field_map":{"text": "chunk_text"}
    }
)

# Import specific classes to get type hints and autocompletions
from pinecone import CloudProvider, AwsRegion, IndexEmbed, EmbedModel

index_model = pc.create_index_for_model(
    name=index_name,
    cloud=CloudProvider.AWS,
    region=AwsRegion.US_EAST_1,
    embed=IndexEmbed(
        model=EmbedModel.Multilingual_E5_Large,
        field_map={"text": "chunk_text"},
        metric='cosine'
    )
)
{'deletion_protection': 'disabled',
 'dimension': 1024,
 'embed': {'dimension': 1024,
           'field_map': {'text': 'chunk_text'},
           'metric': 'cosine',
           'model': 'llama-text-embed-v2',
           'read_parameters': {'input_type': 'query', 'truncate': 'END'},
           'write_parameters': {'input_type': 'passage', 'truncate': 'END'}},
 'host': 'docs-example-govk0nt.svc.aped-4627-b74a.pinecone.io',
 'id': '9dabb7cb-ec0a-4e2e-b79e-c7c997e592ce',
 'metric': 'cosine',
 'name': 'docs-example',
 'spec': {'serverless': {'cloud': 'aws', 'region': 'us-east-1'}},
 'status': {'ready': True, 'state': 'Ready'},
 'tags': None}
# pip install --upgrade pinecone
from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

index_name = "docs-example"

index_model = pc.create_index_for_model(
    name=index_name,
    cloud="aws",
    region="us-east-1",
    embed={
        "model":"llama-text-embed-v2",
        "field_map":{"text": "chunk_text"}
    }
)

# Import specific classes to get type hints and autocompletions
from pinecone import CloudProvider, AwsRegion, IndexEmbed, EmbedModel

index_model = pc.create_index_for_model(
    name=index_name,
    cloud=CloudProvider.AWS,
    region=AwsRegion.US_EAST_1,
    embed=IndexEmbed(
        model=EmbedModel.Multilingual_E5_Large,
        field_map={"text": "chunk_text"},
        metric='cosine'
    )
)
{'deletion_protection': 'disabled',
 'dimension': 1024,
 'embed': {'dimension': 1024,
           'field_map': {'text': 'chunk_text'},
           'metric': 'cosine',
           'model': 'llama-text-embed-v2',
           'read_parameters': {'input_type': 'query', 'truncate': 'END'},
           'write_parameters': {'input_type': 'passage', 'truncate': 'END'}},
 'host': 'docs-example-govk0nt.svc.aped-4627-b74a.pinecone.io',
 'id': '9dabb7cb-ec0a-4e2e-b79e-c7c997e592ce',
 'metric': 'cosine',
 'name': 'docs-example',
 'spec': {'serverless': {'cloud': 'aws', 'region': 'us-east-1'}},
 'status': {'ready': True, 'state': 'Ready'},
 'tags': None}

Authorizations

Api-Key
string
header
required

An API Key is required to call Pinecone APIs. Get yours from the console.

Body

application/json

The desired configuration for the index and associated embedding model.

Response

201
application/json

The index has successfully been created for the embedding model.

The IndexModel describes the configuration and status of a Pinecone index.