🌍 Global Mirror — Visit original CN site →
Skip to content
Primary navigation

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)
}
{
  "file_id": "file-abc123",
  "filename": "example.txt",
  "attributes": {"key": "value"},
  "content": [
    {"type": "text", "text": "..."},
    ...
  ]
}
Returns Examples
{
  "file_id": "file-abc123",
  "filename": "example.txt",
  "attributes": {"key": "value"},
  "content": [
    {"type": "text", "text": "..."},
    ...
  ]
}