Models¶
All public model types returned by SDK methods. Every model is an immutable
msgspec.Struct subclass — fields are accessed as plain attributes
(e.g. idx.name).
Index Models¶
- class pinecone.models.indexes.index.IndexModel(*, name, status, schema, deployment, deletion_protection, host=None, read_capacity=None, tags=None, private_host=None, source_collection=None, source_backup_id=None, cmek_id=None)[source]¶
Bases:
StructResponse model for a Pinecone index (2026-07 API).
- Variables:
name (str) – The name of the index.
host (str | None) – The hostname where this index is served, or
Noneif the index is still initializing and has not yet been assigned a host.private_host (str | None) – The private-endpoint hostname for this index when the project has Private Endpoints configured, or
Noneotherwise. Clients inside a VPC should connect to this host instead ofhost.status (pinecone.models.indexes.index.IndexStatus) – Current status of the index.
schema (pinecone.models.indexes.schema.IndexSchema) – Field-level schema definition (vector, text, and metadata fields), keyed by field name.
deployment (pinecone.models.indexes.deployment.ManagedDeployment | pinecone.models.indexes.deployment.PodDeployment | pinecone.models.indexes.deployment.ByocDeployment) – Deployment configuration — a
ManagedDeployment,PodDeployment, orByocDeployment, discriminated ondeployment_type.deletion_protection (str) – Whether deletion protection is enabled (
"enabled"or"disabled").read_capacity (pinecone.models.indexes.read_capacity.ReadCapacityOnDemandResponse | pinecone.models.indexes.read_capacity.ReadCapacityDedicatedResponse | None) – Read capacity configuration and status, or
Noneif the server response omits it.tags (dict[str, str] | None) – User-defined key-value tags attached to the index, or
Noneif no tags are set (the API returns"tags": nullrather than{}).source_collection (str | None) – Name of the collection this index was created from, or
None.source_backup_id (str | None) – ID of the backup this index was restored from, or
None.cmek_id (str | None) – ID of the customer-managed encryption key protecting this index, or
Noneif CMEK is not configured.
- Parameters:
name (str)
status (IndexStatus)
schema (IndexSchema)
deployment (ManagedDeployment | PodDeployment | ByocDeployment)
deletion_protection (str)
host (str | None)
read_capacity (ReadCapacityOnDemandResponse | ReadCapacityDedicatedResponse | None)
private_host (str | None)
source_collection (str | None)
source_backup_id (str | None)
cmek_id (str | None)
- deployment: ManagedDeployment | PodDeployment | ByocDeployment¶
- read_capacity: ReadCapacityOnDemandResponse | ReadCapacityDedicatedResponse | None¶
- schema: IndexSchema¶
- status: IndexStatus¶
- to_dict()[source]¶
Return a plain dict representation, recursively converting nested fields.
Nested structs (
status,schema,deployment,read_capacity) become plain dicts. Tagged-union members include their discriminator key (deployment_type,mode,type); legacy untyped schema fields are emitted without atypekey, matching the wire format. Optional fields that areNoneare included with theirNonevalues.
- class pinecone.models.indexes.list.IndexList(indexes)[source]¶
Bases:
objectWrapper around a list of IndexModel with convenience methods.
- Parameters:
indexes (list[IndexModel])
- __init__(indexes)[source]¶
- Parameters:
indexes (list[IndexModel])
- Return type:
None
- property indexes: list[IndexModel]¶
Return the list of indexes.
- to_dict()[source]¶
Return the list as a serializable dict.
- Returns:
A dict with a
"data"key containing a list of index dicts, each produced byIndexModel.to_dict().- Return type:
Examples
>>> from pinecone import Pinecone >>> pc = Pinecone(api_key="your-api-key") >>> indexes = pc.list_indexes() >>> indexes.to_dict() {'data': [{'name': 'movie-recommendations', ...}, {'name': 'product-search', ...}]}
- class pinecone.models.indexes.index.IndexStatus(*, ready, state)[source]¶
Bases:
StructDictMixin,StructStatus of an index.
- Variables:
- Parameters:
- class pinecone.models.indexes.specs.ServerlessSpec(*, cloud, region, read_capacity=None, schema=None)[source]¶
Bases:
StructDictMixin,StructServerless index deployment spec.
- Variables:
cloud (str) – Cloud provider (e.g.
"aws","gcp","azure").region (str) – Cloud region (e.g.
"us-east-1","eu-west-1").read_capacity (dict[str, Any] | None) – Optional read capacity configuration (OnDemand or Dedicated), or
Noneto use the default.schema (dict[str, Any] | None) – Optional metadata schema configuration mapping field names to their config, or
Nonefor no schema.
- Parameters:
- class pinecone.models.indexes.specs.PodSpec(*, environment, pod_type='p1.x1', replicas=1, shards=1, pods=1, metadata_config=None, source_collection=None)[source]¶
Bases:
StructDictMixin,StructPod-based index deployment spec.
- Variables:
environment (str) – Deployment environment (e.g.
"us-east-1-aws").pod_type (str) – Pod type and size (default:
"p1.x1").replicas (int) – Number of replicas (default: 1).
shards (int) – Number of shards (default: 1).
pods (int) – Total number of pods (default: 1).
metadata_config (dict[str, Any] | None) – Configuration for metadata indexing, or
Noneto use the default configuration.source_collection (str | None) – Name of a collection to create the index from, or
Noneif creating an empty index.
- Parameters:
- class pinecone.models.indexes.specs.ByocSpec(*, environment, read_capacity=None, schema=None)[source]¶
Bases:
StructDictMixin,StructBring-your-own-cloud index deployment spec.
- Variables:
- Parameters:
- class pinecone.models.indexes.specs.IntegratedSpec(*, cloud, region, embed)[source]¶
Bases:
StructDictMixin,StructIntegrated (model-backed) index deployment spec.
Wraps cloud/region and embed config into a single convenience object. On the wire the
embedconfig is sent at the top level alongside the serverless spec — serialization handles the split.- Variables:
cloud (str) – Cloud provider (e.g.
"aws","gcp","azure").region (str) – Cloud region (e.g.
"us-east-1").embed (pinecone.models.indexes.specs.EmbedConfig) – Embedding model configuration.
- Parameters:
cloud (str)
region (str)
embed (EmbedConfig)
- embed: EmbedConfig¶
- class pinecone.models.indexes.specs.EmbedConfig(*, model, field_map, dimension=None, metric=None, read_parameters=None, write_parameters=None)[source]¶
Bases:
StructConfiguration for integrated (model-backed) embedding.
- Variables:
model (str) – Name of the embedding model (e.g.
"multilingual-e5-large").field_map (dict[str, str]) – Maps document field names to embedding inputs (e.g.
{"text": "my_text_field"}).dimension (int | None) – Optional dimension hint or override for the embedding model. When absent the backend infers the dimension from the model.
metric (str | None) – Similarity metric override, or
Noneto use the model default.read_parameters (dict[str, Any] | None) – Optional read-time model parameters.
write_parameters (dict[str, Any] | None) – Optional write-time model parameters.
- Parameters:
- class pinecone.models.indexes.requests.CreateIndexRequest(*, schema, name=None, deployment=None, read_capacity=None, deletion_protection=None, tags=None, source_collection=None, source_backup_id=None, cmek_id=None)[source]¶
Bases:
StructRequest model for creating an index.
- Variables:
schema (dict[str, Any] | pinecone.models.indexes.schema.IndexSchema) – Index schema definition (required). Maps field names to searched-field configurations —
dense_vector,sparse_vector, orstringwithfull_text_search.name (str | None) – Optional name for the index. Auto-generated by the server if omitted.
deployment (dict[str, Any] | pinecone.models.indexes.deployment.ManagedDeployment | pinecone.models.indexes.deployment.PodDeployment | pinecone.models.indexes.deployment.ByocDeployment | None) – Optional deployment configuration, discriminated on
deployment_type(managed|pod|byoc). Defaults server-side to managed on AWSus-east-1.read_capacity (dict[str, Any] | None) – Optional read capacity configuration.
deletion_protection (str | None) – Optional deletion protection setting (
"enabled"or"disabled").tags (dict[str, str] | None) – Optional key-value tags for the index.
source_collection (str | None) – Optional name of an existing collection to create the index from.
source_backup_id (str | None) – Optional ID of an existing backup to create the index from.
cmek_id (str | None) – Optional customer-managed encryption key ID (valid for managed/BYOC indexes without full-text search fields).
- Raises:
PineconeValueError – If
deploymentnames adeployment_typethat is not one of the discriminator values. The comparison is case-sensitive, so"MANAGED"is rejected.- Parameters:
schema (dict[str, Any] | IndexSchema)
name (str | None)
deployment (dict[str, Any] | ManagedDeployment | PodDeployment | ByocDeployment | None)
deletion_protection (str | None)
source_collection (str | None)
source_backup_id (str | None)
cmek_id (str | None)
- deployment: dict[str, Any] | ManagedDeployment | PodDeployment | ByocDeployment | None¶
- schema: dict[str, Any] | IndexSchema¶
- class pinecone.models.indexes.requests.ConfigureIndexRequest(*, schema=None, deployment=None, read_capacity=None, deletion_protection=None, tags=None)[source]¶
Bases:
StructRequest model for configuring an existing index.
All fields are optional — only provided fields are updated, and unset fields are omitted from the PATCH body entirely.
- Variables:
schema (dict[str, Any] | pinecone.models.indexes.schema.IndexSchema | None) – Optional schema updates (
semantic_textfield parameters only).deployment (dict[str, Any] | None) – Optional deployment updates for pod-based indexes (
replicasand/orpod_type; nodeployment_typekey).read_capacity (dict[str, Any] | None) – Optional updated read capacity configuration.
deletion_protection (str | None) – Optional updated deletion protection setting.
tags (dict[str, str] | None) – Optional tag updates. Merged with existing tags; set a value to
""to delete that tag key.
- Parameters:
Index Schema Models¶
IndexModel.schema describes every field in the index. These types replace
the removed IndexModel.dimension, .metric, .vector_type and
.embed attributes.
- class pinecone.models.indexes.schema.IndexSchema(*, fields)[source]¶
Bases:
StructIndex schema definition.
The schema defines all fields in the index, including vector, text, and metadata fields.
- Variables:
fields (dict[str, pinecone.models.indexes.schema.DenseVectorField | pinecone.models.indexes.schema.SparseVectorField | pinecone.models.indexes.schema.SemanticTextField | pinecone.models.indexes.schema.StringField | pinecone.models.indexes.schema.StringListField | pinecone.models.indexes.schema.BooleanField | pinecone.models.indexes.schema.IntegerField | pinecone.models.indexes.schema.FloatField | pinecone.models.indexes.schema.LegacyMetadataField]) – Mapping of field name to its typed field definition.
- Parameters:
fields (dict[str, DenseVectorField | SparseVectorField | SemanticTextField | StringField | StringListField | BooleanField | IntegerField | FloatField | LegacyMetadataField])
- fields: dict[str, DenseVectorField | SparseVectorField | SemanticTextField | StringField | StringListField | BooleanField | IntegerField | FloatField | LegacyMetadataField]¶
- pinecone.models.indexes.schema.IndexSchemaField = pinecone.models.indexes.schema.DenseVectorField | pinecone.models.indexes.schema.SparseVectorField | pinecone.models.indexes.schema.SemanticTextField | pinecone.models.indexes.schema.StringField | pinecone.models.indexes.schema.StringListField | pinecone.models.indexes.schema.BooleanField | pinecone.models.indexes.schema.IntegerField | pinecone.models.indexes.schema.FloatField | pinecone.models.indexes.schema.LegacyMetadataField¶
Union of all schema field types appearing in index responses. Use this as the decode target when parsing a single field from JSON.
- class pinecone.models.indexes.schema.DenseVectorField(*, dimension, metric, description=None)[source]¶
Bases:
StructDense vector field definition.
Dense vectors are fixed-length floating-point vectors used for approximate nearest-neighbor (ANN) similarity search.
- Variables:
- Parameters:
Note
The
typefield is automatically set to"dense_vector"by msgspec’s tagged union system and should not be included explicitly.
- class pinecone.models.indexes.schema.SparseVectorField(*, description=None)[source]¶
Bases:
StructSparse vector field definition.
Sparse vectors represent most values as zero and are stored as (indices, values) pairs. Useful for keyword-based search (e.g. BM25).
- Variables:
description (str | None) – Optional human-readable description of the field.
- Parameters:
description (str | None)
Note
The
typefield is automatically set to"sparse_vector"by msgspec’s tagged union system.
- class pinecone.models.indexes.schema.SemanticTextField(*, model, metric=None, description=None, read_parameters=None, write_parameters=None)[source]¶
Bases:
StructSemantic text field with integrated embedding.
Semantic text fields automatically embed text using a specified model, eliminating the need to generate embeddings separately. In the
2026-07API this field type cannot be declared at index creation; it appears in responses for indexes that already carry one (including indexes created viacreate_index_for_model).- Variables:
model (str) – Embedding model name (e.g.
"multilingual-e5-large").metric (str | None) – Distance metric (
"cosine","dotproduct", or"euclidean"), orNoneto use the model default.description (str | None) – Optional human-readable description of the field.
read_parameters (dict[str, Any] | None) – Parameters forwarded to the embedding model on read operations (e.g.
{"input_type": "query"}), orNone.write_parameters (dict[str, Any] | None) – Parameters forwarded to the embedding model on write operations (e.g.
{"input_type": "passage"}), orNone.
- Parameters:
Note
The
typefield is automatically set to"semantic_text"by msgspec’s tagged union system.
- class pinecone.models.indexes.schema.StringField(*, description=None, filterable=False, full_text_search=None)[source]¶
Bases:
StructString field for full-text search or metadata filtering.
In responses, string fields configured for full-text search include a
full_text_searchobject; string fields used for metadata filtering only include afilterableflag. At index creation, a string field must includefull_text_search— metadata-only fields are not declared in the schema (pass them as record metadata instead).- Variables:
description (str | None) – Optional human-readable description of the field.
filterable (bool) – Whether the field can be used in metadata filters. Defaults to
False. On create a string field is either searchable or filterable, never both: passingfilterable=Truealongsidefull_text_searchmakes the server keep the filter and discard the search configuration, and it reports no error for doing so.full_text_search (pinecone.models.indexes.schema.FullTextSearchConfig | None) – Full-text search configuration. Presence (even an empty config) indicates the field is full-text searchable; absence (
None) means it is not.
- Parameters:
description (str | None)
filterable (bool)
full_text_search (FullTextSearchConfig | None)
Note
The
typefield is automatically set to"string"by msgspec’s tagged union system.- full_text_search: FullTextSearchConfig | None¶
- class pinecone.models.indexes.schema.StringListField(*, description=None, filterable=False)[source]¶
Bases:
StructList-of-strings field for metadata filtering.
Stores a list of strings per record — useful for tag-style metadata (e.g.
["sci-fi", "mystery"]) that should be filterable against individual elements. Not declared at index creation; appears in responses for fields indexed automatically at upsert time.- Variables:
- Parameters:
Note
The
typefield is automatically set to"string_list"by msgspec’s tagged union system.
- class pinecone.models.indexes.schema.BooleanField(*, description=None, filterable=False)[source]¶
Bases:
StructBoolean field for metadata filtering.
Not declared at index creation; appears in responses for fields indexed automatically at upsert time.
- Variables:
- Parameters:
Note
The
typefield is automatically set to"boolean"by msgspec’s tagged union system.
- class pinecone.models.indexes.schema.IntegerField(*, description=None, filterable=False)[source]¶
Bases:
StructLegacy integer field. Response-only — not accepted on create.
Numeric values are normalised to
floatat upsert time in current indexes;integerappears only in responses for indexes that pre-date that normalisation.Important
The
2026-07create-index schema has nointegerfield type. Sending one is rejected by the server with a422whose body is plain text, not a structured API error. A describe-then-create round-trip must therefore drop integer fields (numeric metadata is indexed for filtering automatically at upsert time) or re-declare them asfloat.SchemaBuilderoffers no method for this type and refuses{"type": "integer"}passed throughadd_custom_field(), so the failure surfaces client-side with an explanation.- Variables:
- Parameters:
Note
The
typefield is automatically set to"integer"by msgspec’s tagged union system.
- class pinecone.models.indexes.schema.FloatField(*, description=None, filterable=False)[source]¶
Bases:
StructNumeric (float) field for metadata filtering.
Numeric fields store double-precision floating-point values and can be used for range filtering (e.g.
year >= 2020). Create schemas have no separate integer type — integers are stored and filtered as floats, andfloatis the only numeric type name the API accepts. Not declared at index creation on managed or BYOC indexes; appears in responses for fields indexed automatically at upsert time.- Variables:
- Parameters:
Note
The
typefield is automatically set to"float"by msgspec’s tagged union system.
- class pinecone.models.indexes.schema.LegacyMetadataField(*, filterable)[source]¶
Bases:
StructUntyped metadata field from indexes that pre-date typed schemas.
The original data type of the field (string, float, boolean, etc.) was not recorded — only the
filterableflag is available. On the wire these fields carry notypekey. This field type never appears in new indexes.- Variables:
filterable (bool) – Whether the field is indexed for metadata filtering.
- Parameters:
filterable (bool)
Note
msgspec requires a discriminator for union decoding, so this class carries the internal tag
"__untyped__". The tag is an SDK artifact: it is stripped byIndexSchema.to_dict()and never appears in API traffic, butmsgspec.json.encodeoutput of this class does include it.
- class pinecone.models.indexes.schema.FullTextSearchConfig(*, language=None, stemming=None, stop_words=None, ngram=None)[source]¶
Bases:
StructFull-text search configuration for a string field.
Presence of this object on a
StringFieldindicates the field is full-text searchable; absence means it is not. All keys are optional on create — an empty config (FullTextSearchConfig()) is valid and requests the server defaults. Responses always carrylanguage,stemming, andstop_words.- Variables:
language (str | None) – Language used for text analysis, as a two-letter code or English name (e.g.
"en"or"english"). WhenNone, the server applies its default ("en").stemming (bool | None) – Whether to stem tokens to root form during indexing. When
None, the server applies its default (False).stop_words (bool | None) – Whether to filter stop words during indexing. Requires
stemming=True. WhenNone, the server applies its default (False).ngram (pinecone.models.indexes.schema.NgramConfig | None) – Character n-gram tokenization configuration, or
Nonefor word-based tokenization. Cannot be combined withstemmingorstop_words.
- Parameters:
language (str | None)
stemming (bool | None)
stop_words (bool | None)
ngram (NgramConfig | None)
- ngram: NgramConfig | None¶
- class pinecone.models.indexes.schema.NgramConfig(*, min_gram, max_gram, prefix_only=False)[source]¶
Bases:
StructCharacter n-gram tokenization configuration for a string field.
When present, the field is tokenized into character n-grams instead of words (useful for substring matching and autocomplete). Cannot be combined with
stemmingorstop_words.- Variables:
- Parameters:
Index Deployment Models¶
IndexModel.deployment describes where and how the index runs. These types
replace the removed IndexSpec, ServerlessSpecInfo, PodSpecInfo and
ByocSpecInfo.
- pinecone.models.indexes.deployment.IndexDeployment = pinecone.models.indexes.deployment.ManagedDeployment | pinecone.models.indexes.deployment.PodDeployment | pinecone.models.indexes.deployment.ByocDeployment¶
Union of all deployment variants, dispatched on the
deployment_typefield.
- class pinecone.models.indexes.deployment.ManagedDeployment(*, cloud, region, environment=None)[source]¶
Bases:
StructManaged (serverless) deployment configuration.
Serverless indexes scale automatically and are billed per usage. This deployment type also covers full-text search indexes.
- Variables:
cloud (str) – Cloud provider —
"aws","gcp", or"azure".region (str) – Cloud region (e.g.
"us-east-1").environment (str | None) – The internal environment (cell) hosting the index, derived from
cloudandregion. Response-only and informational — it cannot be set on create and is not stable API surface.
- Parameters:
Note
The
deployment_typefield is automatically set to"managed"by msgspec’s tagged union system.
- class pinecone.models.indexes.deployment.PodDeployment(*, environment, pod_type, replicas, shards)[source]¶
Bases:
StructPod-based deployment configuration.
All properties are required on create — omitting
replicasorshardsis rejected with a422. Responses always carry all of them as well.- Variables:
environment (str) – Environment where the index is hosted (e.g.
"us-east1-gcp").pod_type (str) – Pod type — one of
s1,p1, orp2appended with.and one ofx1,x2,x4, orx8(e.g."p1.x1").replicas (int) – Number of replicas. Replicas duplicate the index for higher availability and throughput.
shards (int) – Number of shards. Shards split data across multiple pods to fit more data into an index.
- Parameters:
Note
The
deployment_typefield is automatically set to"pod"by msgspec’s tagged union system.
- class pinecone.models.indexes.deployment.ByocDeployment(*, environment)[source]¶
Bases:
StructBring-your-own-compute (BYOC) deployment configuration.
BYOC indexes run in customer-managed infrastructure.
- Variables:
environment (str) – BYOC environment identifier (e.g.
"aws-us-east-1-b921").- Parameters:
environment (str)
Note
The
deployment_typefield is automatically set to"byoc"by msgspec’s tagged union system.
Read Capacity Models¶
IndexModel.read_capacity replaces the removed
IndexSpec.serverless.read_capacity.
- pinecone.models.indexes.read_capacity.ReadCapacityResponse = pinecone.models.indexes.read_capacity.ReadCapacityOnDemandResponse | pinecone.models.indexes.read_capacity.ReadCapacityDedicatedResponse¶
Union of read-capacity response variants, dispatched on the
modefield.
- class pinecone.models.indexes.read_capacity.ReadCapacityOnDemandResponse(*, status)[source]¶
Bases:
StructOn-demand read capacity in API responses.
- Variables:
status (pinecone.models.indexes.read_capacity.ReadCapacityStatus) – Current provisioning status.
- Parameters:
status (ReadCapacityStatus)
Note
The
modefield is automatically set to"OnDemand"by msgspec’s tagged-union system.- status: ReadCapacityStatus¶
- class pinecone.models.indexes.read_capacity.ReadCapacityDedicatedResponse(*, dedicated, status)[source]¶
Bases:
StructDedicated read capacity in API responses.
- Variables:
dedicated (pinecone.models.indexes.read_capacity.ReadCapacityDedicatedConfig) – Dedicated capacity configuration details.
status (pinecone.models.indexes.read_capacity.ReadCapacityStatus) – Current provisioning status.
- Parameters:
dedicated (ReadCapacityDedicatedConfig)
status (ReadCapacityStatus)
Note
The
modefield is automatically set to"Dedicated"by msgspec’s tagged-union system.- dedicated: ReadCapacityDedicatedConfig¶
- status: ReadCapacityStatus¶
- class pinecone.models.indexes.read_capacity.ReadCapacityDedicatedConfig(*, node_type, scaling, manual=None)[source]¶
Bases:
StructDedicated read-capacity configuration details.
- Variables:
node_type (str) – The type of machines to use —
"b1"or"t1"(t1includes increased processing power and memory).scaling (str) – Scaling strategy (e.g.
"Manual").manual (pinecone.models.indexes.read_capacity.ScalingConfigManual | None) – Manual scaling configuration, present when
scaling="Manual".
- Parameters:
node_type (str)
scaling (str)
manual (ScalingConfigManual | None)
- manual: ScalingConfigManual | None¶
- class pinecone.models.indexes.read_capacity.ReadCapacityStatus(*, state, current_shards=None, current_replicas=None, error_message=None)[source]¶
Bases:
StructRead capacity provisioning status.
- Variables:
state (str) – Current provisioning state —
"Ready"most of the time,"Scaling"after a recent replica/shard change,"Migrating"while moving to a new node type, or"Error"(seeerror_message).current_shards (int | None) – Current number of active shards.
Nonefor an index with on-demand read capacity, which has no fixed shard count.current_replicas (int | None) – Current number of active replicas.
Nonefor an index with on-demand read capacity, which has no fixed replica count.error_message (str | None) – Message describing a read-capacity configuration issue;
Noneunlessstateis"Error".
- Parameters:
Vector Models¶
- class pinecone.models.vectors.vector.Vector(id, values=<factory>, sparse_values=None, metadata=None)[source]¶
Bases:
DictLikeStruct,StructA stored vector with optional sparse values and metadata.
At least one of
valuesorsparse_valuesmust be populated.valuesis not required on its own: a sparse-only vector leaves it empty, and an empty dense array is still sent so the pair reads as populated.- Variables:
id (str) – Unique identifier for the vector. ASCII, 1 to 512 characters, no NUL.
values (list[float]) – Dense vector values as a list of floats. Empty for a sparse-only vector.
sparse_values (SparseValues | None) – Sparse vector component, or
Noneif the vector has no sparse values.metadata (dict[str, Any] | None) – User-defined metadata key-value pairs, or
Noneif no metadata is attached. Each value must be a string, a number, a boolean, or a list of strings — nested objects and lists with a non-string element are rejected. A key whose value isNoneis dropped by the server rather than rejected. Keys may not begin with$, which is reserved for filter operators; every other key is accepted, including empty and non-ASCII keys. The field is typedAnyrather than narrowed to that grammar so that decoding a response never fails on a value shape the server has started returning; requests are validated on the way out instead.
- Raises:
PineconeValueError – If neither
valuesnorsparse_valuesis populated.- Parameters:
- sparse_values: SparseValues | None¶
- class pinecone.models.vectors.sparse.SparseValues(indices, values)[source]¶
Bases:
DictLikeStruct,StructSparse vector representation with indices and values.
- Variables:
- Parameters:
- class pinecone.models.vectors.responses.QueryResponse(*, matches=<factory>, namespace='', usage=None, response_info=None)[source]¶
Bases:
DictLikeStruct,StructResponse from a query operation.
- Variables:
matches (list[ScoredVector]) – List of scored vectors as returned by the API (ordered from most similar to least similar).
namespace (str) – Namespace that was queried. Defaults to
""(the default namespace).usage (Usage | None) – Read unit usage for this query, or
Noneif not reported.response_info (ResponseInfo | None) – HTTP response metadata (request ID, LSN values), or
Noneif not populated.
- Parameters:
matches (list[ScoredVector])
namespace (str | None)
usage (Usage | None)
response_info (ResponseInfo | None)
- response_info: ResponseInfo | None¶
- class pinecone.models.vectors.responses.FetchResponse(*, vectors=<factory>, namespace='', usage=None, response_info=None)[source]¶
Bases:
DictLikeStruct,StructResponse from a fetch operation.
- Variables:
vectors (dict[str, Vector]) – Mapping of vector ID to
Vectorfor each fetched vector.namespace (str) – Namespace the vectors were fetched from.
usage (Usage | None) – Read unit usage for this fetch, or
Noneif not reported.response_info (ResponseInfo | None) – HTTP response metadata (request ID, LSN values), or
Noneif not populated.
- Parameters:
namespace (str)
usage (Usage | None)
response_info (ResponseInfo | None)
- response_info: ResponseInfo | None¶
- class pinecone.models.vectors.responses.FetchByMetadataResponse(*, vectors=<factory>, namespace='', usage=None, pagination=None, response_info=None)[source]¶
Bases:
DictLikeStruct,StructResponse from a fetch-by-metadata operation.
- Variables:
vectors (dict[str, Vector]) – Mapping of vector ID to Vector for each fetched vector.
namespace (str) – Namespace the vectors were fetched from.
usage (Usage | None) – Read unit usage, or None if not reported.
pagination (Pagination | None) – Pagination token for the next page, or None if this is the last page.
response_info (ResponseInfo | None) – HTTP response metadata (request ID, LSN values), or
Noneif not populated.
- Parameters:
namespace (str)
usage (Usage | None)
pagination (Pagination | None)
response_info (ResponseInfo | None)
- response_info: ResponseInfo | None¶
- class pinecone.models.vectors.responses.UpsertResponse(*, upserted_count, response_info=None, total_item_count=0, failed_item_count=0, total_batch_count=0, successful_batch_count=0, failed_batch_count=0, errors=<factory>)[source]¶
Bases:
DictLikeStruct,StructResponse from an upsert operation.
- Variables:
upserted_count (int) – Number of vectors successfully upserted. For non-batched calls this equals
total_item_count.response_info (ResponseInfo | None) – HTTP response metadata (request ID, LSN values), or
Noneif not populated.total_item_count (int) – Total number of items submitted. Defaults to
0for non-batched calls.failed_item_count (int) – Number of items in failed batches. Defaults to
0.total_batch_count (int) – Total number of batches executed. Defaults to
0for non-batched calls.successful_batch_count (int) – Number of batches that succeeded. Defaults to
0.failed_batch_count (int) – Number of batches that failed. Defaults to
0.errors (list[BatchError]) – Per-batch error details. Empty for non-batched calls or when all batches succeed.
- Parameters:
For non-batched calls, all counter fields default to
0anderrorsdefaults to[]; the only meaningful field isupserted_count.For batched calls (
batch_sizeset on the upsert method), the caller can use the partial-success API:>>> response = idx.upsert(vectors=[...], batch_size=100) >>> response.upserted_count 900 >>> response.has_errors True >>> response.failed_item_count 100 >>> retry = idx.upsert(vectors=response.failed_items, batch_size=100)
- response_info: ResponseInfo | None¶
- class pinecone.models.vectors.responses.UpdateResponse(*, matched_records=None, response_info=None)[source]¶
Bases:
DictLikeStruct,StructResponse from an update operation.
- Variables:
matched_records (int | None) – Number of records matched by the update, or
Noneif not reported by the server.response_info (ResponseInfo | None) – HTTP response metadata (request ID, LSN values), or
Noneif not populated.
- Parameters:
matched_records (int | None)
response_info (ResponseInfo | None)
- response_info: ResponseInfo | None¶
- class pinecone.models.vectors.responses.ListResponse(*, vectors=<factory>, pagination=None, namespace='', usage=None, response_info=None)[source]¶
Bases:
StructDictMixin,StructResponse from a list vectors operation.
- Variables:
vectors (list[ListItem]) – List of vector ID entries in this page.
pagination (Pagination | None) – Pagination token for fetching the next page, or
Noneif there are no more results.namespace (str) – Namespace the vectors were listed from.
usage (Usage | None) – Read unit usage for this list call, or
Noneif not reported.response_info (ResponseInfo | None) – HTTP response metadata (request ID, LSN values), or
Noneif not populated.
- Parameters:
vectors (list[ListItem])
pagination (Pagination | None)
namespace (str)
usage (Usage | None)
response_info (ResponseInfo | None)
- response_info: ResponseInfo | None¶
- class pinecone.models.vectors.responses.DescribeIndexStatsResponse(*, namespaces=<factory>, dimension=None, index_fullness=0.0, total_vector_count=0, metric=None, vector_type=None, memory_fullness=None, storage_fullness=None, response_info=None)[source]¶
Bases:
StructDictMixin,StructResponse from a describe index stats operation.
- Variables:
namespaces (dict[str, NamespaceSummary]) – Mapping of namespace name to
NamespaceSummaryfor each namespace in the index.dimension (int | None) – Dimensionality of vectors in the index, or
Noneif not yet determined.index_fullness (float) – Fraction of the index capacity used, from 0.0 to 1.0.
total_vector_count (int) – Total number of vectors across all namespaces.
metric (str | None) – Distance metric of the index (e.g.
"cosine"), orNoneif not reported.vector_type (str | None) – Type of vectors stored (e.g.
"dense"), orNoneif not reported.memory_fullness (float | None) – Fraction of memory capacity used, or
Noneif not reported.storage_fullness (float | None) – Fraction of storage capacity used, or
Noneif not reported.response_info (ResponseInfo | None) – HTTP response metadata (request ID, LSN values), or
Noneif not populated.
- Parameters:
- response_info: ResponseInfo | None¶
- class pinecone.models.vectors.responses.UpsertRecordsResponse(*, record_count, response_info=None)[source]¶
Bases:
StructDictMixin,StructResponse from an upsert_records operation.
- Variables:
record_count (int) – Number of records submitted by the caller. This is a client-side count, not a server-confirmed count.
response_info (ResponseInfo | None) – HTTP response metadata (request ID, LSN values), or
Noneif not populated.
- Parameters:
record_count (int)
response_info (ResponseInfo | None)
- response_info: ResponseInfo | None¶
- class pinecone.models.response_info.BatchResponseInfo(*, lsn_reconciled=None, lsn_committed=None)[source]¶
Bases:
StructDictMixin,StructAggregate durability signal across a multi-request batch operation.
A batch operation fans out into N underlying HTTP requests, each with its own response headers.
BatchResponseInfocollapses the reconciliation signal across those requests into a single object that mirrors the read-your-writes API surface ofResponseInfo.Does not carry
raw_headersorrequest_id— there is no single source HTTP response to point at. Individual sub-request diagnostics are available viaBatchError.errorfor failed batches.- Variables:
lsn_reconciled (int | None) – Maximum
lsn_reconciledobserved across successful sub-batches, orNonewhen no successful batch reported this header. Useis_reconciled()for durability checks.lsn_committed (int | None) – Maximum
lsn_committedobserved across successful sub-batches, orNonewhen no successful batch reported this header.
- Parameters:
Examples
from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") index = pc.index(name="articles-en") documents = [ {"_id": f"article-{i:05d}", "content": f"Article {i}"} for i in range(500) ] result = index.documents.batch_upsert( namespace="articles-en", documents=documents, ) if result.response_info is not None: target_lsn = result.response_info.lsn_committed if result.response_info.is_reconciled(target_lsn): pass # all writes durable through target_lsn
- class pinecone.models.response_info.ResponseInfo(*, raw_headers=<factory>)[source]¶
Bases:
StructDictMixin,StructHTTP response metadata carrier.
Stores every HTTP response header returned by the server (keys lowercased) plus typed convenience properties for the headers the SDK promotes to first-class fields.
- Variables:
raw_headers (dict[str, str]) – All HTTP response headers, keys normalized to lowercase. Defaults to an empty dict. Use this to read any header the server returns, including headers not surfaced by the typed properties below. Prefer the typed properties when available — wire header names may change, but property semantics are stable.
request_id (str | None) – Server-assigned request identifier read from
x-pinecone-request-id, orNoneif not present.lsn_reconciled (int | None) – Log sequence number indicating how far the index has reconciled, parsed from
x-pinecone-lsn-reconciled.Nonewhen absent or when the header value is not a valid integer.lsn_committed (int | None) – Log sequence number of the last committed write, parsed from
x-pinecone-lsn-committed.Nonewhen absent or non-integer.
- Parameters:
- is_reconciled(target)[source]¶
Return
Truewhen the reconciled LSN meets or exceeds target.Use this for read-your-writes consistency checks: pass the LSN from a previous write response to verify that the index has caught up to that write before issuing a query.
- Parameters:
target (int) – The LSN threshold to check against. Typically the
lsn_committedvalue returned by a prior upsert or delete response.- Returns:
Trueiflsn_reconciledis notNoneand is greater than or equal to target;Falseotherwise.- Return type:
Examples
from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") index = pc.index(host="product-search.svc.pinecone.io") upsert_resp = index.upsert_records( namespace="electronics", records=[{"id": "prod-42", "_text": "wireless headphones"}], ) committed_lsn = upsert_resp.response_info.lsn_committed query_resp = index.search( namespace="electronics", inputs={"text": "headphones"}, ) query_resp.result.response_info.is_reconciled(committed_lsn)
- property lsn_committed: int | None¶
Log sequence number of the last committed write.
Parsed from the
x-pinecone-lsn-committedresponse header.- Returns:
intLSN, orNonewhen the header is absent or its value is not a valid integer.
Search Models¶
- class pinecone.models.vectors.search.Hit(*, id_, score_, fields=<factory>)[source]¶
Bases:
StructDictMixin,StructA single search result hit.
The API returns
_idand_scoreas field names. These are mapped toid_andscore_internally (to avoid Python name mangling), with convenience propertiesidandscorefor clean access.- Variables:
- Parameters:
- class pinecone.models.vectors.search.SearchResult(*, hits=<factory>)[source]¶
Bases:
StructDictMixin,StructThe result wrapper containing hits.
- class pinecone.models.vectors.search.SearchRecordsResponse(*, result, usage, response_info=None)[source]¶
Bases:
StructDictMixin,StructResponse from a search records operation.
- Variables:
result (SearchResult) – Wrapper containing the list of hits.
usage (SearchUsage) – Usage statistics for the search operation.
response_info (ResponseInfo | None) – HTTP response metadata (request ID, LSN values), or
Noneif not populated.
- Parameters:
result (SearchResult)
usage (SearchUsage)
response_info (ResponseInfo | None)
- response_info: ResponseInfo | None¶
- result: SearchResult¶
- usage: SearchUsage¶
- class pinecone.models.vectors.search.SearchInputs[source]¶
Bases:
dictTyped configuration for the
inputsparameter ofsearch().Required keys:
text.- Variables:
text (str) – Text to embed server-side for the search query.
- class pinecone.models.vectors.search.SearchUsage(*, read_units, embed_total_tokens=None, rerank_units=None)[source]¶
Bases:
StructDictMixin,StructUsage statistics for a search operation.
- Variables:
- Parameters:
- class pinecone.models.vectors.search.RerankConfig[source]¶
Bases:
dictTyped configuration for the
rerankparameter ofsearch().Required keys:
model,rank_fields. All other keys are optional.- Variables:
model (str) – Reranking model name (e.g.
"bge-reranker-v2-m3").rank_fields (list[str]) – Record fields to rank on (e.g.
["text"]).top_n (int) – Number of top results to return after reranking. Defaults to the value of
top_kwhen omitted.parameters (dict[str, Any]) – Model-specific parameters forwarded to the reranker. See the model documentation for supported keys.
query (str) – Override query text used for reranking. When omitted the query is inferred from the search inputs.
- class pinecone.models.vectors.query_aggregator.QueryNamespacesResults(*, matches=<factory>, usage=<factory>, ns_usage=<factory>)[source]¶
Bases:
StructDictMixin,StructAggregated results from querying multiple namespaces.
- Variables:
- Parameters:
- usage: Usage¶
- class pinecone.models.vectors.query_aggregator.QueryResultsAggregator(*, metric, top_k=10)[source]¶
Bases:
objectMerges per-namespace QueryResponse objects into a single combined result.
Uses a heap-based algorithm to efficiently merge scored vectors from multiple namespaces. For cosine/dotproduct metrics, higher scores rank first. For euclidean, lower scores rank first. Ties are broken by insertion order.
- Parameters:
- Raises:
ValueError – If metric is not a recognized value or top_k < 1.
- add_results(namespace, response)[source]¶
Add results from a single namespace query.
- Parameters:
namespace (str) – Namespace that was queried.
response (QueryResponse) – Query response from that namespace.
- Raises:
ValueError – If called after
get_results().- Return type:
None
Inference Models¶
- class pinecone.models.inference.embed.DenseEmbedding(*, values, vector_type='dense')[source]¶
Bases:
DictLikeStruct,StructA dense embedding vector.
- Variables:
- Parameters:
- class pinecone.models.inference.embed.SparseEmbedding(*, sparse_values, sparse_indices, sparse_tokens=None, vector_type='sparse')[source]¶
Bases:
StructDictMixin,StructA sparse embedding vector.
- Variables:
- Parameters:
- class pinecone.models.inference.embed.EmbeddingsList(*, model, vector_type, data, usage)[source]¶
Bases:
StructResponse from the embed endpoint.
Supports integer indexing, iteration, and
len()over the embedded data items, as well as bracket access for field names.- Variables:
model (str) – The model used to generate embeddings.
vector_type (str) – The type of embeddings returned (
"dense"or"sparse").data (list[pinecone.models.inference.embed.DenseEmbedding] | list[pinecone.models.inference.embed.SparseEmbedding]) – The list of embedding objects.
usage (pinecone.models.inference.embed.EmbedUsage) – Token usage information.
- Parameters:
model (str)
vector_type (str)
data (list[DenseEmbedding] | list[SparseEmbedding])
usage (EmbedUsage)
- data: list[DenseEmbedding] | list[SparseEmbedding]¶
- usage: EmbedUsage¶
- class pinecone.models.inference.rerank.RerankResult(*, model, data, usage)[source]¶
Bases:
StructResponse from the rerank endpoint.
- Variables:
model (str) – The model used for reranking.
data (list[pinecone.models.inference.rerank.RankedDocument]) – The list of ranked documents, ordered by relevance.
usage (pinecone.models.inference.rerank.RerankUsage) – Rerank usage information.
- Parameters:
model (str)
data (list[RankedDocument])
usage (RerankUsage)
- data: list[RankedDocument]¶
- usage: RerankUsage¶
- class pinecone.models.inference.rerank.RankedDocument(*, index, score, document=None)[source]¶
Bases:
StructDictMixin,StructA document with its relevance score from a rerank operation.
- Variables:
- Parameters:
- class pinecone.models.inference.models.ModelInfo(*, model, short_description, type, supported_parameters, vector_type=None, default_dimension=None, supported_dimensions=None, modality=None, max_sequence_length=None, max_batch_size=None, provider_name=None, supported_metrics=None)[source]¶
Bases:
StructInformation about an inference model.
- Variables:
model (str) – The model identifier (also accessible as
name).short_description (str) – A brief description of the model (also accessible as
description).type (str) – The model type (e.g.
"embed","rerank").supported_parameters (list[pinecone.models.inference.models.ModelInfoSupportedParameter]) – Parameters accepted by the model.
vector_type (str | None) – The type of vectors produced (for embed models).
default_dimension (int | None) – Default output dimension (for embed models).
supported_dimensions (list[int] | None) – Available output dimensions (for embed models).
modality (str | None) – The input modality (e.g.
"text").max_sequence_length (int | None) – Maximum input sequence length.
max_batch_size (int | None) – Maximum batch size for requests.
provider_name (str | None) – The model provider.
supported_metrics (list[str] | None) – Supported similarity metrics.
- Parameters:
- class pinecone.models.inference.model_list.ModelInfoList(models)[source]¶
Bases:
objectWrapper around a list of ModelInfo with convenience methods.
Supports integer indexing, string key access (
["models"]), iteration,len(), and a.names()convenience method.- Variables:
models – The underlying list of
ModelInfoinstances.- Parameters:
- class pinecone.inference.models.index_embed.IndexEmbed(model, field_map, metric=None, read_parameters=<factory>, write_parameters=<factory>)[source]¶
Bases:
objectConfiguration for an integrated (model-backed) embedding index.
Describes the embedding model and field mapping used for an integrated index. Legacy class preserved for backwards compatibility.
- Parameters:
- __init__(model, field_map, metric=None, read_parameters=<factory>, write_parameters=<factory>)¶
Import Models¶
- class pinecone.models.imports.model.ImportModel(*, id, uri, status, created_at, finished_at=None, percent_complete=None, records_imported=None, error=None)[source]¶
Bases:
StructDictMixin,StructResponse model for a bulk import operation.
- Variables:
id (str) – Unique identifier for the import operation.
uri (str) – Source URI for the import data.
status (str) – Current status of the import (Pending, InProgress, Failed, Completed, Cancelled).
created_at (str) – Timestamp when the import was created.
finished_at (str | None) – Timestamp when the import finished.
percent_complete (float | None) – Percentage of the import that has completed.
records_imported (int | None) – Number of records imported so far.
error (str | None) – Error message if the import failed.
- Parameters:
- class pinecone.models.imports.list.ImportList(imports, *, pagination=None)[source]¶
Bases:
objectWrapper around a list of ImportModel with convenience methods.
- Parameters:
imports (list[ImportModel])
pagination (Pagination | None)
- __init__(imports, *, pagination=None)[source]¶
Initialize an ImportList.
- Parameters:
imports (list[ImportModel]) – List of
ImportModelinstances representing bulk import operations.pagination (Pagination | None) – Optional
Paginationtoken for fetching additional pages of results.
- Return type:
None
- to_dict()[source]¶
Return the list as a serializable dict.
- Returns:
A dict with a
"data"key containing a list of import dicts, each produced byImportModel.to_dict(). When the wrapper has a pagination token, the dict also includes a"pagination"key with the token for fetching the next page.- Return type:
Examples
>>> from pinecone import Pinecone >>> pc = Pinecone(api_key="your-api-key") >>> index = pc.Index("product-search") >>> imports = index.list_imports_paginated() >>> imports.to_dict() {'data': [{'id': 'import-abc123', ...}, {'id': 'import-def456', ...}]}
- class pinecone.models.imports.model.StartImportResponse(*, id)[source]¶
Bases:
StructDictMixin,StructResponse model for starting a bulk import operation.
- class pinecone.models.imports.error_mode.ImportErrorMode(value)[source]¶
-
Behaviour when an individual record fails during a bulk import.
- Variables:
CONTINUE – Skip the failed record and continue importing remaining records.
ABORT – Abort the entire import when any record fails. Omitting
error_modeselects this.
- ABORT = 'abort'¶
- CONTINUE = 'continue'¶
Collection Models¶
- class pinecone.models.collections.model.CollectionModel(*, name, status, environment, size=None, dimension=None, vector_count=None)[source]¶
Bases:
StructDictMixin,StructResponse model for a Pinecone collection.
- Variables:
name (str) – The name of the collection.
status (str) – Current status of the collection (e.g.
"Ready","Initializing","Terminating").environment (str) – Deployment environment where the collection is hosted.
size (int | None) – Size of the collection in bytes, or
Noneif not yet available.dimension (int | None) – Dimensionality of vectors in the collection, or
Noneif not yet available.vector_count (int | None) – Number of vectors in the collection, or
Noneif not yet available.
- Parameters:
- class pinecone.models.collections.list.CollectionList(collections)[source]¶
Bases:
objectWrapper around a list of CollectionModel with convenience methods.
- Parameters:
collections (list[CollectionModel])
- __init__(collections)[source]¶
- Parameters:
collections (list[CollectionModel])
- Return type:
None
- to_dict()[source]¶
Return the list as a serializable dict.
- Returns:
A dict with a
"data"key containing a list of collection dicts, each produced byCollectionModel.to_dict().- Return type:
Examples
>>> from pinecone import Pinecone >>> pc = Pinecone(api_key="your-api-key") >>> collections = pc.list_collections() >>> collections.to_dict() {'data': [{'name': 'movie-embeddings-v1', ...}, {'name': 'product-snapshot', ...}]}
- class pinecone.db_control.models.collection_description.CollectionDescription(name, source)[source]¶
Bases:
NamedTupleBasic metadata describing a collection.
- Variables:
- Parameters:
Backup and Restore Models¶
- class pinecone.models.backups.model.BackupModel(*, backup_id, source_index_name, source_index_id, status, cloud, region, source_index_deleted_at=None, name=None, description=None, schema=None, record_count=None, namespace_count=None, size_bytes=None, tags=None, created_at=None)[source]¶
Bases:
StructResponse model for a Pinecone backup (2026-07 API).
- Variables:
backup_id (str) – Unique identifier for the backup.
source_index_name (str) – Name of the index that was backed up.
source_index_id (str) – Unique identifier of the source index.
status (str) – Current status of the backup —
"Initializing","Ready", or"Failed".cloud (str) – Cloud provider where the backup is stored.
region (str) – Region where the backup is stored.
source_index_deleted_at (str | None) – Timestamp at which the source index was deleted, or
Nonewhen the source index is still active. Only populated bylist_index_backups(include_deleted=True).name (str | None) – User-provided name for the backup.
description (str | None) – User-provided description for the backup.
schema (pinecone.models.indexes.schema.IndexSchema | None) – Schema captured from the source index, or
Nonewhen the server returns no schema (e.g. schedule-produced backups of an index that declared none). Legacy metadata-only schemas decode toLegacyMetadataFieldentries.record_count (int | None) – Number of records in the backup.
namespace_count (int | None) – Number of namespaces in the backup.
size_bytes (int | None) – Size of the backup in bytes.
tags (dict[str, Any] | None) – User-defined key-value tags, or
Nonewhen the source index had none (the API returns"tags": nullrather than{}).created_at (str | None) – Timestamp when the backup was created.
- Parameters:
backup_id (str)
source_index_name (str)
source_index_id (str)
status (str)
cloud (str)
region (str)
source_index_deleted_at (str | None)
name (str | None)
description (str | None)
schema (IndexSchema | None)
record_count (int | None)
namespace_count (int | None)
size_bytes (int | None)
created_at (str | None)
- property dense_dimension: int | None¶
Dimension of the backup’s single dense vector field, if there is one.
Returns
Nonewhen the schema is absent, declares nodense_vectorfield, or declares more than one — in which case read the dimension off the field you want viaschema.fields['<field-name>'].dimension.
- schema: IndexSchema | None¶
- to_dict()[source]¶
Return a dict representation of this backup model.
- Returns:
Dictionary with all fields, including optional ones that are
None(e.g.name,description,record_count,source_index_deleted_at).schemabecomes a plain dict; legacy untyped schema fields are emitted without atypekey, matching the wire format.- Return type:
Examples
>>> from pinecone.models.backups.model import BackupModel >>> backup = BackupModel( ... backup_id="bkp-1", ... source_index_name="my-index", ... source_index_id="idx-abc", ... status="Ready", ... cloud="aws", ... region="us-east-1", ... name="weekly-backup", ... ) >>> d = backup.to_dict() >>> d["backup_id"] 'bkp-1' >>> d["name"] 'weekly-backup' >>> d["description"] is None True >>> d["source_index_deleted_at"] is None True
- class pinecone.models.backups.list.BackupList(backups, *, pagination=None)[source]¶
Bases:
objectWrapper around a list of BackupModel with convenience methods.
- Parameters:
backups (list[BackupModel])
pagination (Pagination | None)
- __init__(backups, *, pagination=None)[source]¶
Initialize a BackupList.
- Parameters:
backups (list[BackupModel]) – List of
BackupModelinstances representing index backups.pagination (Pagination | None) – Optional
Paginationtoken for fetching additional pages of results.
- Return type:
None
- property data: list[BackupModel]¶
Return the list of backups.
- names()[source]¶
Return a list of backup names, falling back to backup_id.
If a backup has no
nameset, itsbackup_idis used instead.Examples
>>> from pinecone import Pinecone >>> pc = Pinecone(api_key="your-api-key") >>> backups = pc.list_backups(index_name="movie-recommendations") >>> backups.names() ['daily-2025-01-01', 'weekly-2024-12-29']
- to_dict()[source]¶
Return the list as a serializable dict.
- Returns:
A dict with a
"data"key containing a list of backup dicts, each produced byBackupModel.to_dict(). When the wrapper has a pagination token, the dict also includes a"pagination"key with the token for fetching the next page.- Return type:
Examples
>>> from pinecone import Pinecone >>> pc = Pinecone(api_key="your-api-key") >>> backups = pc.list_backups(index_name="movie-recommendations") >>> backups.to_dict() {'data': [{'backup_id': 'bkp-abc123', ...}, {'backup_id': 'bkp-def456', ...}]}
- class pinecone.models.backups.model.RestoreJobModel(*, restore_job_id, backup_id, target_index_name, target_index_id, status, created_at=None, completed_at=None, percent_complete=None)[source]¶
Bases:
StructResponse model for a Pinecone restore job.
- Variables:
restore_job_id (str) – Unique identifier for the restore job.
backup_id (str) – Identifier of the backup being restored.
target_index_name (str) – Name of the index being restored to.
target_index_id (str) – Unique identifier of the target index.
status (str) – Current status of the restore job.
created_at (str | None) – Timestamp when the restore job was created, or
Noneif the backend has not yet assigned a creation timestamp.completed_at (str | None) – Timestamp when the restore job completed.
percent_complete (float | None) – Percentage of the restore job that has completed.
- Parameters:
- to_dict()[source]¶
Return a dict representation of this restore job model.
- Returns:
Dictionary with all fields, including optional ones that are
None(completed_atandpercent_complete). Values are not recursively converted.- Return type:
Examples
>>> from pinecone.models.backups.model import RestoreJobModel >>> job = RestoreJobModel( ... restore_job_id="rj-1", ... backup_id="bkp-1", ... target_index_name="my-index", ... target_index_id="idx-abc", ... status="Running", ... created_at="2024-01-01T00:00:00Z", ... ) >>> d = job.to_dict() >>> d["restore_job_id"] 'rj-1' >>> d["completed_at"] is None True
- class pinecone.models.backups.list.RestoreJobList(restore_jobs, *, pagination=None)[source]¶
Bases:
objectWrapper around a list of RestoreJobModel with convenience methods.
- Parameters:
restore_jobs (list[RestoreJobModel])
pagination (Pagination | None)
- __init__(restore_jobs, *, pagination=None)[source]¶
Initialize a RestoreJobList.
- Parameters:
restore_jobs (list[RestoreJobModel]) – List of
RestoreJobModelinstances representing restore operations.pagination (Pagination | None) – Optional
Paginationtoken for fetching additional pages of results.
- Return type:
None
- property data: list[RestoreJobModel]¶
Return the list of restore jobs.
- to_dict()[source]¶
Return the list as a serializable dict.
- Returns:
A dict with a
"data"key containing a list of restore job dicts, each produced byRestoreJobModel.to_dict(). When the wrapper has a pagination token, the dict also includes a"pagination"key with the token for fetching the next page.- Return type:
Examples
from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") jobs = pc.restore_jobs.list() jobs.to_dict() # {'data': [{'restore_job_id': 'rj-abc123', ...}, ...]}
- class pinecone.models.backups.model.CreateIndexFromBackupRequest(*, name, tags=None, deletion_protection=None, read_capacity=None)[source]¶
Bases:
StructRequest model for creating an index from a backup.
omit_defaults=Truekeeps unset optionals off the wire, so a request built with onlynameserialises to{"name": ...}and the server applies its own defaults (on-demand read capacity, deletion protection disabled, the backup’s own tags).- Variables:
name (str) – Name for the restored index (required). 1-45 characters, starting and ending with an alphanumeric character.
tags (dict[str, str] | None) – Optional key-value tags for the restored index. When omitted, the server copies the backup’s tags.
deletion_protection (str | None) – Optional deletion protection setting (
"enabled"or"disabled").read_capacity (dict[str, Any] | None) – Optional read capacity configuration, letting the restore land directly on dedicated read nodes instead of defaulting to on-demand capacity.
- Parameters:
Backup Schedule Models¶
- class pinecone.models.backups.schedules.BackupScheduleModel(*, schedule_id, name, index_id, project_id, schedule_type, frequency, retention_expire_after_days, enabled, created_at, next_scheduled_run=None)[source]¶
Bases:
StructResponse model for a backup schedule (2026-07 API).
- Variables:
schedule_id (str) – Unique identifier for the schedule. Used as the path parameter for describe / update / delete / history calls.
name (str) – User-defined name for the schedule. Backups it produces are named
"{name}-{run timestamp}".index_id (str) – Identifier of the index this schedule backs up. This is the index id, not its name – schedules are created against a name but reported against the id, so a deleted-and-recreated index does not inherit the old schedule.
project_id (str) – Project containing the schedule, always the same project as the source index.
schedule_type (str) – Schedule category.
"time-based"for any schedule created through this SDK, which always sends that value; the server does not constrain the field, so a schedule created by another client can report something else.frequency (str) – Cadence, one of
"daily","weekly","monthly".retention_expire_after_days (int) – Days each backup produced by this schedule is retained. (The create/update request models spell the same value
retention_days, mirroring the request body’sretention.expire_after_days.)enabled (bool) – Whether the schedule is active. A disabled schedule does not run and is not deleted.
next_scheduled_run (datetime.datetime | None) – When the next backup is planned, or
None.NoneiffenabledisFalse: disabling clears the pending run, and re-enabling recomputes it from the moment of the update, so a disable/re-enable cycle shifts the cadence rather than resuming the old slot. The field is documented as always present and sent asnullwhen disabled; it also decodes when absent entirely.created_at (datetime.datetime) – When the schedule was created.
- Parameters:
Note
Only one enabled schedule may exist per index. Creating a second one fails with a 409 telling you to disable or delete the first; re-enabling a disabled schedule while another is enabled fails the same way.
- to_dict()[source]¶
Return a dict representation of this schedule.
- Returns:
Dictionary with all fields, including
next_scheduled_runwhen it isNone. Timestamps are rendered back to RFC 3339 strings (normalised to UTCZform), so the result is JSON-serialisable.- Return type:
Examples
>>> from datetime import datetime, timezone >>> from pinecone.models.backups.schedules import BackupScheduleModel >>> schedule = BackupScheduleModel( ... schedule_id="sched-1", ... name="daily-compliance-backup", ... index_id="idx-1", ... project_id="proj-1", ... schedule_type="time-based", ... frequency="daily", ... retention_expire_after_days=90, ... enabled=False, ... created_at=datetime(2026, 4, 2, 18, 22, 56, tzinfo=timezone.utc), ... ) >>> schedule.to_dict()["created_at"] '2026-04-02T18:22:56Z' >>> schedule.to_dict()["next_scheduled_run"] is None True
- class pinecone.models.backups.list.BackupScheduleList(schedules, *, pagination=None)[source]¶
Bases:
objectWrapper around a list of BackupScheduleModel with convenience methods.
- Parameters:
schedules (list[BackupScheduleModel])
pagination (Pagination | None)
- __init__(schedules, *, pagination=None)[source]¶
Initialize a BackupScheduleList.
- Parameters:
schedules (list[BackupScheduleModel]) – List of
BackupScheduleModelinstances representing the backup schedules on an index.pagination (Pagination | None) – Optional
Paginationtoken for fetching additional pages of results.
- Return type:
None
- property data: list[BackupScheduleModel]¶
Return the list of backup schedules.
- enabled_schedules()[source]¶
Return only the enabled schedules.
At most one schedule per index can be enabled, so this is the answer to “which schedule is actually running”. Named to avoid reading like the
enabledflag onBackupScheduleModel, which a bareenabledmethod would shadow at a glance.- Return type:
- class pinecone.models.backups.schedules.BackupScheduleHistoryItem(*, backup_id, source_index_id, source_index_name, status, cloud, region, created_at, scheduled_execution_at=None, name=None, description=None, schema=None, record_count=None, namespace_count=None, size_bytes=None, tags=None)[source]¶
Bases:
StructA backup produced by a schedule (2026-07 API).
History rows describe backup snapshots, not the schedule itself. A row appears as soon as a run is planned, so the list mixes runs that have not happened yet with ones that have.
- Variables:
backup_id (str) – Unique identifier for the backup snapshot.
source_index_id (str) – Identifier of the index that was backed up.
source_index_name (str) – Name of the index that was backed up.
status (str) – Lifecycle status of the snapshot –
"Scheduled"(planned, not yet started),"Initializing","Ready", or"InitializationFailed". Left as a plainstrso a value the SDK has not seen before still decodes.cloud (str) – Cloud provider where the snapshot is stored.
region (str) – Cloud region where the snapshot is stored.
created_at (datetime.datetime) – When the backup record was created – which for a
Scheduledrow is when the run was planned, not when data was captured.scheduled_execution_at (datetime.datetime | None) – When the run is planned to happen. Present when
statusis"Scheduled";Noneonce the run has started, andNoneon servers that do not report it.name (str | None) – Name of the snapshot, generated as
"{schedule name}-{run timestamp}".description (str | None) – Description of the snapshot, or
None.schema (pinecone.models.indexes.schema.IndexSchema | None) – Schema captured from the source index, or
Nonewhen the server reports none. Reuses the typedIndexSchemaunion; metadata-only schemas from older indexes decode toLegacyMetadataFieldentries when the payload is routed throughdecode_backups_envelope.record_count (int | None) – Records in the snapshot.
0for aScheduledrow – nothing has been captured yet.namespace_count (int | None) – Namespaces in the snapshot.
size_bytes (int | None) – Approximate stored size of the snapshot, in bytes.
tags (dict[str, Any] | None) – Tags carried over from the source index, or
None(the API sendsnullrather than{}when there are none).
- Parameters:
backup_id (str)
source_index_id (str)
source_index_name (str)
status (str)
cloud (str)
region (str)
created_at (datetime)
scheduled_execution_at (datetime | None)
name (str | None)
description (str | None)
schema (IndexSchema | None)
record_count (int | None)
namespace_count (int | None)
size_bytes (int | None)
Note
name,record_count,namespace_countandsize_bytesare all documented as required, but the backend serves schedule history from its shared backup handler, where each is optional. They are typed as optional here so a real response decodes rather than raising; see the divergence recorded on issue #224.- schema: IndexSchema | None¶
- class pinecone.models.backups.list.BackupScheduleHistoryList(items, *, pagination=None)[source]¶
Bases:
objectWrapper around a list of BackupScheduleHistoryItem with convenience methods.
- Parameters:
items (list[BackupScheduleHistoryItem])
pagination (Pagination | None)
- __init__(items, *, pagination=None)[source]¶
Initialize a BackupScheduleHistoryList.
- Parameters:
items (list[BackupScheduleHistoryItem]) – List of
BackupScheduleHistoryIteminstances representing backups produced by one schedule.pagination (Pagination | None) – Optional
Paginationtoken for fetching additional pages of results.
- Return type:
None
- property data: list[BackupScheduleHistoryItem]¶
Return the list of history rows.
- class pinecone.models.backups.schedules.CreateBackupScheduleRequest(*, name, frequency, retention_days)[source]¶
Bases:
StructRequest model for creating a backup schedule.
Takes flat keyword arguments and builds the nested request body in
to_wire(), filling inschedule.typerather than making every caller repeat the one value the SDK sends.- Variables:
name (str) – Name for the schedule (required). Produced backups are named
"{name}-{run timestamp}".frequency (str) – Cadence (required), one of
"daily","weekly","monthly". Validated on construction.retention_days (int) – Days to retain each backup this schedule produces (required). Must be at least 1, which is checked here; the maximum is a per-project setting enforced server-side. Serialised as
retention.expire_after_days.
- Raises:
ValueError – If frequency is not a supported cadence, or retention_days is less than 1.
- Parameters:
Examples
>>> from pinecone.models.backups.schedules import CreateBackupScheduleRequest >>> request = CreateBackupScheduleRequest( ... name="daily-compliance-backup", frequency="daily", retention_days=90 ... ) >>> request.to_wire() == { ... "name": "daily-compliance-backup", ... "schedule": {"type": "time-based", "frequency": "daily"}, ... "retention": {"expire_after_days": 90}, ... } True
- class pinecone.models.backups.schedules.UpdateBackupScheduleRequest(*, frequency=None, retention_days=None, enabled=None)[source]¶
Bases:
StructRequest model for updating an existing backup schedule.
Every field is optional; omitted fields are left unchanged. Like
CreateBackupScheduleRequest, this takes flat keyword arguments and builds the nested body into_wire(), which emits only the fields you set. A request with nothing set encodes to{}and is a no-op server-side.The schedule’s
namecannot be changed, and neither can the index it is attached to – the API exposes no field for either.- Variables:
frequency (str | None) – New cadence, one of
"daily","weekly","monthly", orNoneto leave it unchanged.retention_days (int | None) – New retention window in days, or
Noneto leave it unchanged. Must be at least 1; serialised asretention.expire_after_days. Changing it also re-times the pending deletions of backups this schedule already produced.enabled (bool | None) –
Falseto disable the schedule (clearing itsnext_scheduled_run),Trueto re-enable it, orNoneto leave it unchanged. Re-enabling enqueues a new backup and recomputes the next run from now, so it is not a free toggle; it also fails with a 409 if another schedule on the same index is already enabled.
- Raises:
ValueError – If frequency is set to an unsupported cadence, or retention_days is set to less than 1.
- Parameters:
Examples
>>> from pinecone.models.backups.schedules import UpdateBackupScheduleRequest >>> UpdateBackupScheduleRequest(enabled=False).to_wire() {'enabled': False} >>> UpdateBackupScheduleRequest(frequency="weekly", retention_days=30).to_wire() == { ... "frequency": "weekly", ... "retention": {"expire_after_days": 30}, ... } True
Namespace Models¶
- class pinecone.models.namespaces.models.NamespaceDescription(*, name='', record_count=0, schema=None, indexed_fields=None, size_bytes=0)[source]¶
Bases:
StructDictMixin,StructDescription of a namespace including name, record count, size, and schema.
- Variables:
name (str) – The name of the namespace.
record_count (int) – The total number of records in the namespace.
schema (pinecone.models.namespaces.models.NamespaceSchema | None) – Schema configuration for metadata indexing, or None.
indexed_fields (pinecone.models.namespaces.models.IndexedFields | None) – List of indexed metadata fields, or None.
size_bytes (int) – The total size of the namespace’s data, in bytes. This is an approximation, not an exact byte count: data written before size tracking was enabled reads as 0, and recently deleted data may still be counted until compaction converges the value. Defaults to 0, which also covers API versions before 2026-07 that omit the field — a 0 therefore does not by itself mean the namespace is empty.
- Parameters:
- class pinecone.models.namespaces.models.ListNamespacesResponse(*, namespaces=<factory>, pagination=None, total_count=0)[source]¶
Bases:
StructDictMixin,StructResponse from a list namespaces operation.
- Variables:
namespaces (list[pinecone.models.namespaces.models.NamespaceDescription]) – List of namespace descriptions in this page.
pagination (pinecone.models.vectors.responses.Pagination | None) – Pagination token for the next page, or None if last page.
total_count (int) – Total number of namespaces matching the query.
- Parameters:
namespaces (list[NamespaceDescription])
pagination (Pagination | None)
total_count (int)
- namespaces: list[NamespaceDescription]¶
Pagination Models¶
- class pinecone.models.pagination.Page(*, items, pagination_token)[source]¶
Bases:
Generic[T]A single page of results from a paginated API.
- class pinecone.models.pagination.Paginator(*, fetch_page, initial_token=None, limit=None)[source]¶
Bases:
Generic[T]Lazy iterator over paginated API results (sync).
Fetches pages on demand. Supports item-level iteration, page-level access via
pages(), bulk collection viato_list(), and resumption via thepagination_tokenproperty.- Parameters:
fetch_page (Callable[[str | None], Page[T]]) – Callable that takes an optional pagination token and returns a
Page.initial_token (str | None) – Token to start pagination from.
Nonestarts from the beginning.limit (int | None) – Maximum number of items to yield across all pages.
Noneyields all items.
Examples
paginator = pc.assistants.list() for assistant in paginator: print(assistant.name)
Collect all results into a list:
all_assistants = pc.assistants.list().to_list()
- pages()[source]¶
Iterate over pages rather than individual items.
When
limitis set, yields full pages until the remaining budget is exhausted, then yields a truncated final page and stops.- Returns:
GeneratoryieldingPageobjects. Each page has anitemslist and an optionalpagination_token.- Return type:
Examples
for page in pc.assistants.list().pages(): for assistant in page.items: print(assistant.name)
- class pinecone.models.pagination.AsyncPaginator(*, fetch_page, initial_token=None, limit=None)[source]¶
Bases:
Generic[T]Async lazy iterator over paginated API results.
Fetches pages on demand. Supports item-level async iteration, page-level access via
pages(), bulk collection viato_list(), and resumption via thepagination_tokenproperty.- Parameters:
fetch_page (Callable[[str | None], Awaitable[Page[T]]]) – Async callable that takes an optional pagination token and returns a
Page.initial_token (str | None) – Token to start pagination from.
Nonestarts from the beginning.limit (int | None) – Maximum number of items to yield across all pages.
Noneyields all items.
Examples
paginator = async_pc.assistants.list() async for assistant in paginator: print(assistant.name)
Collect all results into a list:
paginator = async_pc.assistants.list() all_assistants = await paginator.to_list()
- async pages()[source]¶
Iterate over pages rather than individual items.
When
limitis set, yields full pages until the remaining budget is exhausted, then yields a truncated final page and stops.- Returns:
AsyncGeneratoryieldingPageobjects. Each page has anitemslist and an optionalpagination_token.- Return type:
AsyncGenerator[Page[T], None]
Examples
async for page in async_pc.assistants.list().pages(): for assistant in page.items: print(assistant.name)
Enums¶
- class pinecone.models.enums.CloudProvider(value)[source]¶
-
Supported cloud providers for Pinecone indexes.
- AWS = 'aws'¶
- AZURE = 'azure'¶
- GCP = 'gcp'¶
- class pinecone.models.enums.Metric(value)[source]¶
-
Supported similarity metrics for vector search.
- COSINE = 'cosine'¶
- DOTPRODUCT = 'dotproduct'¶
- EUCLIDEAN = 'euclidean'¶
- class pinecone.models.enums.VectorType(value)[source]¶
-
Supported vector types.
- DENSE = 'dense'¶
- SPARSE = 'sparse'¶
- class pinecone.models.enums.DeletionProtection(value)[source]¶
-
Deletion protection setting for indexes.
- DISABLED = 'disabled'¶
- ENABLED = 'enabled'¶
- class pinecone.models.enums.EmbedModel(value)[source]¶
-
Known embedding models for integrated indexes.
A convenience enum rather than an exhaustive list:
modelis also accepted as a plain string, so a model added after this SDK release can still be used. Calllist_models()for the models currently available.- Llama_Text_Embed_V2 = 'llama-text-embed-v2'¶
- Multilingual_E5_Large = 'multilingual-e5-large'¶
- Pinecone_Sparse_English_V0 = 'pinecone-sparse-english-v0'¶
- Pinecone_Sparse_Multilingual_V0 = 'pinecone-sparse-multilingual-v0'¶
- class pinecone.models.enums.RerankModel(value)[source]¶
-
Known reranking models.
Like
EmbedModel, a convenience enum rather than an exhaustive list.Note
Pinecone_Rerank_V0is deprecated and most projects can no longer use it: a request naming it is rejected with a permission error whose message points to a current model. Prefer another member of this enum.- Bge_Reranker_V2_M3 = 'bge-reranker-v2-m3'¶
- Cohere_Rerank_3_5 = 'cohere-rerank-3.5'¶
- Pinecone_Rerank_V0 = 'pinecone-rerank-v0'¶
- class pinecone.models.enums.PodType(value)[source]¶
-
Supported pod type and size combinations.
- P1_X1 = 'p1.x1'¶
- P1_X2 = 'p1.x2'¶
- P1_X4 = 'p1.x4'¶
- P1_X8 = 'p1.x8'¶
- P2_X1 = 'p2.x1'¶
- P2_X2 = 'p2.x2'¶
- P2_X4 = 'p2.x4'¶
- P2_X8 = 'p2.x8'¶
- S1_X1 = 's1.x1'¶
- S1_X2 = 's1.x2'¶
- S1_X4 = 's1.x4'¶
- S1_X8 = 's1.x8'¶
- class pinecone.db_control.enums.clouds.AwsRegion(value)[source]¶
-
AWS regions supported for serverless indexes.
- AP_SOUTHEAST_1 = 'ap-southeast-1'¶
- EU_CENTRAL_1 = 'eu-central-1'¶
- EU_WEST_1 = 'eu-west-1'¶
- US_EAST_1 = 'us-east-1'¶
- US_WEST_2 = 'us-west-2'¶
Admin Models¶
- class pinecone.models.admin.api_key.APIKeyModel(*, id, name=None, project_id, roles)[source]¶
Bases:
StructDictMixin,StructResponse model for a Pinecone API key.
- Variables:
id (str) – Unique identifier for the API key.
name (str | None) – Name of the API key, or
Nonewhen the backend has no display label set for this key.project_id (str) – Identifier of the project the key belongs to.
roles (list[APIKeyRole]) – List of roles assigned to the key (see
APIKeyRole).
- Parameters:
id (str)
name (str | None)
project_id (str)
roles (list[APIKeyRole])
Examples
>>> from pinecone import Admin >>> admin = Admin(client_id="your-client-id", client_secret="your-client-secret") >>> key = admin.api_keys.describe(api_key_id="key-abc123") >>> key.id 'key-abc123' >>> key.name 'prod-search-key' >>> key.roles [<APIKeyRole.DATA_PLANE_EDITOR: 'DataPlaneEditor'>]
- property role: APIKeyRole¶
Singular alias for
roleswhen the key has exactly one role.- Returns:
The single role assigned to this key.
- Return type:
- Raises:
ValueError – If the key has no roles or more than one role.
Examples
>>> key = admin.api_keys.describe(api_key_id="key-abc123") >>> key.role <APIKeyRole.DATA_PLANE_EDITOR: 'DataPlaneEditor'>
Keys with multiple roles raise
ValueError; userolesinstead:multi_role_key = APIKeyModel( id="k2", name="k2", project_id="p1", roles=[APIKeyRole.PROJECT_EDITOR, APIKeyRole.DATA_PLANE_EDITOR] ) try: multi_role_key.role except ValueError as exc: print(exc) # API key has 2 roles; use .roles to access all
- roles: list[APIKeyRole]¶
- class pinecone.models.admin.api_key.APIKeyList(api_keys)[source]¶
Bases:
objectWrapper around a list of APIKeyModel with convenience methods.
- Parameters:
api_keys (list[APIKeyModel])
- __init__(api_keys)[source]¶
Initialize an APIKeyList.
- Parameters:
api_keys (list[APIKeyModel]) – List of
APIKeyModelinstances representing Pinecone API keys.- Return type:
None
- names()[source]¶
Return a list of API key names.
- Returns:
- API key names in the same order as the list.
Elements are
Nonefor keys whose backend display label is unset.
- Return type:
Examples
>>> from pinecone import Admin >>> admin = Admin(client_id="your-client-id", client_secret="your-client-secret") >>> keys = admin.api_keys.list(project_id="proj-abc123") >>> keys.names() ['prod-search-key', 'ci-pipeline-key']
- to_dict()[source]¶
Return the list as a serializable dict.
- Returns:
A dict with a
"data"key containing a list of API key dicts, each produced byAPIKeyModel.to_dict().- Return type:
Examples
>>> from pinecone import Admin >>> admin = Admin(client_id="your-client-id", client_secret="your-client-secret") >>> keys = admin.api_keys.list(project_id="proj-abc123") >>> keys.to_dict() {'data': [{'name': 'prod-search-key', ...}, {'name': 'ci-pipeline-key', ...}]}
- class pinecone.models.admin.api_key.APIKeyWithSecret(*, key, value)[source]¶
Bases:
StructDictMixin,StructResponse model for an API key with its secret value.
The secret value is only available at creation time.
- Variables:
key (pinecone.models.admin.api_key.APIKeyModel) – The API key metadata.
value (str) – The secret API key string.
- Parameters:
key (APIKeyModel)
value (str)
- key: APIKeyModel¶
- class pinecone.models.admin.api_key.APIKeyRole(value)[source]¶
-
Roles that can be assigned to a Pinecone API key.
Possible values:
PROJECT_EDITOR,PROJECT_VIEWER,CONTROL_PLANE_EDITOR,CONTROL_PLANE_VIEWER,DATA_PLANE_EDITOR,DATA_PLANE_VIEWER.Examples
>>> from pinecone import Admin >>> from pinecone.models.admin.api_key import APIKeyRole >>> admin = Admin(client_id="your-client-id", client_secret="your-client-secret") >>> result = admin.api_keys.create( ... project_id="proj-abc123", ... name="read-only-key", ... roles=[APIKeyRole.DATA_PLANE_VIEWER], ... ) >>> result.key.roles [<APIKeyRole.DATA_PLANE_VIEWER: 'DataPlaneViewer'>]
Update a key to use control-plane access:
>>> key = admin.api_keys.update( ... api_key_id="key-abc123", ... roles=[APIKeyRole.CONTROL_PLANE_EDITOR], ... ) >>> key.role <APIKeyRole.CONTROL_PLANE_EDITOR: 'ControlPlaneEditor'>
- CONTROL_PLANE_EDITOR = 'ControlPlaneEditor'¶
- CONTROL_PLANE_VIEWER = 'ControlPlaneViewer'¶
- DATA_PLANE_EDITOR = 'DataPlaneEditor'¶
- DATA_PLANE_VIEWER = 'DataPlaneViewer'¶
- PROJECT_EDITOR = 'ProjectEditor'¶
- PROJECT_VIEWER = 'ProjectViewer'¶
- class pinecone.models.admin.organization.OrganizationModel(*, id, name, plan, payment_status, created_at, support_tier)[source]¶
Bases:
StructDictMixin,StructResponse model for a Pinecone organization.
- Variables:
id (str) – Unique identifier for the organization.
name (str) – Name of the organization.
plan (str) – The organization’s plan tier, as the server names it.
payment_status (str) – Current payment status.
created_at (str) – Timestamp when the organization was created.
support_tier (str) – Support tier for the organization.
- Parameters:
- class pinecone.models.admin.organization.OrganizationList(organizations)[source]¶
Bases:
objectWrapper around a list of OrganizationModel with convenience methods.
- Parameters:
organizations (list[OrganizationModel])
- __init__(organizations)[source]¶
Initialize an OrganizationList.
- Parameters:
organizations (list[OrganizationModel]) – List of
OrganizationModelinstances representing Pinecone organizations.- Return type:
None
- names()[source]¶
Return a list of organization names.
Examples
>>> from pinecone import Admin >>> admin = Admin(client_id="your-client-id", client_secret="your-client-secret") >>> orgs = admin.organizations.list() >>> orgs.names() ['acme-corp', 'research-team']
- to_dict()[source]¶
Return the list as a serializable dict.
- Returns:
A dict with a
"data"key containing a list of organization dicts, each produced byOrganizationModel.to_dict().- Return type:
Examples
>>> from pinecone import Admin >>> admin = Admin(client_id="your-client-id", client_secret="your-client-secret") >>> orgs = admin.organizations.list() >>> orgs.to_dict() {'data': [{'name': 'acme-corp', ...}, {'name': 'research-team', ...}]}
- class pinecone.models.admin.project.ProjectModel(*, id, name, max_pods, force_encryption_with_cmek, organization_id, created_at=None)[source]¶
Bases:
StructDictMixin,StructResponse model for a Pinecone project.
- Variables:
id (str) – Unique identifier for the project.
name (str) – Name of the project.
max_pods (int) – Maximum number of pods allowed in the project.
force_encryption_with_cmek (bool) – Whether CMEK encryption is enforced.
organization_id (str) – Identifier of the parent organization.
created_at (str | None) – Timestamp when the project was created.
- Parameters:
- class pinecone.models.admin.project.ProjectList(projects)[source]¶
Bases:
objectWrapper around a list of ProjectModel with convenience methods.
- Parameters:
projects (list[ProjectModel])
- __init__(projects)[source]¶
Initialize a ProjectList.
- Parameters:
projects (list[ProjectModel]) – List of
ProjectModelinstances representing Pinecone projects.- Return type:
None
- names()[source]¶
Return a list of project names.
Examples
>>> from pinecone import Admin >>> admin = Admin(client_id="your-client-id", client_secret="your-client-secret") >>> projects = admin.projects.list() >>> projects.names() ['production-search', 'staging-recommendations']
- to_dict()[source]¶
Return the list as a serializable dict.
- Returns:
A dict with a
"data"key containing a list of project dicts, each produced byProjectModel.to_dict().- Return type:
Examples
>>> from pinecone import Admin >>> admin = Admin(client_id="your-client-id", client_secret="your-client-secret") >>> projects = admin.projects.list() >>> projects.to_dict() {'data': [{'name': 'production-search', ...}, {'name': 'staging-recommendations', ...}]}
- class pinecone.models.admin.token.TokenResponse(*, access_token, token_type=None, expires_in=None)[source]¶
Bases:
StructDictMixin,StructResponse model for the OAuth2 client-credentials token exchange.
- Variables:
- Parameters:
- class pinecone.models.admin.pagination.PaginationResponse(*, next=None)[source]¶
Bases:
StructDictMixin,StructCursor envelope returned by paginated Admin API list responses.
- Variables:
next (str | None) – Opaque cursor for the next page, or
Nonewhen the server did not supply one. The value is never parsed or constructed by the SDK — pass it back verbatim as thepagination_tokenargument on the following list call.- Parameters:
next (str | None)
Examples
>>> from pinecone.models.admin.pagination import PaginationResponse >>> page = PaginationResponse(next="eyJsYXN0X2lkIjoiZTJlOTI1MjMifQ==") >>> page.next 'eyJsYXN0X2lkIjoiZTJlOTI1MjMifQ=='
- class pinecone.models.admin.user.UserModel(*, id, email, name=None)[source]¶
Bases:
StructDictMixin,StructResponse model for a user who is a member of the organization.
Role bindings are not included; use the role binding operations with
principal_type="user"to see what a user can do.- Variables:
- Parameters:
Examples
>>> from pinecone.models.admin.user import UserModel >>> user = UserModel(id="e2e92523-85dc-4142-b8c2-e681be8b78df", email="alice@example.com") >>> user.email 'alice@example.com' >>> user.name is None True
- class pinecone.models.admin.user.UserList(*, data=<factory>, pagination=None)[source]¶
Bases:
StructA page of users, plus the cursor for the next page.
- Variables:
pagination (PaginationResponse | None) – Cursor envelope for the next page, or
Noneon the final page.
- Parameters:
pagination (PaginationResponse | None)
Examples
>>> from pinecone.models.admin.user import UserList, UserModel >>> users = UserList(data=[UserModel(id="u1", email="alice@example.com")]) >>> len(users) 1 >>> users.has_more False >>> users.emails() ['alice@example.com']
- pagination: PaginationResponse | None¶
- class pinecone.models.admin.invite.InviteModel(*, id, email, status, expires_at=None, processed_at=None, created_at)[source]¶
Bases:
StructDictMixin,StructResponse model for an invitation to join the organization.
statusis typed asstrrather thanInviteStatusso a status added by the server after this SDK release surfaces as its raw string instead of raising. Compare againstInviteStatusmembers directly — they arestrvalues.- Variables:
id (str) – Unique identifier (UUID) for the invite.
email (str) – The email address the invite was sent to.
status (str) – One of the
InviteStatusvalues.expires_at (str | None) – RFC 3339 timestamp for when the invite expires if not accepted, or
Noneif it does not expire. Resending an invite pushes this further out; read the new value from the resend response rather than computing it.processed_at (str | None) – RFC 3339 timestamp for when the invite was accepted.
None(or omitted by the server) while the invite is still pending or expired.created_at (str) – RFC 3339 timestamp for when the invite was created.
- Parameters:
Examples
>>> from pinecone.models.admin.invite import InviteModel, InviteStatus >>> invite = InviteModel( ... id="9c8e3528-b9c0-4358-84ce-84c28e91b566", ... email="newhire@acme.com", ... status="pending", ... expires_at="2026-05-21T03:00:00Z", ... created_at="2026-04-14T20:00:00Z", ... ) >>> invite.status == InviteStatus.PENDING True >>> invite.processed_at is None True
- class pinecone.models.admin.invite.InviteList(*, data=<factory>, pagination=None)[source]¶
Bases:
StructA page of invites, plus the cursor for the next page.
- Variables:
data (list[InviteModel]) – The invites on this page.
pagination (PaginationResponse | None) – Cursor envelope for the next page, or
Noneon the final page.
- Parameters:
data (list[InviteModel])
pagination (PaginationResponse | None)
Examples
>>> from pinecone.models.admin.invite import InviteList, InviteModel >>> invites = InviteList( ... data=[ ... InviteModel( ... id="i1", ... email="newhire@acme.com", ... status="pending", ... created_at="2026-04-14T20:00:00Z", ... ) ... ] ... ) >>> invites.emails() ['newhire@acme.com']
- data: list[InviteModel]¶
- pagination: PaginationResponse | None¶
- class pinecone.models.admin.invite.InviteStatus(value)[source]¶
-
The lifecycle status of an organization invite.
Possible values:
pending,expired,processed.List operations return only
pendingandexpiredinvites;processedis returned only when fetching a single invite by ID.Examples
>>> from pinecone.models.admin.invite import InviteStatus >>> InviteStatus.PENDING == "pending" True
- EXPIRED = 'expired'¶
- PENDING = 'pending'¶
- PROCESSED = 'processed'¶
- class pinecone.models.admin.service_account.ServiceAccountModel(*, id, name, client_id, created_at, updated_at)[source]¶
Bases:
StructDictMixin,StructResponse model for a service account. The OAuth secret is not included.
Role bindings are not included; use the role binding operations with
principal_type="service_account"to see what the account can do.- Variables:
id (str) – Unique identifier (UUID) for the service account. Use this as the path parameter on service account operations and as the
principal_idwhen querying or creating role bindings.name (str) – Short human-readable label set at creation time.
client_id (str) – OAuth client ID the service account uses to obtain access tokens. Used only for OAuth token exchange — it is not the service account’s identifier for role bindings.
created_at (str) – RFC 3339 timestamp for when the account was created.
updated_at (str) – RFC 3339 timestamp of the most recent metadata update.
- Parameters:
Examples
>>> from pinecone.models.admin.service_account import ServiceAccountModel >>> account = ServiceAccountModel( ... id="f8a3b2c1-4d5e-6f7a-8b9c-0d1e2f3a4b5c", ... name="My Service Account", ... client_id="l3Ow0CmFyc4jOONcwiKUCRqQKN0tiCAn", ... created_at="2026-04-10T15:23:00Z", ... updated_at="2026-04-12T09:11:00Z", ... ) >>> account.name 'My Service Account'
- class pinecone.models.admin.service_account.ServiceAccountList(*, data=<factory>, pagination=None)[source]¶
Bases:
StructA page of service accounts, plus the cursor for the next page.
- Variables:
data (list[ServiceAccountModel]) – The service accounts on this page.
pagination (PaginationResponse | None) – Cursor envelope for the next page, or
Noneon the final page.
- Parameters:
data (list[ServiceAccountModel])
pagination (PaginationResponse | None)
Examples
>>> from pinecone.models.admin.service_account import ( ... ServiceAccountList, ... ServiceAccountModel, ... ) >>> accounts = ServiceAccountList( ... data=[ ... ServiceAccountModel( ... id="sa1", ... name="ci-prod", ... client_id="cid", ... created_at="2026-04-10T15:23:00Z", ... updated_at="2026-04-10T15:23:00Z", ... ) ... ] ... ) >>> accounts.names() ['ci-prod']
- data: list[ServiceAccountModel]¶
- pagination: PaginationResponse | None¶
- class pinecone.models.admin.service_account.ServiceAccountWithSecret(*, service_account, client_secret)[source]¶
Bases:
StructDictMixin,StructResponse model for a service account with a newly issued OAuth secret.
The secret is returned exactly once — at creation and on secret rotation — and cannot be retrieved later.
__repr__()masks it so it does not leak into logs;to_dict()and JSON encoding return it in full.- Variables:
service_account (ServiceAccountModel) – The service account metadata.
client_secret (str) – The OAuth client secret. Treat as a credential.
- Parameters:
service_account (ServiceAccountModel)
client_secret (str)
Examples
>>> from pinecone.models.admin.service_account import ( ... ServiceAccountModel, ... ServiceAccountWithSecret, ... ) >>> created = ServiceAccountWithSecret( ... service_account=ServiceAccountModel( ... id="sa1", ... name="ci-prod", ... client_id="cid", ... created_at="2026-04-10T15:23:00Z", ... updated_at="2026-04-10T15:23:00Z", ... ), ... client_secret="8p-kkC23XOWvkCosKq", ... ) >>> created.client_secret '8p-kkC23XOWvkCosKq' >>> repr(created).endswith("client_secret='...osKq')") True
- service_account: ServiceAccountModel¶
- class pinecone.models.admin.role_binding.RoleBindingModel(*, id, principal_type, principal_id, resource_type, resource_id, role, created_at)[source]¶
Bases:
StructDictMixin,StructResponse model for a role binding: a
rolegranted to a principal at a scope.principal_type,resource_type, androleare typed asstrrather than as enums so values the server adds after this SDK release surface as their raw strings instead of raising. Compare againstPrincipalType,ResourceType, andRoleNamedirectly — they arestrvalues.- Variables:
id (str) – Unique identifier (UUID) for the role binding.
principal_type (str) – One of the
PrincipalTypevalues.principal_id (str) – The principal’s UUID.
resource_type (str) – One of the
ResourceTypevalues.resource_id (str) – The organization or project the binding is scoped to.
created_at (str) – RFC 3339 timestamp for when the binding was created.
- Parameters:
Examples
>>> from pinecone.models.admin.role_binding import RoleBindingModel, RoleName >>> binding = RoleBindingModel( ... id="9a8e3528-b9c0-4358-84ce-84c28e91b566", ... principal_type="service_account", ... principal_id="f8a3b2c1-4d5e-6f7a-8b9c-0d1e2f3a4b5c", ... resource_type="project", ... resource_id="a2f7dddb-1597-4eff-9f71-535fde243f58", ... role="DataPlaneEditor", ... created_at="2026-04-10T15:23:00Z", ... ) >>> binding.role == RoleName.DATA_PLANE_EDITOR True
- class pinecone.models.admin.role_binding.RoleBindingList(*, data=<factory>, pagination=None)[source]¶
Bases:
StructA page of role bindings, plus the cursor for the next page.
- Variables:
data (list[RoleBindingModel]) – The role bindings on this page.
pagination (PaginationResponse | None) – Cursor envelope for the next page, or
Noneon the final page.
- Parameters:
data (list[RoleBindingModel])
pagination (PaginationResponse | None)
Examples
>>> from pinecone.models.admin.role_binding import RoleBindingList, RoleBindingModel >>> bindings = RoleBindingList( ... data=[ ... RoleBindingModel( ... id="rb1", ... principal_type="user", ... principal_id="u1", ... resource_type="organization", ... resource_id="org-1", ... role="OrgMember", ... created_at="2026-04-10T15:23:00Z", ... ) ... ] ... ) >>> bindings.roles() ['OrgMember']
- data: list[RoleBindingModel]¶
- pagination: PaginationResponse | None¶
- class pinecone.models.admin.role_binding.RoleBindingInput(*, resource_type, role, resource_id=None)[source]¶
Bases:
StructDictMixin,StructA role to grant when creating an invite or a service account.
Unlike the response models, this is an input the SDK sends, so
resource_typeandroleare validated on construction against the values this SDK release knows about.resource_typeselects the binding scope. Fororganizationscope, omitresource_id— the binding applies to the organization inferred from the request context. Forprojectscope,resource_idis required and must be the project UUID.- Variables:
resource_type (str) – One of the
ResourceTypevalues.resource_id (str | None) – The project UUID for
projectscope; leave unset fororganizationscope.
- Raises:
PineconeValueError – If
resource_typeorroleis not a recognized value, or ifresource_typeisprojectandresource_idis missing or empty.- Parameters:
Examples
>>> from pinecone.models.admin.role_binding import ( ... ResourceType, ... RoleBindingInput, ... RoleName, ... ) >>> RoleBindingInput( ... resource_type=ResourceType.ORGANIZATION, role=RoleName.ORG_MEMBER ... ).to_dict() {'resource_type': 'organization', 'role': 'OrgMember', 'resource_id': None}
Project-scoped bindings need the project UUID:
>>> RoleBindingInput( ... resource_type="project", ... role="ProjectViewer", ... resource_id="a2f7dddb-1597-4eff-9f71-535fde243f58", ... ).resource_id 'a2f7dddb-1597-4eff-9f71-535fde243f58'
- class pinecone.models.admin.role_binding.RoleName(value)[source]¶
-
A role that can be assigned to a principal at a resource scope.
Organization-scoped roles:
OrgOwner,OrgManager,OrgMember,OrgBillingAdmin. Project-scoped roles:ProjectOwner,ProjectManager,ProjectMember,ProjectEditor,ProjectViewer,ControlPlaneEditor,ControlPlaneViewer,DataPlaneEditor,DataPlaneViewer.Examples
>>> from pinecone.models.admin.role_binding import RoleName >>> RoleName.DATA_PLANE_EDITOR == "DataPlaneEditor" True
- CONTROL_PLANE_EDITOR = 'ControlPlaneEditor'¶
- CONTROL_PLANE_VIEWER = 'ControlPlaneViewer'¶
- DATA_PLANE_EDITOR = 'DataPlaneEditor'¶
- DATA_PLANE_VIEWER = 'DataPlaneViewer'¶
- ORG_BILLING_ADMIN = 'OrgBillingAdmin'¶
- ORG_MANAGER = 'OrgManager'¶
- ORG_MEMBER = 'OrgMember'¶
- ORG_OWNER = 'OrgOwner'¶
- PROJECT_EDITOR = 'ProjectEditor'¶
- PROJECT_MANAGER = 'ProjectManager'¶
- PROJECT_MEMBER = 'ProjectMember'¶
- PROJECT_OWNER = 'ProjectOwner'¶
- PROJECT_VIEWER = 'ProjectViewer'¶
- class pinecone.models.admin.role_binding.PrincipalType(value)[source]¶
-
The kind of principal that receives permissions from a role binding.
Possible values:
user,service_account,api_key,invite.Examples
>>> from pinecone.models.admin.role_binding import PrincipalType >>> PrincipalType.SERVICE_ACCOUNT == "service_account" True
- API_KEY = 'api_key'¶
- INVITE = 'invite'¶
- SERVICE_ACCOUNT = 'service_account'¶
- USER = 'user'¶
- class pinecone.models.admin.role_binding.ResourceType(value)[source]¶
-
The kind of resource scope a role binding applies to.
Possible values:
organization,project.Examples
>>> from pinecone.models.admin.role_binding import ResourceType >>> ResourceType.PROJECT == "project" True
- ORGANIZATION = 'organization'¶
- PROJECT = 'project'¶
Assistant Models¶
- class pinecone.models.assistant.model.AssistantModel(*, name, status, metadata=None, instructions=None, host=None, region=None, created_at=None, updated_at=None)[source]¶
Bases:
AssistantModelLegacyMethodsMixin,StructDictMixin,StructResponse model for a Pinecone assistant.
- Variables:
name (str) – The name of the assistant.
status (str) – Current status of the assistant (e.g.
"Initializing","Ready","Terminating","Terminated","InitializationFailed").created_at (str | None) – ISO 8601 timestamp when the assistant was created, or
Noneif not returned by the API.updated_at (str | None) – ISO 8601 timestamp when the assistant was last updated, or
Noneif not returned by the API.metadata (dict[str, Any] | None) – Optional metadata dictionary associated with the assistant, or
Noneif not set.instructions (str | None) – Optional description or directive for the assistant to apply to all responses, or
Noneif not set.host (str | None) – The host where the assistant is deployed, or
Noneif not yet available.region (str | None) – The region the assistant is deployed in (
"us"or"eu"), orNoneif not returned by the API.
- Parameters:
- class pinecone.models.assistant.file_model.AssistantFileModel(*, name, id, metadata=None, created_on=None, updated_on=None, status=None, size=None, multimodal=None, signed_url=None, content_hash=None)[source]¶
Bases:
StructDictMixin,StructResponse model for a file attached to a Pinecone assistant.
- Variables:
name (str) – The name of the file.
id (str) – Unique identifier for the file. On
2026-07this may be a user-provided identifier, so it is not guaranteed to be a UUID.metadata (dict[str, object] | None) – Optional metadata dictionary associated with the file, or
Noneif not set.created_on (str | None) – ISO 8601 timestamp when the file was created, or
None.updated_on (str | None) – ISO 8601 timestamp when the file was last updated, or
None.status (str | None) – Current status of the file (e.g.
"Processing","Available","Deleting","ProcessingFailed"), orNone.size (int | None) – Size of the file in bytes, or
None.multimodal (bool | None) – Whether the file was processed as multimodal, or
None.signed_url (str | None) – A temporary signed URL for downloading the file, or
Nonewhen not requested or unavailable.content_hash (str | None) – Hash of the file content (wire key
crc32c_hash), orNonewhen not available. Legacy callers can also access this value via thecrc32c_hashproperty alias.
- Parameters:
percent_doneanderror_messagewere removed in the2026-07API; accessing them raises anAttributeErrornamingdescribe_operationas the replacement.- property crc32c_hash: str | None¶
Backwards-compatibility alias for
content_hash.
- class pinecone.models.assistant.list.ListAssistantsResponse(*, assistants, pagination=None)[source]¶
Bases:
StructDictMixin,StructPaginated response for listing assistants.
- Variables:
assistants (list[pinecone.models.assistant.model.AssistantModel]) – The assistants returned in this page.
pagination (pinecone.models.assistant.list._Pagination | None) – Nested pagination object from the v202604 API, or
Nonewhen no more pages exist.
- Parameters:
assistants (list[AssistantModel])
pagination (_Pagination | None)
- assistants: list[AssistantModel]¶
- class pinecone.models.assistant.list.ListFilesResponse(*, files, pagination=None)[source]¶
Bases:
StructDictMixin,StructPaginated response for listing assistant files.
- Variables:
files (list[pinecone.models.assistant.file_model.AssistantFileModel]) – The files returned in this page.
pagination (pinecone.models.assistant.list._Pagination | None) – Nested pagination object from the v202604 API, or
Nonewhen no more pages exist.
- Parameters:
files (list[AssistantFileModel])
pagination (_Pagination | None)
- files: list[AssistantFileModel]¶
- class pinecone.models.assistant.operation.OperationModel(*, operation_id, status, operation_type=None, file_id=None, created_at=None, completed_on=None, percent_complete=None, error=None, ingestion_units=None)[source]¶
Bases:
StructDictMixin,StructResponse model for a long-running assistant operation.
Returned by the file endpoints that start an operation (
POST /files/{assistant_name},PUT /files/{assistant_name}/{file_id},DELETE /files/{assistant_name}/{file_id}) and by the operations endpoints (GET /operations/{assistant_name}/{operation_id},GET /operations/{assistant_name}).The API uses
id,created_onanderror_message; the rename mapping presents them asoperation_id,created_atanderrorin Python for clarity. Every other attribute carries its wire name.Every field except
operation_idandstatusis optional so that the smaller body shipped by the2026-04upsert path still decodes. The server omitscompleted_on,error_messageandingestion_unitswhile they do not apply; a spec-conformant server may instead send them asnull. Both decode toNone.- Variables:
operation_id (str) – Unique identifier for the operation (JSON field:
id).status (str) – Current status of the operation:
"Processing"while it is in progress,"Completed"when it finished successfully,"Failed"when it did not (seeerror).operation_type (str | None) – The kind of action this operation represents —
"upload_file","upsert_file","update_file_metadata"or"delete_file"— orNonewhen the server did not report one.file_id (str | None) – Identifier of the file being operated on, or
None.created_at (str | None) – ISO 8601 timestamp when the operation was created, or
None(JSON field:created_on).completed_on (str | None) – ISO 8601 timestamp when the operation completed or failed, or
Nonewhilestatusis"Processing".percent_complete (int | None) – Progress of the operation as a percentage from 0 to 100, or
Nonewhen the server did not report progress.error (str | None) – Error message if the operation failed, or
None(JSON field:error_message). Goes stale across a retry: the backend writes this column withCOALESCE, so it is never cleared once set — a retried operation that is back to"Processing", or that eventually succeeds, still carries the earlier attempt’s text. Read it only whenstatusis"Failed".ingestion_units (float | None) – Ingestion units consumed by this operation, reported once a file ingestion operation has completed, or
None.
- Parameters:
- class pinecone.models.assistant.list.ListOperationsResponse(*, operations, pagination=None)[source]¶
Bases:
StructDictMixin,StructPaginated response for listing assistant operations.
- Variables:
operations (list[pinecone.models.assistant.operation.OperationModel]) – The operations returned in this page.
pagination (pinecone.models.assistant.list._Pagination | None) – Nested pagination object from the v202604 API, or
Nonewhen no more pages exist.
- Parameters:
operations (list[OperationModel])
pagination (_Pagination | None)
- operations: list[OperationModel]¶
- class pinecone.models.assistant.message.Message(*, content, role='user')[source]¶
Bases:
StructDictMixin,StructA message to send to an assistant.
- Variables:
content (str) – The text content of the message. Must not be blank — the backend trims before checking, so
""and a whitespace-only string alike come back 400"Message content cannot be empty".role (str) – The role of the message author. Defaults to
"user". The backend accepts only the exact strings"user"and"assistant", compared case-sensitively:"User"is rejected with 400"Role 'User' is not valid", and""with 400"Role cannot be empty". Neither field is validated client-side.
- Parameters:
- class pinecone.models.assistant.chat.ChatResponse(*, id, model, usage, message, finish_reason, citations, context_snippet_count=None, content_filter_results=None)[source]¶
Bases:
StructDictMixin,StructNon-streaming response from the assistant chat endpoint.
- Variables:
id (str) – Unique identifier for the chat response.
model (str) – The model used to generate the response.
usage (pinecone.models.assistant.chat.ChatUsage) – Token usage statistics for the request.
message (pinecone.models.assistant.chat.ChatMessage) – The assistant’s response message.
finish_reason (str) – The reason the model stopped generating — one of
"stop"(the model finished),"length"(the token limit was reached),"content_filter"(content filtering rules blocked the output),"tool_calls"(a tool call was triggered), or the literal string"null". The backend enum carries that fifthnullvariant and serializes it as the JSON string"null", not as JSONnull; the 2026-07 OASx-enumomits it, which is why this is typedstrrather than a closed set.citations (list[pinecone.models.assistant.chat.ChatCitation]) – List of citations linking response text to source documents.
context_snippet_count (int | None) – Number of retrieved context snippets that were provided to the model, or
Noneif the server did not report it.0means no relevant context was found for the query.content_filter_results (dict[str, Any] | None) – Safety classifications reported by the LLM provider, or
Nonewhen the provider returned none. The payload carries aspeckey naming the provider (e.g."openai","gemini") and aresultsvalue whose structure is defined by that provider, so it is left as a plain dict.
- Parameters:
- message: ChatMessage¶
- usage: ChatUsage¶
- class pinecone.models.assistant.chat.ChatCompletionResponse(*, id, model, usage, choices)[source]¶
Bases:
StructDictMixin,StructNon-streaming response from the OpenAI-compatible chat completion endpoint.
- Variables:
- Parameters:
- usage: ChatUsage¶
- class pinecone.models.assistant.context.ContextResponse(*, snippets, usage, id=None)[source]¶
Bases:
StructDictMixin,StructResponse from the assistant context endpoint.
- Variables:
snippets (list[pinecone.models.assistant.context.TextSnippet | pinecone.models.assistant.context.MultimodalSnippet]) – The list of context snippets.
usage (pinecone.models.assistant.chat.ChatUsage) – Token usage statistics for the request.
id (str | None) – Unique identifier for the context response, or
Noneif not included in the response.
- Parameters:
- usage: ChatUsage¶
- class pinecone.models.assistant.options.ContextOptions(*, top_k=None, snippet_size=None, multimodal=None, include_binary_content=None)[source]¶
Bases:
StructDictMixin,StructOptions controlling how context is retrieved for assistant operations.
All fields are optional and default to
None, letting the server apply its own defaults.- Variables:
top_k (int | None) – Maximum number of context snippets to retrieve. The backend accepts 1-64;
0and values above 64 are each rejected with a 400 (the spec documents a default of 16).snippet_size (int | None) – Target size (in tokens) for each context snippet. The backend accepts 512-8192; anything outside that range is rejected with a 400 (the spec documents a default of 2048).
multimodal (bool | None) – Whether to include multimodal (image) content in retrieved context.
include_binary_content (bool | None) – Whether to include binary file content in retrieved context.
- Parameters:
- class pinecone.models.assistant.evaluation.AlignmentResult(*, scores, facts, usage)[source]¶
Bases:
StructDictMixin,StructFull result of an alignment evaluation.
- Variables:
scores (pinecone.models.assistant.evaluation.AlignmentScores) – Aggregate correctness, completeness, and alignment scores.
facts (list[pinecone.models.assistant.evaluation.EntailmentResult]) – Per-fact entailment results with reasoning.
usage (pinecone.models.assistant.chat.ChatUsage) – Token usage statistics for the evaluation request.
- Parameters:
scores (AlignmentScores)
facts (list[EntailmentResult])
usage (ChatUsage)
- scores: AlignmentScores¶
- usage: ChatUsage¶
- class pinecone.models.assistant.streaming.ChatStream(stream)[source]¶
Bases:
objectWraps a Pinecone-native streaming response for convenient text access.
Iterating over this object yields the full
ChatStreamChunksequence, preserving the existing typed-chunk contract for callers that need it.text()andcollect()give direct access to text content without manual type dispatch.The stream is single-pass: iterating, calling
text(), or callingcollect()all consume the same underlying iterator.Examples
from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") stream = pc.assistants.chat( assistant_name="acme-support-bot", messages=[{"content": "What can you help me with?"}], stream=True, ) for text in stream.text(): print(text, end="", flush=True)
Use
collect()to drain the stream and return the full content as a single string:stream = pc.assistants.chat( assistant_name="acme-support-bot", messages=[{"content": "Summarize your capabilities."}], stream=True, ) full_content = stream.collect()
- Parameters:
stream (Iterator[ChatStreamChunk])
- __init__(stream)[source]¶
- Parameters:
stream (Iterator[StreamMessageStart | StreamContentChunk | StreamCitationChunk | StreamMessageEnd])
- Return type:
None
- collect()[source]¶
Drain the stream and return all content fragments concatenated.
- Returns:
The complete response as a single string.
- Return type:
Examples
from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") stream = pc.assistants.chat( assistant_name="acme-support-bot", messages=[{"content": "Explain vector databases in one sentence."}], stream=True, ) full = stream.collect() print(full)
- text()[source]¶
Yield text fragments, skipping start/citation/end chunks.
- Returns:
Iterator of text fragment strings. Each fragment is a partial response as it arrives from the server.
- Return type:
Examples
from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") stream = pc.assistants.chat( assistant_name="acme-support-bot", messages=[{"content": "Explain vector databases in one sentence."}], stream=True, ) for chunk_text in stream.text(): print(chunk_text, end="", flush=True)
- pinecone.models.assistant.streaming.ChatStreamChunk¶
Union of all Pinecone-native chat streaming chunk types.
- class pinecone.models.assistant.streaming.ChatCompletionStream(stream)[source]¶
Bases:
objectWraps an OpenAI-compatible streaming response for convenient text access.
Iterating over this object yields the full
ChatCompletionStreamChunksequence.text()filters to non-empty content fragments and handles theNonesentinel values that appear in role-only and finish chunks.The stream is single-pass: iterating, calling
text(), or callingcollect()all consume the same underlying iterator.Examples
from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") stream = pc.assistants.chat_completions( assistant_name="acme-support-bot", messages=[{"content": "What can you help me with?"}], stream=True, ) for text in stream.text(): print(text, end="", flush=True)
Use
collect()to drain the stream and return the full content as a single string:stream = pc.assistants.chat_completions( assistant_name="acme-support-bot", messages=[{"content": "Summarize your capabilities."}], stream=True, ) full_content = stream.collect()
- Parameters:
stream (Iterator[ChatCompletionStreamChunk])
- __init__(stream)[source]¶
- Parameters:
stream (Iterator[ChatCompletionStreamChunk])
- Return type:
None
- collect()[source]¶
Drain the stream and return all content fragments concatenated.
- Returns:
The complete response as a single string.
- Return type:
Examples
from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") stream = pc.assistants.chat_completions( assistant_name="acme-support-bot", messages=[{"content": "Explain vector databases in one sentence."}], stream=True, ) full = stream.collect() print(full)
- text()[source]¶
Yield non-empty content strings, skipping role-only and finish chunks.
- Returns:
Iterator of non-empty text fragment strings. Role-only chunks and finish-reason chunks with
Noneor empty content are skipped.- Return type:
Examples
from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") stream = pc.assistants.chat_completions( assistant_name="acme-support-bot", messages=[{"content": "Explain vector databases in one sentence."}], stream=True, ) for chunk_text in stream.text(): print(chunk_text, end="", flush=True)
- class pinecone.models.assistant.streaming.ChatCompletionStreamChunk(*, id, choices, model=None, object=None, created=None, system_fingerprint=None, usage=None)[source]¶
Bases:
StructDictMixin,StructA streaming chunk from the OpenAI-compatible chat completion endpoint.
- Variables:
id (str) – Unique identifier for this chunk.
choices (list[pinecone.models.assistant.streaming.ChatCompletionStreamChoice]) – List of streaming choices.
model (str | None) – The model used to generate the response, or
Noneif not provided.object (str | None) – The object type (typically
"chat.completion.chunk"), orNone.created (int | None) – Unix timestamp when the chunk was created, or
None.system_fingerprint (str | None) – Opaque fingerprint identifying the backend, or
None.usage (pinecone.models.assistant.chat.ChatUsage | None) – Token usage statistics, populated on the final chunk, or
None.
- Parameters:
- class pinecone.models.assistant.streaming.StreamMessageStart(*, model, role, id=None, context_snippet_count=None, content_filter_results=None)[source]¶
Bases:
StructDictMixin,StructFirst chunk in a chat stream, containing the model and role.
- Variables:
type – Discriminator value
"message_start".model (str) – The model used to generate the response.
role (str) – The role of the message author (e.g.
"assistant").id (str | None) – Unique identifier for this chat response, shared by every chunk in the stream, or
Noneif the server did not report it.context_snippet_count (int | None) – Number of retrieved context snippets that were provided to the model, or
Noneif the server did not report it. Arrives before any content, so a value of0lets callers react to “no relevant context found” without waiting for the full stream.content_filter_results (dict[str, Any] | None) – Safety classifications reported by the LLM provider, or
Nonewhen the provider returned none. The payload carries aspeckey naming the provider (e.g."openai","gemini") and aresultsvalue whose structure is defined by that provider, so it is left as a plain dict.
- Parameters:
- class pinecone.models.assistant.streaming.StreamMessageEnd(*, id, usage=None, model=None, finish_reason=None, content_filter_results=None)[source]¶
Bases:
StructDictMixin,StructFinal chunk in a chat stream, containing token usage statistics.
- Variables:
type – Discriminator value
"message_end".id (str) – Unique identifier for this chunk.
usage (pinecone.models.assistant.chat.ChatUsage | None) – Token usage statistics for the request.
model (str | None) – The model used to generate this response, or
Noneif not provided.finish_reason (str | None) – The reason generation stopped — one of
"stop"(the model finished),"length"(the token limit was reached),"content_filter"(content filtering rules blocked the output),"tool_calls"(a tool call was triggered), or the literal string"null". The backend enum carries that fifthnullvariant and serializes it as the JSON string"null", not as JSONnull; the 2026-07 OASx-enumomits it. PythonNoneis distinct, and only appears for payloads recorded before the field was documented.content_filter_results (dict[str, Any] | None) – Safety classifications reported by the LLM provider, or
Nonewhen the provider returned none. The payload carries aspeckey naming the provider (e.g."openai","gemini") and aresultsvalue whose structure is defined by that provider, so it is left as a plain dict.
- Parameters:
- class pinecone.models.assistant.streaming.StreamContentChunk(*, id, delta, model=None, content_filter_results=None)[source]¶
Bases:
StructDictMixin,StructA content chunk containing a text fragment in a delta object.
- Variables:
type – Discriminator value
"content_chunk".id (str) – Unique identifier for this chunk.
delta (pinecone.models.assistant.streaming.StreamContentDelta) – The delta object containing the text fragment.
model (str | None) – The model used to generate this response, or
Noneif not provided.content_filter_results (dict[str, Any] | None) – Safety classifications reported by the LLM provider for this fragment, or
Nonewhen the provider returned none. The payload carries aspeckey naming the provider (e.g."openai","gemini") and aresultsvalue whose structure is defined by that provider, so it is left as a plain dict.
- Parameters:
- delta: StreamContentDelta¶
- class pinecone.models.assistant.streaming.StreamCitationChunk(*, id, citation, model=None)[source]¶
Bases:
StructDictMixin,StructA citation chunk linking response text to source references.
- Variables:
- Parameters:
- citation: ChatCitation¶
- class pinecone.models.assistant.streaming.AsyncChatStream(stream)[source]¶
Bases:
objectAsync version of
ChatStreamfor use withAsyncPinecone.The stream is single-pass: iterating, calling
text(), or callingcollect()all consume the same underlying async iterator.Examples
import asyncio from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") async def main() -> None: stream = await pc.assistants.chat( assistant_name="acme-support-bot", messages=[{"content": "What can you help me with?"}], stream=True, ) async for text in stream.text(): print(text, end="", flush=True) asyncio.run(main())
Use
collect()to drain the stream and return the full content as a single string:async def main() -> None: stream = await pc.assistants.chat( assistant_name="acme-support-bot", messages=[{"content": "Summarize your capabilities."}], stream=True, ) full_content = await stream.collect() asyncio.run(main())
- Parameters:
stream (AsyncIterator[ChatStreamChunk])
- __init__(stream)[source]¶
- Parameters:
stream (AsyncIterator[StreamMessageStart | StreamContentChunk | StreamCitationChunk | StreamMessageEnd])
- Return type:
None
- async collect()[source]¶
Drain the stream and return all content fragments concatenated.
- Returns:
The complete response as a single string.
- Return type:
Examples
import asyncio from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") async def main() -> None: stream = await pc.assistants.chat( assistant_name="acme-support-bot", messages=[{"content": "Explain vector databases in one sentence."}], stream=True, ) full = await stream.collect() print(full) asyncio.run(main())
- async text()[source]¶
Yield text fragments, skipping start/citation/end chunks.
- Returns:
Async iterator of text fragment strings. Each fragment is a partial response as it arrives from the server.
- Return type:
Examples
import asyncio from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") async def main() -> None: stream = await pc.assistants.chat( assistant_name="acme-support-bot", messages=[{"content": "Explain vector databases in one sentence."}], stream=True, ) async for chunk_text in stream.text(): print(chunk_text, end="", flush=True) asyncio.run(main())
- class pinecone.models.assistant.streaming.AsyncChatCompletionStream(stream)[source]¶
Bases:
objectAsync version of
ChatCompletionStreamfor use withAsyncPinecone.The stream is single-pass: iterating, calling
text(), or callingcollect()all consume the same underlying async iterator.Examples
import asyncio from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") async def main() -> None: stream = await pc.assistants.chat_completions( assistant_name="acme-support-bot", messages=[{"content": "What can you help me with?"}], stream=True, ) async for text in stream.text(): print(text, end="", flush=True) asyncio.run(main())
Use
collect()to drain the stream and return the full content as a single string:async def main() -> None: stream = await pc.assistants.chat_completions( assistant_name="acme-support-bot", messages=[{"content": "Summarize your capabilities."}], stream=True, ) full_content = await stream.collect() asyncio.run(main())
- Parameters:
stream (AsyncIterator[ChatCompletionStreamChunk])
- __init__(stream)[source]¶
- Parameters:
stream (AsyncIterator[ChatCompletionStreamChunk])
- Return type:
None
- async collect()[source]¶
Drain the stream and return all content fragments concatenated.
- Returns:
The complete response as a single string.
- Return type:
Examples
import asyncio from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") async def main() -> None: stream = await pc.assistants.chat_completions( assistant_name="acme-support-bot", messages=[{"content": "Explain vector databases in one sentence."}], stream=True, ) full = await stream.collect() print(full) asyncio.run(main())
- async text()[source]¶
Yield non-empty content strings, skipping role-only and finish chunks.
- Returns:
Async iterator of non-empty text fragment strings. Role-only chunks and finish-reason chunks with
Noneor empty content are skipped.- Return type:
Examples
import asyncio from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") async def main() -> None: stream = await pc.assistants.chat_completions( assistant_name="acme-support-bot", messages=[{"content": "Explain vector databases in one sentence."}], stream=True, ) async for chunk_text in stream.text(): print(chunk_text, end="", flush=True) asyncio.run(main())
Filter Builder¶
- class pinecone.utils.filter_builder.Field(name)[source]¶
Bases:
objectRepresents a metadata field name for building filter expressions.
Usage:
Field("genre") == "drama" # {"genre": {"$eq": "drama"}} Field("score").gt(0.5) # {"score": {"$gt": 0.5}}
- Parameters:
name (str)