Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Retrieve vector store file content

client.vectorStores.files.content(stringfileID, FileContentParams { vector_store_id } params, RequestOptionsoptions?): Page<FileContentResponse { text, type } >
GET/vector_stores/{vector_store_id}/files/{file_id}/content

Retrieve the parsed contents of a vector store file.

ParametersExpand Collapse
fileID: string
params: FileContentParams { vector_store_id }
ReturnsExpand Collapse
FileContentResponse { text, type }
text?: string

The text content

type?: string

The content type (currently only "text")

Retrieve vector store file content

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const fileContentResponse of client.vectorStores.files.content('file-abc123', {
  vector_store_id: 'vs_abc123',
})) {
  console.log(fileContentResponse.text);
}
{
  "object": "vector_store.file_content.page",
  "data": [
    {"type": "text", "text": "file content"}
  ],
  "has_more": false,
  "next_page": null
}
Returns Examples
{
  "object": "vector_store.file_content.page",
  "data": [
    {"type": "text", "text": "file content"}
  ],
  "has_more": false,
  "next_page": null
}