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

Before you begin

To create a prompt, you need the GenAI Toolkit feature in your Algolia plan, and an index containing the product data you want to use for your GenAI applications.

Manage prompts with the dashboard

Create new prompts

  1. Go to the Algolia dashboard and select your Algolia application.
  2. On the left sidebar, select Generative AI.
  3. Select Generative AI in the Algolia dashboard.
  4. On the left sidebar, select Prompts.
  5. Click Create New Prompt. Create prompt from dashboard
  6. Enter a name for your Prompt. This will be used to easily identify your prompt later. Enter prompt name
  7. Select one of the pre-defined tones to use in the final prompt, computed by the GenAI Toolkit. By default the tone is set to natural. Select prompt tone
  8. Enter the detailed instructions for your prompt. They will be used to compute the final prompt that will be needed for generating responses. Save prompt
  9. Once you are satisfied with your configuration, click Save Prompt.

Edit prompts

You can edit its details directly from the Dashboard. Start by selecting a prompt from the prompts Table. Pick prompt from table On the details screen you can edit the name, change the selected tone or modify the prompt instructions. To save your changes, click the Save Prompt button.
Modifying a prompt that you used for generating responses may impact those responses. Review and optionally regenerate the responses that depend on this data source.

Duplicate prompts

You can use one prompt as a template for creating a new one. From the prompts table, choose your base prompt, click More and select Duplicate. Duplicate prompt A new screen opens, pre-filled with the details from your base prompt. You can edit the name, select a new tone or add new instructions. To save your changes, click the Save Prompt button.

Delete prompts

To delete a prompt in the dashboard, choose the prompt you want to delete from the prompts table, click More and select Delete. Delete prompt
Deleting a prompt that was used for generating responses impacts those responses. You can choose how to handle this: you can either delete the prompt and keep the responses that rely on it, or you can delete the associated responses together with the prompt.

Manage prompts with the GenAI Toolkit API

You can manage your data sources with the GenAI Toolkit API.

Create a new prompt

You need an API Key with the following ACLs: addObject, settings, editSettings.
curl -X POST https://generative-ai.algolia.com/create/prompt/ \
     -H 'Content-Type: application/json' \
     -H 'X-Algolia-Api-Key: ${API_KEY}' \
     -H 'X-Algolia-Application-ID: ${APPLICATION_ID}' \
     -d '{
      "name": "Compare phones by feature",
      "instructions": "Help buyers chose the right phone for their needs by providing relevant information and comparing the given products by feature.",
      "tone": "friendly",
      "objectID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba3",
     }'

Parameters

instructions
string
required
The instructions and system prompt that will be provided by the GenAI Toolkit.
name
string
required
The name used to identify the prompt.
objectID
string
A unique identifier used for storing the prompt. If not provided, the API will automatically generate a new one.
tone
enum<string>
default:"natural"
Tone used by the model.Allowed values: natural, friendly, or professional

Returns

In case of a success, the response is (HTTP status code 200):
JSON
{
  "objectID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba1"
}
In case of an error, the response is:
JSON
{
  "name": "Error",
  "message": "Error saving the prompt."
}

Update a prompt

You need an API Key with the following ACLs: addObject, search.
curl -X POST https://generative-ai.algolia.com/update/prompt/ \
     -H 'Content-Type: application/json' \
     -H 'X-Algolia-Api-Key: ${API_KEY}' \
     -H 'X-Algolia-Application-ID: ${APPLICATION_ID}' \
     -d '{
      "name": "Compare phones by feature",
      "instructions": "Help buyers chose the right phone for their needs by providing relevant information and comparing the given products by feature.",
      "tone": "friendly",
      "objectID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba3",
     }'

Parameters

objectID
string
required
The ID of the prompt to be updated.
instructions
string
The instructions and system prompt that will be provided by the GenAI Toolkit.
name
string
The name used to identify the prompt.
tone
enum<string>
default:"natural"
Tone used by the model.Allowed values: natural, friendly, or professional

Returns

In case of a success, the response is (HTTP status code 200):
JSON
{
  "objectID": "b4e52d1a-2509-49ea-ba36-f6f5c3a83ba1"
}
In case of an error, the response is:
JSON
{
  "name": "Error",
  "message": "Error updating the prompt."
}

Delete a prompt

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

Parameters

objectIDs
string[]
required
List of IDs of the prompts to be deleted.
deleteLinkedResponses
boolean
default:false
Whether to delete responses linked to this prompt.

Returns

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