Implementation:Openai Openai python Vector Store Model
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Python |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete tool for representing a VectorStore resource returned by the OpenAI Vector Stores API, provided by the openai-python SDK.
Description
VectorStore is a Pydantic BaseModel subclass that models a collection of processed files used by the file_search tool. It includes nested models FileCounts (tracking file processing states) and ExpiresAfter (configuring expiration based on last activity). The model tracks status (expired, in_progress, or completed), usage_bytes, optional metadata, and expiration settings.
Usage
Import this type when you need to type-annotate or inspect responses from vector store endpoints such as client.vector_stores.create(), client.vector_stores.retrieve(), client.vector_stores.list(), or client.vector_stores.update().
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/vector_store.py
Signature
class FileCounts(BaseModel):
cancelled: int
completed: int
failed: int
in_progress: int
total: int
class ExpiresAfter(BaseModel):
anchor: Literal["last_active_at"]
days: int
class VectorStore(BaseModel):
id: str
created_at: int
file_counts: FileCounts
last_active_at: Optional[int] = None
metadata: Optional[Metadata] = None
name: str
object: Literal["vector_store"]
status: Literal["expired", "in_progress", "completed"]
usage_bytes: int
expires_after: Optional[ExpiresAfter] = None
expires_at: Optional[int] = None
Import
from openai.types import VectorStore
I/O Contract
Fields (VectorStore)
| Name | Type | Required | Description |
|---|---|---|---|
| id | str | Yes | The identifier, which can be referenced in API endpoints. |
| created_at | int | Yes | The Unix timestamp (in seconds) for when the vector store was created. |
| file_counts | FileCounts | Yes | Nested object with file processing counts. |
| last_active_at | Optional[int] | No | The Unix timestamp (in seconds) for when the vector store was last active. |
| metadata | Optional[Metadata] | No | Set of 16 key-value pairs attached to the object. |
| name | str | Yes | The name of the vector store. |
| object | Literal["vector_store"] | Yes | The object type, always "vector_store". |
| status | Literal["expired", "in_progress", "completed"] | Yes | The status of the vector store. |
| usage_bytes | int | Yes | The total number of bytes used by the files in the vector store. |
| expires_after | Optional[ExpiresAfter] | No | The expiration policy for the vector store. |
| expires_at | Optional[int] | No | The Unix timestamp (in seconds) for when the vector store will expire. |
Fields (FileCounts)
| Name | Type | Required | Description |
|---|---|---|---|
| cancelled | int | Yes | The number of files that were cancelled. |
| completed | int | Yes | The number of files that have been successfully processed. |
| failed | int | Yes | The number of files that have failed to process. |
| in_progress | int | Yes | The number of files currently being processed. |
| total | int | Yes | The total number of files. |
Usage Examples
from openai import OpenAI
from openai.types import VectorStore
client = OpenAI()
vs: VectorStore = client.vector_stores.create(name="Knowledge Base")
print(vs.id) # "vs_abc123"
print(vs.status) # "in_progress"
print(vs.file_counts.completed) # 0
print(vs.usage_bytes) # 0