Vector Stores API

Create and manage vector stores, along with their files and file batches, that power the Responses file_search tool. Upload files via the Files API first. OpenAI only.

Objects

UniLM.VectorStoreObjectType
VectorStoreObject

A vector store from the Vector Stores API: id, name, status, and file_counts; raw holds the unparsed JSON response.

source
UniLM.VectorStoreFileBatchType
VectorStoreFileBatch

A batch of files added to a vector store: id, status, and file_counts; raw holds the unparsed JSON response.

source

Result Types

Request Functions

UniLM.create_vector_storeFunction
create_vector_store(; name=nothing, file_ids=nothing, expires_after=nothing,
                    chunking_strategy=nothing, metadata=nothing, service=OPENAIServiceEndpoint)

Create a vector store. Returns VectorStoreSuccess, VectorStoreFailure, or VectorStoreCallError.

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.retrieve_vector_storeFunction
retrieve_vector_store(id; service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.list_vector_storesFunction
list_vector_stores(; limit=nothing, after=nothing, service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.delete_vector_storeFunction
delete_vector_store(id; service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.add_vector_store_fileFunction
add_vector_store_file(vector_store_id, file_id; chunking_strategy=nothing, service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.create_file_batchFunction
create_file_batch(vector_store_id, file_ids; chunking_strategy=nothing, service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.retrieve_file_batchFunction
retrieve_file_batch(vector_store_id, batch_id; service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.poll_file_batchFunction
poll_file_batch(vector_store_id, batch_id; interval=2.0, timeout=300.0, service=OPENAIServiceEndpoint)

Poll a file batch until it reaches a terminal status (completed/failed/cancelled) or the timeout elapses. Returns the terminal VectorStoreBatchSuccess, or a VectorStoreCallError on timeout.

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source

Accessors

Usage

# Create a vector store, then add files already uploaded via the Files API
store = create_vector_store(name="docs")
store isa VectorStoreSuccess && println("Created: ", vector_store_id(store.response))
vs = vector_store_id(store.response)

# Add a single file, or a batch, then poll the batch to a terminal status
add_vector_store_file(vs, "file-abc123")
batch = create_file_batch(vs, ["file-abc123", "file-def456"])
batch isa VectorStoreBatchSuccess && poll_file_batch(vs, batch.response.id)

# List, retrieve, delete
stores = list_vector_stores(limit=10)
retrieve_vector_store(vs)
delete_vector_store(vs)