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
client
OpenAIClient
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
vectorStoreId
stringThe ID of the vector store that the files belong to.
fileBatchId
stringThe ID of the file batch being retrieved.
cancellationToken
CancellationTokenOptional, CancellationToken.
Returns
CreateVectorStoreAsync(CreateVectorStoreRequest, CancellationToken)
Creates a new Vector Store.
public Task<VectorStoreResponse> CreateVectorStoreAsync(CreateVectorStoreRequest request, CancellationToken cancellationToken = default)
Parameters
request
CreateVectorStoreRequestcancellationToken
CancellationTokenOptional 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
vectorStoreId
stringThe ID of the vector store that the file belongs to.
fileId
stringA File ID that the vector store should use. Useful for tools like file_search that can access files.
chunkingStrategy
ChunkingStrategyA file id that the vector store should use. Useful for tools like 'file_search' that can access files.
cancellationToken
CancellationTokenOptional, 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
vectorStoreId
stringThe ID of the vector store for which to create a File Batch.
files
IReadOnlyList<FileResponse>A list of Files that the vector store should use. Useful for tools like file_search that can access files.
chunkingStrategy
ChunkingStrategyA file id that the vector store should use. Useful for tools like 'file_search' that can access files.
cancellationToken
CancellationTokenOptional, 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
vectorStoreId
stringThe ID of the vector store for which to create a File Batch.
fileIds
IReadOnlyList<string>A list of File IDs that the vector store should use. Useful for tools like file_search that can access files.
chunkingStrategy
ChunkingStrategyA file id that the vector store should use. Useful for tools like 'file_search' that can access files.
cancellationToken
CancellationTokenOptional, CancellationToken.
Returns
DeleteVectorStoreAsync(string, CancellationToken)
Delete a vector store.
public Task<bool> DeleteVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default)
Parameters
vectorStoreId
stringThe ID of the vector store to retrieve.
cancellationToken
CancellationTokenOptional, 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
vectorStoreId
stringThe ID of the vector store that the file belongs to.
fileId
stringThe ID of the file being deleted.
cancellationToken
CancellationTokenOptional, CancellationToken.
Returns
GetVectorStoreAsync(string, CancellationToken)
Get a vector store.
public Task<VectorStoreResponse> GetVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default)
Parameters
vectorStoreId
stringThe ID of the vector store to retrieve.
cancellationToken
CancellationTokenOptional, CancellationToken.
Returns
GetVectorStoreFileAsync(string, string, CancellationToken)
Retrieves a vector store file.
public Task<VectorStoreFileResponse> GetVectorStoreFileAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default)
Parameters
vectorStoreId
stringThe ID of the vector store that the file belongs to.
fileId
stringThe ID of the file being retrieved.
cancellationToken
CancellationTokenOptional, CancellationToken.
Returns
GetVectorStoreFileBatchAsync(string, string, CancellationToken)
Retrieves a vector store file batch.
public Task<VectorStoreFileBatchResponse> GetVectorStoreFileBatchAsync(string vectorStoreId, string fileBatchId, CancellationToken cancellationToken = default)
Parameters
vectorStoreId
stringThe ID of the vector store that the files belong to.
fileBatchId
stringThe ID of the file batch being retrieved.
cancellationToken
CancellationTokenOptional, 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
vectorStoreId
stringThe ID of the vector store that the files belong to.
fileBatchId
stringThe ID of the file batch.
query
ListQueryOptional, ListQuery.
filter
VectorStoreFileStatus?Optional, filter by file status.
cancellationToken
CancellationTokenOptional, 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
vectorStoreId
stringThe ID of the vector store that the file belongs to.
query
ListQueryOptional, ListQuery.
filter
VectorStoreFileStatus?Optional, Filter by file status VectorStoreFileStatus filter.
cancellationToken
CancellationTokenOptional, CancellationToken.
Returns
ListVectorStoresAsync(ListQuery, CancellationToken)
Returns a list of vector stores.
public Task<ListResponse<VectorStoreResponse>> ListVectorStoresAsync(ListQuery query = null, CancellationToken cancellationToken = default)
Parameters
query
ListQueryOptional, ListQuery.
cancellationToken
CancellationTokenOptional, 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
vectorStoreId
stringThe ID of the vector store to retrieve.
name
stringOptional, name of the vector store.
expiresAfter
int?The number of days after the anchor time that the vector store will expire.
metadata
IReadOnlyDictionary<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.
cancellationToken
CancellationTokenOptional, CancellationToken.