Skip to main content
RAG tools enable AI21 Maestro to access additional context, either from the AI21 Maestro  File Library you manage or directly from the web. This helps generate grounded, relevant responses based on your data or real-time information.

Available Tools

  • File Search – Retrieve information from your uploaded documents.
  • Web Search – Incorporate data from the web.
Before using file_search: Upload your documents to your File Library. You can also enable web_search to let Maestro retrieve real-time information from the web.
Optionally, you can restrict searches to specific domains using the urls parameter.

Example:

The example below shows a completed run object that includes both file_search and web_search results. These data_sources fields only appear if you explicitly request them using the include parameter. For details on how to use this parameter, see the include parameter documentation.
{
  "id": "dba286ef-5067-4c6e-b215-5483500da8df",
  "status": "completed",
  "result": "- example 1\n- example 2\n- example 3",
  "data_sources": {
    "web_search": [
      {
        "id": "0686b7a3-6cb6-7128-8000-146778a91763",
        "text": "web search result text",
        "url": "https://example.com",
        "score": 0.01461567
      }
    ],
    "file_search": [
      {
        "text": "file search result text",
        "file_id": "aa50de3e-1624-4e9f-a6f4-488a1aa16759",
        "file_name": "example.pdf",
        "score": 0.7331293
      }
    ]
  }
}