Skip to content

Retrieve vector store file content

client.VectorStores.Files.Content(ctx, vectorStoreID, fileID) (*Page[VectorStoreFileContentResponse], error)
GET/vector_stores/{vector_store_id}/files/{file_id}/content

Retrieve the parsed contents of a vector store file.

ParametersExpand Collapse
vectorStoreID string
fileID string
ReturnsExpand Collapse
type VectorStoreFileContentResponse struct{…}
Text stringoptional

The text content

Type stringoptional

The content type (currently only "text")

Retrieve vector store file content

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.VectorStores.Files.Content(
    context.TODO(),
    "vs_abc123",
    "file-abc123",
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "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"
}