vector_stores
Creates, updates, deletes, gets or lists a vector_stores resource.
Overview
| Name | vector_stores |
| Type | Resource |
| Id | openai.vector_stores.vector_stores |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier, which can be referenced in API endpoints. |
name | string | The name of the vector store. |
created_at | integer (unixtime) | The Unix timestamp (in seconds) for when the vector store was created. |
expires_after | object | The expiration policy for a vector store. (title: Vector store expiration policy) |
expires_at | integer (unixtime) | The Unix timestamp (in seconds) for when the vector store will expire. |
file_counts | object | |
last_active_at | integer (unixtime) | The Unix timestamp (in seconds) for when the vector store was last active. |
metadata | 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, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map) |
object | string | The object type, which is always vector_store. (vector_store) |
status | string | The status of the vector store, which can be either expired, in_progress, or completed. A status of completed indicates that the vector store is ready for use. (expired, in_progress, completed) |
usage_bytes | integer | The total number of bytes used by the files in the vector store. |
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier, which can be referenced in API endpoints. |
name | string | The name of the vector store. |
created_at | integer (unixtime) | The Unix timestamp (in seconds) for when the vector store was created. |
expires_after | object | The expiration policy for a vector store. (title: Vector store expiration policy) |
expires_at | integer (unixtime) | The Unix timestamp (in seconds) for when the vector store will expire. |
file_counts | object | |
last_active_at | integer (unixtime) | The Unix timestamp (in seconds) for when the vector store was last active. |
metadata | 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, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map) |
object | string | The object type, which is always vector_store. (vector_store) |
status | string | The status of the vector store, which can be either expired, in_progress, or completed. A status of completed indicates that the vector store is ready for use. (expired, in_progress, completed) |
usage_bytes | integer | The total number of bytes used by the files in the vector store. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | vector_store_id | openai-organization, openai-project | |
list | select | limit, order, after, before, openai-organization, openai-project | ||
create | insert | openai-organization, openai-project | ||
update | update | vector_store_id | openai-organization, openai-project | |
delete | delete | vector_store_id | openai-organization, openai-project | |
search | exec | vector_store_id, query | openai-organization, openai-project |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
vector_store_id | string | The ID of the vector store to search. |
after | string | A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. |
before | string | A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
limit | integer | A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL LIMIT clause - SELECT ... LIMIT 10 sends limit=10 on the wire. Setting it explicitly in a WHERE clause is not required. |
openai-organization | string | Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as openai_organization. |
openai-project | string | Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as openai_project. |
order | string | Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. |
SELECT examples
- get
- list
OK
SELECT
id,
name,
created_at,
expires_after,
expires_at,
file_counts,
last_active_at,
metadata,
object,
status,
usage_bytes
FROM openai.vector_stores.vector_stores
WHERE vector_store_id = '{{ vector_store_id }}' -- required
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;
OK
SELECT
id,
name,
created_at,
expires_after,
expires_at,
file_counts,
last_active_at,
metadata,
object,
status,
usage_bytes
FROM openai.vector_stores.vector_stores
WHERE "order" = '{{ order }}'
AND after = '{{ after }}'
AND before = '{{ before }}'
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;
INSERT examples
- create
- Manifest
No description available.
INSERT INTO openai.vector_stores.vector_stores (
file_ids,
name,
description,
expires_after,
chunking_strategy,
metadata,
"openai-organization",
"openai-project"
)
SELECT
'{{ file_ids }}',
'{{ name }}',
'{{ description }}',
'{{ expires_after }}',
'{{ chunking_strategy }}',
'{{ metadata }}',
'{{ openai-organization }}',
'{{ openai-project }}'
RETURNING
id,
name,
created_at,
expires_after,
expires_at,
file_counts,
last_active_at,
metadata,
object,
status,
usage_bytes
;
# Description fields are for documentation purposes
- name: vector_stores
props:
- name: file_ids
value:
- "{{ file_ids }}"
description: |
A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files.
- name: name
value: "{{ name }}"
description: |
The name of the vector store.
- name: description
value: "{{ description }}"
description: |
A description for the vector store. Can be used to describe the vector store's purpose.
- name: expires_after
description: |
The expiration policy for a vector store.
value:
anchor: "{{ anchor }}"
days: {{ days }}
- name: chunking_strategy
description: |
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.
value:
type: "{{ type }}"
static:
max_chunk_size_tokens: {{ max_chunk_size_tokens }}
chunk_overlap_tokens: {{ chunk_overlap_tokens }}
- name: metadata
value: "{{ metadata }}"
description: |
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, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings
with a maximum length of 512 characters.
- name: openai-organization
value: "{{ openai-organization }}"
description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
- name: openai-project
value: "{{ openai-project }}"
description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
UPDATE examples
- update
No description available.
UPDATE openai.vector_stores.vector_stores
SET
name = '{{ name }}',
expires_after = '{{ expires_after }}',
metadata = '{{ metadata }}'
WHERE
vector_store_id = '{{ vector_store_id }}' --required
AND "openai-organization" = '{{ openai-organization}}'
AND "openai-project" = '{{ openai-project}}'
RETURNING
id,
name,
created_at,
expires_after,
expires_at,
file_counts,
last_active_at,
metadata,
object,
status,
usage_bytes;
DELETE examples
- delete
No description available.
DELETE FROM openai.vector_stores.vector_stores
WHERE vector_store_id = '{{ vector_store_id }}' --required
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;
Lifecycle Methods
- search
OK
EXEC openai.vector_stores.vector_stores.search
@vector_store_id='{{ vector_store_id }}' --required,
@openai-organization='{{ openai-organization }}',
@openai-project='{{ openai-project }}'
@@json=
'{
"query": "{{ query }}",
"rewrite_query": {{ rewrite_query }},
"max_num_results": {{ max_num_results }},
"filters": "{{ filters }}",
"ranking_options": "{{ ranking_options }}"
}'
;