codecamp

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

获取向量存储文件内容

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
}
OpenAI 获取向量存储文件批次接口
OpenAI 删除向量存储文件接口
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

其他能力与进阶指南

Embeddings 接口参考

审计日志接口参考

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }