Class VectorStoresEndpoint
- Namespace
- OpenAI.VectorStores
- Assembly
- OpenAI-DotNet.dll
Vector stores are used to store files for use by the file_search tool. https://platform.openai.com/docs/api-reference/vector-stores
public sealed class VectorStoresEndpoint : OpenAIBaseEndpoint
- Inheritance
-
VectorStoresEndpoint
- Inherited Members
Constructors
VectorStoresEndpoint(OpenAIClient)
public VectorStoresEndpoint(OpenAIClient client)
Parameters
clientOpenAIClient
Properties
Root
The root endpoint address.
protected override string Root { get; }
Property Value
Methods
CancelVectorStoreFileBatchAsync(string, string, CancellationToken)
Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
public Task<bool> CancelVectorStoreFileBatchAsync(string vectorStoreId, string fileBatchId, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store that the files belong to.
fileBatchIdstringThe ID of the file batch being retrieved.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
CreateVectorStoreAsync(CreateVectorStoreRequest, CancellationToken)
Creates a new Vector Store.
public Task<VectorStoreResponse> CreateVectorStoreAsync(CreateVectorStoreRequest request, CancellationToken cancellationToken = default)
Parameters
requestCreateVectorStoreRequestcancellationTokenCancellationTokenOptional CancellationToken.
Returns
CreateVectorStoreFileAsync(string, string, ChunkingStrategy, CancellationToken)
Create a vector store file by attaching a File to a vector store.
public Task<VectorStoreFileResponse> CreateVectorStoreFileAsync(string vectorStoreId, string fileId, ChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store that the file belongs to.
fileIdstringA File ID that the vector store should use. Useful for tools like file_search that can access files.
chunkingStrategyChunkingStrategyA file id that the vector store should use. Useful for tools like 'file_search' that can access files.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
CreateVectorStoreFileBatchAsync(string, IReadOnlyList<FileResponse>, ChunkingStrategy, CancellationToken)
Create a vector store file batch.
public Task<VectorStoreFileBatchResponse> CreateVectorStoreFileBatchAsync(string vectorStoreId, IReadOnlyList<FileResponse> files, ChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store for which to create a File Batch.
filesIReadOnlyList<FileResponse>A list of Files that the vector store should use. Useful for tools like file_search that can access files.
chunkingStrategyChunkingStrategyA file id that the vector store should use. Useful for tools like 'file_search' that can access files.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
CreateVectorStoreFileBatchAsync(string, IReadOnlyList<string>, ChunkingStrategy, CancellationToken)
Create a vector store file batch.
public Task<VectorStoreFileBatchResponse> CreateVectorStoreFileBatchAsync(string vectorStoreId, IReadOnlyList<string> fileIds, ChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store for which to create a File Batch.
fileIdsIReadOnlyList<string>A list of File IDs that the vector store should use. Useful for tools like file_search that can access files.
chunkingStrategyChunkingStrategyA file id that the vector store should use. Useful for tools like 'file_search' that can access files.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
DeleteVectorStoreAsync(string, CancellationToken)
Delete a vector store.
public Task<bool> DeleteVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store to retrieve.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
DeleteVectorStoreFileAsync(string, string, CancellationToken)
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.
public Task<bool> DeleteVectorStoreFileAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store that the file belongs to.
fileIdstringThe ID of the file being deleted.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
GetVectorStoreAsync(string, CancellationToken)
Get a vector store.
public Task<VectorStoreResponse> GetVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store to retrieve.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
GetVectorStoreFileAsync(string, string, CancellationToken)
Retrieves a vector store file.
public Task<VectorStoreFileResponse> GetVectorStoreFileAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store that the file belongs to.
fileIdstringThe ID of the file being retrieved.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
GetVectorStoreFileBatchAsync(string, string, CancellationToken)
Retrieves a vector store file batch.
public Task<VectorStoreFileBatchResponse> GetVectorStoreFileBatchAsync(string vectorStoreId, string fileBatchId, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store that the files belong to.
fileBatchIdstringThe ID of the file batch being retrieved.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
ListVectorStoreBatchFilesAsync(string, string, ListQuery, VectorStoreFileStatus?, CancellationToken)
Returns a list of vector store files in a batch.
public Task<ListResponse<VectorStoreFileBatchResponse>> ListVectorStoreBatchFilesAsync(string vectorStoreId, string fileBatchId, ListQuery query = null, VectorStoreFileStatus? filter = null, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store that the files belong to.
fileBatchIdstringThe ID of the file batch.
queryListQueryOptional, ListQuery.
filterVectorStoreFileStatus?Optional, filter by file status.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
ListVectorStoreFilesAsync(string, ListQuery, VectorStoreFileStatus?, CancellationToken)
Returns a list of vector store files.
public Task<ListResponse<VectorStoreFileResponse>> ListVectorStoreFilesAsync(string vectorStoreId, ListQuery query = null, VectorStoreFileStatus? filter = null, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store that the file belongs to.
queryListQueryOptional, ListQuery.
filterVectorStoreFileStatus?Optional, Filter by file status VectorStoreFileStatus filter.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
ListVectorStoresAsync(ListQuery, CancellationToken)
Returns a list of vector stores.
public Task<ListResponse<VectorStoreResponse>> ListVectorStoresAsync(ListQuery query = null, CancellationToken cancellationToken = default)
Parameters
queryListQueryOptional, ListQuery.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
ModifyVectorStoreAsync(string, string, int?, IReadOnlyDictionary<string, object>, CancellationToken)
Modifies a vector store.
public Task<VectorStoreResponse> ModifyVectorStoreAsync(string vectorStoreId, string name = null, int? expiresAfter = null, IReadOnlyDictionary<string, object> metadata = null, CancellationToken cancellationToken = default)
Parameters
vectorStoreIdstringThe ID of the vector store to retrieve.
namestringOptional, name of the vector store.
expiresAfterint?The number of days after the anchor time that the vector store will expire.
metadataIReadOnlyDictionary<string, 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 can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
cancellationTokenCancellationTokenOptional, CancellationToken.