Documentation search
Retrieve relevant passages from uploaded product or technical documentation.
AI & ML · Const
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.
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.
client.vector_stores.search(vector_store_id=VECTOR_STORE_ID, query=QUERY)| Name | Type | Description |
|---|---|---|
vector_store_id | string | Identifier of the vector store to search. |
query | string | Natural-language text describing the information to retrieve. |
A list of search results containing relevant chunks, similarity scores, and the source file for each result.
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.
Retrieve relevant passages from uploaded product or technical documentation.
Ground model responses in an organization's uploaded files.
Use OpenAI's built-in file search over indexed files.
Retrieval APIFile SearchFiles APIvector_storevector_store_filesemantic search