Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI & ML · Const

Vector Database

A vector store is an OpenAI-managed container for files used in semantic search. Files are automatically chunked, embedded, and indexed when added, and natural-language queries return relevant content.

How it works

A vector store is an OpenAI-managed container for searchable files. Adding a file causes it to be chunked, embedded, and indexed; semantic search then returns relevant chunks, similarity scores, and their source files.

Syntax

client.vector_stores.search(vector_store_id=VECTOR_STORE_ID, query=QUERY)

Parameters

NameTypeDescription
vector_store_idstringIdentifier of the vector store to search.
querystringNatural-language text describing the information to retrieve.

Returns

A list of search results containing relevant chunks, similarity scores, and the source file for each result.

Key points

  • A vector store is the searchable container used by both the Retrieval API and the file search tool.
  • Files become searchable through automatic chunking, embedding, and indexing when added.
  • Semantic retrieval uses the search operation with a natural-language query.
  • Search results include matching chunks, similarity scores, and the originating file.
  • The store's file entries are vector_store_file objects backed by Files API file objects.

Common mistakes

  • Adding a file triggers automatic chunking, embedding, and indexing, so the searchable representation is generated by the service.

Example: Create and search a vector store

from openai import OpenAI

client = OpenAI()

vector_store = client.vector_stores.create(name="Product documentation")
client.vector_stores.files.create(
    vector_store_id=vector_store.id,
    file_id="file_abc123",
)

results = client.vector_stores.search(
    vector_store_id=vector_store.id,
    query="How do I configure authentication?",
)

for result in results.data:
    print(result.content[0].text)

Creates a vector store, associates an uploaded file with it, and searches the indexed content with a natural-language query.

When to use it

Documentation search

Retrieve relevant passages from uploaded product or technical documentation.

Retrieval-augmented generation

Ground model responses in an organization's uploaded files.

File search

Use OpenAI's built-in file search over indexed files.

  • Retrieval API
  • File Search
  • Files API
  • vector_store
  • vector_store_file
  • semantic search

Source: Retrieval | OpenAI API. Checked 2026-10-15.