OpenAI 获取向量存储文件内容接口

2026-11-10 18:18 更新

获取向量存储文件内容

get /vector_stores/{vector_store_id}/files/{file_id}/content

获取向量存储文件解析后的内容。

路径参数

  • vector_store_id: string:此请求涉及的向量存储 ID。

  • file_id: string:此请求涉及的文件 ID。

返回值

  • data: array of object { text, type }

文件解析后的内容。

  • text: optional string

文本内容。

  • type: optional string

内容类型,目前仅支持"text"。

  • has_more: boolean

是否还有更多内容页可获取。

  • next_page: string or null

下一页的令牌(若有)。

  • object: "vector_store.file_content.page"

对象类型,固定为vector_store.file_content.page。

  • "vector_store.file_content.page"

示例

## [中文] 发送GET请求;将示例API凭证及资源标识替换为应用使用的值。
curl https://api.openai.com/v1/vector_stores/$VECTOR_STORE_ID/files/$FILE_ID/content \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"

响应

中文说明:以下为原文配置、命令或事件示例,字段名、枚举、标识符及数值保留。

{
  "data": [
    {
      "text": "text",
      "type": "type"
    }
  ],
  "has_more": true,
  "next_page": "next_page",
  "object": "vector_store.file_content.page"
}

示例

## [中文] 发送GET请求;将示例API凭证及资源标识替换为应用使用的值。
curl \
https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123/content \
-H "Authorization: Bearer $OPENAI_API_KEY"

响应

中文说明:以下为原文配置、命令或事件示例,字段名、枚举、标识符及数值保留。

代码内文字译释:

  • 文件内容。

{
  "object": "vector_store.file_content.page",
  "data": [
    {"type": "text", "text": "file content"}
  ],
  "has_more": false,
  "next_page": null
}
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号