Vector Stores
Create Vector Store
POST
/
v1
/
vector_stores
from openai import OpenAI
client = OpenAI()
vector_store = client.beta.vector_stores.create(
name="Product Documentation",
file_ids=["file-abc123", "file-abc456"],
metadata={"project": "customer_support"}
)
print(vector_store.id)
import OpenAI from "openai";
const openai = new OpenAI();
const vectorStore = await openai.beta.vectorStores.create({
name: "Product Documentation",
file_ids: ["file-abc123", "file-abc456"],
metadata: { project: "customer_support" }
});
console.log(vectorStore.id);
curl https://api.openai.com/v1/vector_stores \\
-H "Authorization: Bearer $OPENAI_API_KEY" \\
-H "Content-Type: application/json" \\
-H "OpenAI-Beta: assistants=v2" \\
-d '{
"name": "Product Documentation",
"file_ids": ["file-abc123", "file-abc456"]
}'
{
"id": "vs_abc123",
"object": "vector_store",
"name": "Product Documentation",
"status": "in_progress",
"usage_bytes": 0,
"created_at": 1699061776,
"file_counts": {
"in_progress": 2,
"completed": 0,
"failed": 0,
"cancelled": 0,
"total": 2
},
"metadata": {
"project": "customer_support"
},
"expires_after": null,
"expires_at": null
}
Create a vector store.
Request Body
string
The name of the vector store.
array
A list of File IDs that the vector store should use. Useful for tools like
file_search that can access files.string
A description for the vector store. Can be used to describe the vector store’s purpose.
object
object
The chunking strategy used to chunk the file(s). If not set, will use the
auto strategy. Only applicable if file_ids is non-empty.object
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format.Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
Response
Returns aVectorStore object.
string
The identifier, which can be referenced in API endpoints.
string
The object type, always
vector_store.string
The name of the vector store.
string
The status of the vector store. One of:
expiredin_progresscompleted
object
Counts of files by status.
integer
The Unix timestamp (in seconds) for when the vector store was created.
integer
The total number of bytes used by the files in the vector store.
from openai import OpenAI
client = OpenAI()
vector_store = client.beta.vector_stores.create(
name="Product Documentation",
file_ids=["file-abc123", "file-abc456"],
metadata={"project": "customer_support"}
)
print(vector_store.id)
import OpenAI from "openai";
const openai = new OpenAI();
const vectorStore = await openai.beta.vectorStores.create({
name: "Product Documentation",
file_ids: ["file-abc123", "file-abc456"],
metadata: { project: "customer_support" }
});
console.log(vectorStore.id);
curl https://api.openai.com/v1/vector_stores \\
-H "Authorization: Bearer $OPENAI_API_KEY" \\
-H "Content-Type: application/json" \\
-H "OpenAI-Beta: assistants=v2" \\
-d '{
"name": "Product Documentation",
"file_ids": ["file-abc123", "file-abc456"]
}'
{
"id": "vs_abc123",
"object": "vector_store",
"name": "Product Documentation",
"status": "in_progress",
"usage_bytes": 0,
"created_at": 1699061776,
"file_counts": {
"in_progress": 2,
"completed": 0,
"failed": 0,
"cancelled": 0,
"total": 2
},
"metadata": {
"project": "customer_support"
},
"expires_after": null,
"expires_at": null
}
from openai import OpenAI
client = OpenAI()
vector_store = client.beta.vector_stores.create(
name="Product Documentation",
file_ids=["file-abc123", "file-abc456"],
metadata={"project": "customer_support"}
)
print(vector_store.id)
import OpenAI from "openai";
const openai = new OpenAI();
const vectorStore = await openai.beta.vectorStores.create({
name: "Product Documentation",
file_ids: ["file-abc123", "file-abc456"],
metadata: { project: "customer_support" }
});
console.log(vectorStore.id);
curl https://api.openai.com/v1/vector_stores \\
-H "Authorization: Bearer $OPENAI_API_KEY" \\
-H "Content-Type: application/json" \\
-H "OpenAI-Beta: assistants=v2" \\
-d '{
"name": "Product Documentation",
"file_ids": ["file-abc123", "file-abc456"]
}'
{
"id": "vs_abc123",
"object": "vector_store",
"name": "Product Documentation",
"status": "in_progress",
"usage_bytes": 0,
"created_at": 1699061776,
"file_counts": {
"in_progress": 2,
"completed": 0,
"failed": 0,
"cancelled": 0,
"total": 2
},
"metadata": {
"project": "customer_support"
},
"expires_after": null,
"expires_at": null
}