View Source ExOpenAI.VectorStores (ex_openai.ex v1.7.0)
Modules for interacting with the vector_stores
group of OpenAI APIs
API Reference: https://platform.openai.com/docs/api-reference/vector_stores
Summary
Functions
Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
Create a vector store.
Create a vector store file by attaching a File to a vector store.
Create a vector store file batch.
Delete a vector store.
Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint.
Retrieves a vector store.
Retrieves a vector store file.
Retrieves a vector store file batch.
Returns a list of vector store files in a batch.
Returns a list of vector store files.
Returns a list of vector stores.
Modifies a vector store.
Functions
cancel_vector_store_file_batch(vector_store_id, batch_id, opts \\ [])
View Source@spec cancel_vector_store_file_batch(String.t(), String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t() ) :: {:ok, ExOpenAI.Components.VectorStoreFileBatchObject.t()} | {:error, any()}
Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel
Method: POST
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
batch_id
Optional Arguments:
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
@spec create_vector_store( base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t(), name: String.t(), metadata: map(), file_ids: [String.t()], expires_after: ExOpenAI.Components.VectorStoreExpirationAfter.t(), chunking_strategy: ExOpenAI.Components.StaticChunkingStrategyRequestParam.t() | ExOpenAI.Components.AutoChunkingStrategyRequestParam.t(), stream_to: (... -> any()) | pid() ) :: {:ok, ExOpenAI.Components.VectorStoreObject.t()} | {:error, any()}
Create a vector store.
Endpoint: https://api.openai.com/v1/vector_stores
Method: POST
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
Optional Arguments:
stream_to
: PID or function of where to stream content tochunking_strategy
: The chunking strategy used to chunk the file(s). If not set, will use theauto
strategy. Only applicable iffile_ids
is non-empty.expires_after
:file_ids
: A list of File IDs that the vector store should use. Useful for tools likefile_search
that can access files.metadata
: 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 can be a maximum of 64 characters long and values can be a maxium of 512 characters long.name
: The name of the vector store.openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
@spec create_vector_store_file(String.t(), String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t(), chunking_strategy: ExOpenAI.Components.ChunkingStrategyRequestParam.t(), stream_to: (... -> any()) | pid() ) :: {:ok, ExOpenAI.Components.VectorStoreFileObject.t()} | {:error, any()}
Create a vector store file by attaching a File to a vector store.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}/files
Method: POST
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
Example: vs_abc123
file_id
: A File ID that the vector store should use. Useful for tools likefile_search
that can access files.
Optional Arguments:
stream_to
: PID or function of where to stream content tochunking_strategy
:openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
create_vector_store_file_batch(vector_store_id, file_ids, opts \\ [])
View Source@spec create_vector_store_file_batch( String.t(), [String.t()], base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t(), chunking_strategy: ExOpenAI.Components.ChunkingStrategyRequestParam.t(), stream_to: (... -> any()) | pid() ) :: {:ok, ExOpenAI.Components.VectorStoreFileBatchObject.t()} | {:error, any()}
Create a vector store file batch.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches
Method: POST
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
Example: vs_abc123
file_ids
: A list of File IDs that the vector store should use. Useful for tools likefile_search
that can access files.
Optional Arguments:
stream_to
: PID or function of where to stream content tochunking_strategy
:openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
@spec delete_vector_store(String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t() ) :: {:ok, ExOpenAI.Components.DeleteVectorStoreResponse.t()} | {:error, any()}
Delete a vector store.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}
Method: DELETE
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
Optional Arguments:
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
@spec delete_vector_store_file(String.t(), String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t() ) :: {:ok, ExOpenAI.Components.DeleteVectorStoreFileResponse.t()} | {:error, any()}
Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}/files/{file_id}
Method: DELETE
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
file_id
Optional Arguments:
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
@spec get_vector_store(String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t() ) :: {:ok, ExOpenAI.Components.VectorStoreObject.t()} | {:error, any()}
Retrieves a vector store.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}
Method: GET
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
Optional Arguments:
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
@spec get_vector_store_file(String.t(), String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t() ) :: {:ok, ExOpenAI.Components.VectorStoreFileObject.t()} | {:error, any()}
Retrieves a vector store file.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}/files/{file_id}
Method: GET
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
Example: vs_abc123
file_id
Example: file-abc123
Optional Arguments:
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
get_vector_store_file_batch(vector_store_id, batch_id, opts \\ [])
View Source@spec get_vector_store_file_batch(String.t(), String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t() ) :: {:ok, ExOpenAI.Components.VectorStoreFileBatchObject.t()} | {:error, any()}
Retrieves a vector store file batch.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}
Method: GET
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
Example: vs_abc123
batch_id
Example: vsfb_abc123
Optional Arguments:
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
list_files_in_vector_store_batch(vector_store_id, batch_id, opts \\ [])
View Source@spec list_files_in_vector_store_batch(String.t(), String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t(), filter: String.t(), before: String.t(), after: String.t(), order: String.t(), limit: integer(), stream_to: (... -> any()) | pid() ) :: {:ok, ExOpenAI.Components.ListVectorStoreFilesResponse.t()} | {:error, any()}
Returns a list of vector store files in a batch.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files
Method: GET
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
batch_id
Optional Arguments:
stream_to
: PID or function of where to stream content tolimit
order
after
before
filter
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
@spec list_vector_store_files(String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t(), filter: String.t(), before: String.t(), after: String.t(), order: String.t(), limit: integer(), stream_to: (... -> any()) | pid() ) :: {:ok, ExOpenAI.Components.ListVectorStoreFilesResponse.t()} | {:error, any()}
Returns a list of vector store files.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}/files
Method: GET
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
Optional Arguments:
stream_to
: PID or function of where to stream content tolimit
order
after
before
filter
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
@spec list_vector_stores( base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t(), before: String.t(), after: String.t(), order: String.t(), limit: integer(), stream_to: (... -> any()) | pid() ) :: {:ok, ExOpenAI.Components.ListVectorStoresResponse.t()} | {:error, any()}
Returns a list of vector stores.
Endpoint: https://api.openai.com/v1/vector_stores
Method: GET
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
Optional Arguments:
stream_to
: PID or function of where to stream content tolimit
order
after
before
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1
@spec modify_vector_store(String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t(), name: String.t(), metadata: map(), expires_after: ExOpenAI.Components.VectorStoreExpirationAfter.t(), stream_to: (... -> any()) | pid() ) :: {:ok, ExOpenAI.Components.VectorStoreObject.t()} | {:error, any()}
Modifies a vector store.
Endpoint: https://api.openai.com/v1/vector_stores/{vector_store_id}
Method: POST
Docs: https://platform.openai.com/docs/api-reference/vector_stores
Required Arguments:
vector_store_id
Optional Arguments:
stream_to
: PID or function of where to stream content toexpires_after
:metadata
: 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 can be a maximum of 64 characters long and values can be a maxium of 512 characters long.name
: The name of the vector store.openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.base_url
: Which API endpoint to use as base, defaults to https://api.openai.com/v1