Skip to content

Retrieve vector store file content

vector_stores.files.content(strfile_id, FileContentParams**kwargs) -> SyncPage[FileContentResponse]
GET/vector_stores/{vector_store_id}/files/{file_id}/content

Retrieve the parsed contents of a vector store file.

ParametersExpand Collapse
vector_store_id: str
file_id: str
ReturnsExpand Collapse
class FileContentResponse:
text: Optional[str]

The text content

type: Optional[str]

The content type (currently only "text")

Retrieve vector store file content

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
page = client.vector_stores.files.content(
    file_id="file-abc123",
    vector_store_id="vs_abc123",
)
page = page.data[0]
print(page.text)
{
  "data": [
    {
      "text": "text",
      "type": "type"
    }
  ],
  "has_more": true,
  "next_page": "next_page",
  "object": "vector_store.file_content.page"
}
Returns Examples
{
  "data": [
    {
      "text": "text",
      "type": "type"
    }
  ],
  "has_more": true,
  "next_page": "next_page",
  "object": "vector_store.file_content.page"
}