AI21 Labs
  1. 语义搜索 API
AI21 Labs
  • J2 完整 API
    • J2 完整 API
    • J2 完整版
      POST
  • 自定义 J-2 模型
    • 数据集 API
      • 数据集 API
      • 获取数据集列表
      • 获取数据集
      • 删除数据集
    • 自定义模型 API
      • 自定义模型 API
      • 自定义模型训练
      • 获取自定义模型列表
      • 获取自定义模型
      • 自定义模型完整训练
      • 更新默认轮次
  • 特定任务模型
    • 释义 API
      • 释义 API
      • 释义
    • 语法错误修正 API
      • 语法错误修正 API
      • 语法错误更正
    • 文本改进 API
      • 文本改进 API
      • 文本改进
    • 总结 API
      • 总结 API
      • 总结
    • 按段总结 API
      • 按段总结
      • 按段总结
    • 文本分割 API
      • 文本分割 API
      • 文本分割
    • 语境化问答 API
      • 语境化问答 API
      • 管理文档库
        • 将文档上传到图书馆
        • 检索文档列表
        • 通过 ID 检索文档
        • 更新文档参数
        • 删除文档
      • 单文档语境化问答
      • 文档库语境化问答
    • 语义搜索 API
      • 语义搜索 API
      • 语义搜索
        POST
    • 嵌入式 API
      • 嵌入式
  • SDK
    • Python SDK
    • Python SDK
  • 其他
    • 分词 API
      • 分词
  1. 语义搜索 API

语义搜索 API

在这里尝试语义搜索 API
语义搜索 API 是文档库 API的重要组成部分,提供针对组织需求量身定制的复杂查询解决方案。集成后,组织可以深入研究其库中与特定帐户相关的文档,所有文档均由相应的 API 密钥标识。这种方法不仅仅是关键字匹配。搜索系统利用自然语言理解 (NLU) 来准确解释用户意图,确保结果输出与潜在的概念期望产生共鸣。
此搜索机制使用、和 等参数提供灵活性,这些参数可以在文档上传期间指定,也可以自动生成。对于每次搜索命中,相关数据(例如文件和文档上传期间提供的数据)将包含在结果中,确保相关信息随时可用。

请求参数#

必需的:
query:表示搜索词或问题的字符串。
选修的:
path:表示文档库中的特定路径或目录的字符串。
labels:字符串列表,每个字符串代表与文档关联的特定标签。
fileIds:与特定文件对应的唯一标识符(UUID)列表。
maxSegments:一个整数,指定要检索的最大段数。
Python

成功回应#

成功查询后,语义搜索 API 返回一个 JSON 对象,其中包含:
id:代表搜索请求的唯一标识符(UUID)。
results
:匹配文档的数组。该数组中的每个对象包括:
text:包含与搜索查询相关的相关提取内容的字符串。
fileId:表示从中提取文本的特定文件/文档的唯一标识符 (UUID)。
fileName:文件/文档的名称。
score:一个浮点值,指示提取的文本相对于搜索查询的相关性得分。
publicUrl:包含文档公共 URL 的字符串(如果有)。
JSON
{
  id: '83a728e7-1ece-ea96-2a89-1f68105f600a',
  results: [
    {
      text: 'Working From Abroad - Guidelines[a]\n' +
        '\n' +
        '\n' +
        'ExampleTech allows every employee to work remotely while abroad for up to two weeks (10 working days) in a calendar year.\n' +
        '\n' +
        'These two weeks can be used all at once or spread throughout the year.\n' +
        '\n' +
        'We ask employees who want to make use of this policy to approve their request at least a month in advance with their direct manager, to leave time to make the needed preparations.\n' +
        '\n' +
        'Employees who work remotely are expected to be available during the peak working hours of the main office (generally 10:00-16:00), as well as during scheduled meetings.\n' +
        '\n' +
        'We will consider each request carefully with the aim to make it happen, though it might not always be possible.\n' +
        '\n' +
        'Your request might not be approved if your physical presence is required for a specific team effort or deadline, or if the time difference does not allow smooth communication.\n' +
        '\n' +
        'Please take your team responsibilities into consideration before making a request.',
      fileId: 'e7b62d19-f96c-48b6-a1a8-8a62225a04c3',
      fileName: 'Working From Abroad - Guidelines.txt',
      score: 1.75992024,
      publicUrl: null
    },
    {
      text: 'We ask every employee to arrive at the office at least three times a week.\n' +
        '\n' +
        'In the remaining two days of the week, employees can choose between working from the office or from home.\n' +
        '\n' +
        'To make sure you meet your teammates regularly, your team manager will set 1-2 weekdays for the whole team to arrive together.\n' +
        '\n' +
        'A few things to keep in mind: \n' +
        '- There might be times you will be asked to arrive at the office more often, depending on specific projects / efforts that require your presence (such as face-to-face interviews, team member onboarding, etc.).',
      fileId: '93ccf9cc-4d56-45f3-9326-eff8bf4d9cdf',
      fileName: 'Hybrid Work Guidelines.txt',
      score: 1.6853497,
      publicUrl: null
    },
    {
      text: '- Please make sure to mark your calendar for “work from home” / “work from office” so that others know where to reach you.\n' +
        '\n' +
        'If you’re not sure how, follow these guidelines.',
      fileId: '93ccf9cc-4d56-45f3-9326-eff8bf4d9cdf',
      fileName: 'Hybrid Work Guidelines.txt',
      score: 1.66186905,
      publicUrl: null
    },
    {
      text: 'A few more details:\n' +
        '- Please update your calendar for all days you are available while working remotely.',
      fileId: 'e7b62d19-f96c-48b6-a1a8-8a62225a04c3',
      fileName: 'Working From Abroad - Guidelines.txt',
      score: 1.61684942,
      publicUrl: null
    },
    {
      text: 'At our current stage of growth, we believe face-to-face interaction is valuable for team building, cross-functional collaboration, and for reducing friction in the work process.\n' +
        '\n' +
        'Because we’re a fast paced, growing company, we recommend you arrive at the office every day to take advantage of the benefits of in-person communication.\n' +
        '\n' +
        'Having said that, working from home also has its own benefits and we want to cultivate a culture of trust and flexibility.\n' +
        '\n' +
        "Therefore we've outlined a hybrid option that combines the best of both worlds.",
      fileId: '93ccf9cc-4d56-45f3-9326-eff8bf4d9cdf',
      fileName: 'Hybrid Work Guidelines.txt',
      score: 1.5660671,
      publicUrl: null
    },
    {
      text: '- We understand that from time to time, there are extenuating circumstances that require you to be at home more than usual.\n' +
        '\n' +
        'In those cases, please talk to your manager to decide on a plan.',
      fileId: '93ccf9cc-4d56-45f3-9326-eff8bf4d9cdf',
      fileName: 'Hybrid Work Guidelines.txt',
      score: 1.43893385,
      publicUrl: null
    },
    {
      text: '9. Do not leave office IT equipment unattended when working remotely.\n' +
        '\n' +
        '10. Do not use personal devices for work purposes.',
      fileId: 'de4eda11-c2f0-4582-8694-1637f45c6bc4',
      fileName: 'IT/IT Organisational Security Policy.txt',
      score: 1.13494432,
      publicUrl: 'https://www.exampletech.com/it'
    },
    {
      text: 'Hybrid Work Guidelines \n' +
        "ExampleTech 's hybrid work guidelines outlines remote employees' work and compliance expectations.\n" +
        '\n' +
        "The purpose of this hybrid work guidelines is to safeguard both employees' and the organization's interests by outlining the working conditions and expectations.",
      fileId: '93ccf9cc-4d56-45f3-9326-eff8bf4d9cdf',
      fileName: 'Hybrid Work Guidelines.txt',
      score: 1.11907279,
      publicUrl: null
    },
    {
      text: '8. When working remotely, use a password-protected public WiFi network.',
      fileId: 'de4eda11-c2f0-4582-8694-1637f45c6bc4',
      fileName: 'IT/IT Organisational Security Policy.txt',
      score: 1.09162867,
      publicUrl: 'https://www.exampletech.com/it'
    }
  ]
}
上一页
文档库语境化问答
下一页
语义搜索
Built with