Skip to main content
GenAI Toolkit is in private beta according to the Algolia Terms of Service (“Beta Services”).

Before you begin

To generate a response, you need the GenAI Toolkit feature in your Algolia plan, an containing the product data you want to use for your GenAI apps, a prompt, and a data source.

Manage responses with the dashboard

Generate new responses

Use the Response Playground to see how a query would generate content for a given data source and prompt.
  1. Select Generative AI in the Algolia dashboard.
  2. On the left sidebar, select Response Playground.
  3. Choose a prompt. Screenshot of a 'Response Playground' with a prompt drop-down menu showing options like 'Introduction' and 'Compare Products by Feature.'
  4. Choose a data source. Screenshot of a drop-down menu listing data sources like 'Electronic Product Catalog' under 'Choose a Data Source'.
  5. Optionally, you can further refine your data source by applying a . Filters don’t affect the selected data source, only the response. Screenshot of the 'Additional Filters' section with 'Attribute', 'Is Not', and 'Value' fields, and a '+ Add Filter' link.
  6. Enter a user query and click Generate to generate and preview the response. Screenshot of the 'Response Playground' interface with a text input field containing a phone comparison query and a blue 'Generate' button.
  7. To save the generated response, click the Save Response button. Screenshot of a 'Response Playground' with a phone comparison prompt, showing a response preview and 'Save Response' button.
To regenerate a response, you can change the filters, enter a different query, select another prompt or data source, or you directly edit the selected prompt or data source from the playground, then click Regenerate.

Manage responses

You can find all the generated responses in the Generated responses section. Here you can view the response details or you can delete responses. Screenshot of a 'View Response' modal showing a phone comparison, with details on display, battery life, and camera systems.

Manage responses with the GenAI Toolkit API

You can manage your responses with the GenAI Toolkit API.

Generate a new response

You need an API Key with the following ACLs: settings, editSettings, addObject, search.
Command line
curl -X POST https://generative-ai.algolia.com/generate/response/ \
     -H 'Content-Type: application/json' \
     -H 'X-Algolia-Api-Key: $ALGOLIA_API_KEY' \
     -H 'X-Algolia-Application-ID: $ALGOLIA_APPLICATION_ID' \
     -d '{
        "query": "Compare iPhone 13 and Samsung S21",
        "dataSourceID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba1",
        "promptID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba3",
        "additionalFilters": "model":\"iPhone 13\" OR "model":\"Samsung S21\",
        "save": true,
        "use_cache": false,
        "objectID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba9",
     }'

Parameters

Retrieval
dataSourceID
string
required
The identifier of the previously defined data source.
promptID
string
required
The identifier of the previously defined prompt.
objectID
string
A unique identifier used for storing the response. If not provided, the API will automatically generate a new one.
Retrieval
additionalFilters
string
Optional filters used for further customizing the retrieval. This will be taken into account alongside the data source filters, if any, without overwriting them, or adding them to the data source object.Example:
JSON
{
    // ...
    "additionalFilters": "category:phones AND price > 500"
}

nbHits
number
default:4
How many hits the Toolkit should retrieve as context for the large language model.
withObjectIDs
string[]
If provided, the toolkit retrieves the specified directly using getObjects(withObjectIDs) instead of running a search with search(query). This lets you request a GenAI response for one or more specific items. For example, you can use it to answer user questions on a product-detail page, or to generate a dynamic shopping cart introduction text, based on the current products.Example:
JSON
{
    // ...
    "withObjectIDs": ["objectID1", "objectID2", "objectID3"]
}
Augmentation
attributesToRetrieve
string[]
If provided, the toolkit will retrieve only these attributes. This limits what the large language model sees, giving you control over which properties are used to generate an answer. The response will be augmented with those attributes under response.context, enabling you to render directly key properties of the hits.Example:
JSON
{
    // ...
    "attributesToRetrieve": ["title", "description", "URL"]
}
Generation
conversationID
string
The ID of a previous conversation. If provided, the toolkit connects this request to a previous conversation. The query is reformulated based on the overall conversation and user demand. For example, given:
  • A first query “Give me 3 movies about famous musicians”, where the response mentions “Bohemian Rhapsody (2018)”, “Rocketman (2019)”, and “Walk the line (2005)”
  • A second query “Tell me more about the second suggestion”
  • A third query “Now compare the second suggestion with the first one”
The toolkit rephrases the two follow-up queries:
  • “Can you provide more details about the movie ‘Rocketman’?”
  • “How does Rocketman (2019) compare to Bohemian Rhapsody (2018) in terms of storytelling and musical representation?”
This lets you provide a conversational user experience in your RAG.
save
boolean
default:true
Instructions for saving the response, along with the configuration provided in the request.
useCache
boolean
default:false
Whether to return a cached response. Cached responses are previous responses with the save: true option.
stream
boolean
default:false
Whether to stream the response instead of waiting until completion before returning it.
Internal
origin
"dashboard" | "api"
default:"api"
The origin of the request: dashboard or api.

Returns

In case of a success, the response is (HTTP status code 200):
JSON
{
  "objectID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba9",
  "response": "The iPhone 13 features a 6.1-inch Super Retina display, while the Samsung Galaxy S21 has a slightly smaller 6.2-inch AMOLED screen. ...",
  "query": "Compare iPhone 13 and Samsung S21",
  "dataSourceID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba1",
  "promptID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba3",
  "createdAt": "00"
}
In case of an error, the response is:
JSON
{
  "name": "Error",
  "message": "Error generating the response."
}

Delete a response

You need an API Key with the following ACLs: deleteObject, search.
Command line
curl -X POST https://generative-ai.algolia.com/delete/responses/ \
     -H 'Content-Type: application/json' \
     -H 'X-Algolia-Api-Key: $ALGOLIA_API_KEY' \
     -H 'X-Algolia-Application-ID: $ALGOLIA_APPLICATION_ID' \
     -d '{
        "objectIDs": ["b4e52d1a-2509-49ea-ba36-f6f5c3a83ba9"],
     }'

Parameters

objectIDs
string[]
required
List of IDs of the prompts to be deleted.

Returns

In case of a success, the response is (HTTP status code 200):
JSON
{
  "message": "Successfully deleted responses."
}
In case of an error, the response is:
JSON
{
  "name": "Error",
  "message": "Error when deleting the responses."
}

Retrieve a response

You need an API Key with the following ACLs: search.
Command line
curl -X GET "https://generative-ai.algolia.com/get/response/$OBJECT_ID/" \
     -H 'Content-Type: application/json' \
     -H "X-Algolia-Api-Key: $ALGOLIA_API_KEY" \
     -H "X-Algolia-Application-ID: $ALGOLIA_APPLICATION_ID"

Parameters

objectIDs
string[]
required
List of IDs of the prompts to be retrieved.

Returns

In case of a success, the response is (HTTP status code 200):
JSON
{
  "objectID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba9",
  "response": "The iPhone 13 features a 6.1-inch Super Retina display, while the Samsung Galaxy S21 has a slightly smaller 6.2-inch AMOLED screen. ...",
  "query": "Compare iPhone 13 and Samsung S21",
  "dataSourceID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba1",
  "promptID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba3",
  "additionalFilters": "\"model\":\"iPhone 13\" OR \"model\":\"Samsung S21\"",
  "save": true,
  "useCache": false,
  "origin": "api",
  "createdAt": "000",
  "updatedAt": "000"
}
In case of an error, the response is:
JSON
{
  "name": "Error",
  "message": "Error when retrieving the responses."
}
Last modified on March 23, 2026