Implementation:Openai Openai python Vector Store Create Params
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Python |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete tool for specifying parameters when creating a VectorStore via the OpenAI API, provided by the openai-python SDK.
Description
VectorStoreCreateParams is a TypedDict defining all optional parameters for creating a new vector store. It supports chunking_strategy (how files are split), description, expires_after (expiration policy), file_ids (initial files to attach), metadata (key-value pairs), and name. All fields are optional since no single field is required to create a vector store. A nested ExpiresAfter TypedDict configures the expiration anchor and day count.
Usage
Import this type when you need to type-annotate keyword arguments for client.vector_stores.create() or when building parameter dictionaries programmatically for vector store creation.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/vector_store_create_params.py
Signature
class VectorStoreCreateParams(TypedDict, total=False):
chunking_strategy: FileChunkingStrategyParam
description: str
expires_after: ExpiresAfter
file_ids: SequenceNotStr[str]
metadata: Optional[Metadata]
name: str
class ExpiresAfter(TypedDict, total=False):
anchor: Required[Literal["last_active_at"]]
days: Required[int]
Import
from openai.types import VectorStoreCreateParams
I/O Contract
Fields (VectorStoreCreateParams)
| Name | Type | Required | Description |
|---|---|---|---|
| chunking_strategy | FileChunkingStrategyParam | No | The chunking strategy used to chunk the file(s). Defaults to auto strategy. |
| description | str | No | A description for the vector store. |
| expires_after | ExpiresAfter | No | The expiration policy for the vector store. |
| file_ids | SequenceNotStr[str] | No | A list of File IDs that the vector store should use. |
| metadata | Optional[Metadata] | No | Set of 16 key-value pairs attached to the object. |
| name | str | No | The name of the vector store. |
Fields (ExpiresAfter)
| Name | Type | Required | Description |
|---|---|---|---|
| anchor | Literal["last_active_at"] | Yes | Anchor timestamp after which the expiration policy applies. |
| days | int | Yes | The number of days after the anchor time that the vector store will expire. |
Usage Examples
from openai import OpenAI
from openai.types import VectorStoreCreateParams
client = OpenAI()
params: VectorStoreCreateParams = {
"name": "Product Documentation",
"file_ids": ["file-abc123", "file-def456"],
"expires_after": {
"anchor": "last_active_at",
"days": 7,
},
"metadata": {"project": "docs"},
}
vs = client.vector_stores.create(**params)