Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/openai/resources/beta/vector-stores/mod.ts>Files

Deno build of the official Typescript library for the OpenAI API.
Extremely Popular
Latest
namespace Files
import { Files } from "https://deno.land/x/openai@v4.69.0/resources/beta/vector-stores/mod.ts";
class Files
extends APIResource
import { Files } from "https://deno.land/x/openai@v4.69.0/resources/beta/vector-stores/mod.ts";

Methods

create(
vectorStoreId: string,
options?: Core.RequestOptions,
): Core.APIPromise<VectorStoreFile>

Create a vector store file by attaching a File to a vector store.

createAndPoll(
vectorStoreId: string,
options?: Core.RequestOptions & { pollIntervalMs?: number; },
): Promise<VectorStoreFile>

Attach a file to the given vector store and wait for it to be processed.

del(
vectorStoreId: string,
fileId: string,
options?: Core.RequestOptions,
): Core.APIPromise<VectorStoreFileDeleted>

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.

list(
vectorStoreId: string,
options?: Core.RequestOptions,
): Core.PagePromise<VectorStoreFilesPage, VectorStoreFile>

Returns a list of vector store files.

list(vectorStoreId: string, options?: Core.RequestOptions): Core.PagePromise<VectorStoreFilesPage, VectorStoreFile>
poll(
vectorStoreId: string,
fileId: string,
options?: Core.RequestOptions & { pollIntervalMs?: number; },
): Promise<VectorStoreFile>

Wait for the vector store file to finish processing.

Note: this will return even if the file failed to process, you need to check file.last_error and file.status to handle these cases

retrieve(
vectorStoreId: string,
fileId: string,
options?: Core.RequestOptions,
): Core.APIPromise<VectorStoreFile>

Retrieves a vector store file.

upload(
vectorStoreId: string,
file: Uploadable,
options?: Core.RequestOptions,
): Promise<VectorStoreFile>

Upload a file to the files API and then attach it to the given vector store.

Note the file will be asynchronously processed (you can use the alternative polling helper method to wait for processing to complete).

uploadAndPoll(
vectorStoreId: string,
file: Uploadable,
options?: Core.RequestOptions & { pollIntervalMs?: number; },
): Promise<VectorStoreFile>

Add a file to a vector store and poll until processing is complete.