Skip to content

Count Vectors

vector_stores.count(strvector_store_name, VectorStoreCountParams**kwargs) -> VectorStoreCountResponse
POST/v5/vector-stores/{vector_store_name}/count

Count documents in a vector store, optionally filtered by metadata.

Use Cases:

  • Monitor vector store size and growth over time
  • Preview the number of documents matching a filter before deletion
  • Validate data ingestion by comparing expected versus actual document counts
  • Analyze document distribution across metadata categories

Filtering: Apply the same metadata filter syntax as delete and list operations. Only indexed fields can be used for filtering. An empty filter counts all documents in the store.

ParametersExpand Collapse
vector_store_name: str

The name of the vector store

filter: Optional[Dict[str, object]]

Metadata filter expression

ReturnsExpand Collapse
class VectorStoreCountResponse: …

Response for count operation.

count: int

Number of documents matching the criteria

Count Vectors

import os
from scale_gp_beta import SGPClient

client = SGPClient(
    api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
)
response = client.vector_stores.count(
    vector_store_name="vector_store_name",
)
print(response.count)
{
  "count": 0
}
Returns Examples
{
  "count": 0
}