Try Semantic Search API here

The Semantic Search API serves as a vital component of the RAG Engine, offering a sophisticated querying solution tailored for organizational requirements. When integrated, organizations can delve into documents within their RAG Engine associated with the specific account, all identified by the respective API key(s). This methodology goes beyond mere keyword matching. The search system taps into natural language understanding (NLU) to accurately interpret user intent, ensuring that the resulting outputs resonate with the underlying conceptual expectations.

This search mechanism provides flexibility using parameters such as path, labels, and fileIds, which are either specified during document uploads or auto-generated. For each search hit, associated data like the file fileName and publicUrl provided during the document's upload will be included in the results, ensuring relevant information is readily available.

Request Parameters

Required:

query: A string representing the search term or question.

Optional:

  • path: A string representing the specific path or directory within the RAG Engine.
  • labels: A list of strings, each representing a specific label associated with document(s).
  • fileIds: A list of unique identifiers (UUIDs) corresponding to specific files.
  • maxSegments: An integer specifying the maximum number of segments to retrieve.
{
    "query": "How many days can I work from home?",
    # "path":"/Guidelines/Hybrid-Work",                   // optional
    # "labels": ["Work From Home", "Work-Life Balance"],  // optional
    # "fileIds":['93ccf9cc-4d56-45f3-9326-eff8bf4d9cdf'], // optional
    # "maxSegments": 5                                    // optional
}

Successful Response

Upon a successful query, the Semantic Search API returns a JSON object that contains:

  • id: A unique identifier (UUID) representing the search request.
  • results: An array of matched documents. Each object within this array includes:
    • text: A string containing the relevant extracted content related to the search query.
    • fileId: A unique identifier (UUID) representing the specific file/document from which the text is extracted.
    • fileName: The name of the file/document.
    • score: A float value indicating the relevance score of the extracted text in relation to the search query.
    • publicUrl: A string containing the public URL of the document, if available.
{
  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'
    }
  ]
}