Table of Contents

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

string

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 string

The ID of the vector store that the files belong to.

fileBatchId string

The ID of the file batch being retrieved.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<bool>

True, if the vector store file batch was cancelled, otherwise false.

CreateVectorStoreAsync(CreateVectorStoreRequest, CancellationToken)

Creates a new Vector Store.

public Task<VectorStoreResponse> CreateVectorStoreAsync(CreateVectorStoreRequest request, CancellationToken cancellationToken = default)

Parameters

request CreateVectorStoreRequest

CreateVectorStoreRequest.

cancellationToken CancellationToken

Optional CancellationToken.

Returns

Task<VectorStoreResponse>

VectorStoreResponse.

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 string

The ID of the vector store that the file belongs to.

fileId string

A File ID that the vector store should use. Useful for tools like file_search that can access files.

chunkingStrategy ChunkingStrategy

A file id that the vector store should use. Useful for tools like 'file_search' that can access files.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<VectorStoreFileResponse>

VectorStoreFileResponse.

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 string

The 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 ChunkingStrategy

A file id that the vector store should use. Useful for tools like 'file_search' that can access files.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<VectorStoreFileBatchResponse>

VectorStoreFileBatchResponse.

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 string

The 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 ChunkingStrategy

A file id that the vector store should use. Useful for tools like 'file_search' that can access files.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<VectorStoreFileBatchResponse>

VectorStoreFileBatchResponse.

DeleteVectorStoreAsync(string, CancellationToken)

Delete a vector store.

public Task<bool> DeleteVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default)

Parameters

vectorStoreId string

The ID of the vector store to retrieve.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<bool>

True, if the vector store was successfully deleted.

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 string

The ID of the vector store that the file belongs to.

fileId string

The ID of the file being deleted.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<bool>

True, if the vector store file was successfully deleted.

GetVectorStoreAsync(string, CancellationToken)

Get a vector store.

public Task<VectorStoreResponse> GetVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default)

Parameters

vectorStoreId string

The ID of the vector store to retrieve.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<VectorStoreResponse>

VectorStoreResponse.

GetVectorStoreFileAsync(string, string, CancellationToken)

Retrieves a vector store file.

public Task<VectorStoreFileResponse> GetVectorStoreFileAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default)

Parameters

vectorStoreId string

The ID of the vector store that the file belongs to.

fileId string

The ID of the file being retrieved.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<VectorStoreFileResponse>

VectorStoreFileResponse.

GetVectorStoreFileBatchAsync(string, string, CancellationToken)

Retrieves a vector store file batch.

public Task<VectorStoreFileBatchResponse> GetVectorStoreFileBatchAsync(string vectorStoreId, string fileBatchId, CancellationToken cancellationToken = default)

Parameters

vectorStoreId string

The ID of the vector store that the files belong to.

fileBatchId string

The ID of the file batch being retrieved.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<VectorStoreFileBatchResponse>

VectorStoreFileBatchResponse.

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 string

The ID of the vector store that the files belong to.

fileBatchId string

The ID of the file batch.

query ListQuery

Optional, ListQuery.

filter VectorStoreFileStatus?

Optional, filter by file status.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<ListResponse<VectorStoreFileBatchResponse>>

ListResponse<TObject>.

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 string

The ID of the vector store that the file belongs to.

query ListQuery

Optional, ListQuery.

filter VectorStoreFileStatus?

Optional, Filter by file status VectorStoreFileStatus filter.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<ListResponse<VectorStoreFileResponse>>

ListResponse<TObject>.

ListVectorStoresAsync(ListQuery, CancellationToken)

Returns a list of vector stores.

public Task<ListResponse<VectorStoreResponse>> ListVectorStoresAsync(ListQuery query = null, CancellationToken cancellationToken = default)

Parameters

query ListQuery

Optional, ListQuery.

cancellationToken CancellationToken

Optional, CancellationToken.

Returns

Task<ListResponse<VectorStoreResponse>>

ListResponse<TObject>.

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 string

The ID of the vector store to retrieve.

name string

Optional, 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 CancellationToken

Optional, CancellationToken.

Returns

Task<VectorStoreResponse>

VectorStoreResponse.