Literal AI icon

Literal AI

Use the Literal AI API

Overview

The node integrates with the Literal AI API to manage prompt A/B testing configurations. Specifically, the "Update A/B Testing" operation for the "Prompt" resource allows users to update the rollout versions of a prompt used in A/B testing scenarios. This is useful for teams experimenting with different prompt variants to optimize AI model responses or user interactions by controlling how different prompt versions are distributed.

Practical examples include:

  • Updating the distribution percentages of multiple prompt variants to gradually shift traffic from one version to another.
  • Managing prompt rollouts dynamically based on performance metrics without redeploying code.
  • Running controlled experiments on prompt effectiveness within an AI-driven application.

Properties

Name Meaning
Name The name identifier of the prompt whose A/B testing rollout configuration will be updated.
Rollouts A JSON array representing the different prompt rollout versions and their respective configurations (e.g., distribution weights).

Output

The node outputs a JSON object under the json field named content. This object contains the response from the Literal AI API after updating the prompt's A/B testing rollout settings. The exact structure depends on the API but typically includes details about the updated rollout versions and their statuses.

No binary data output is involved in this operation.

Dependencies

  • Requires an API key credential for the Literal AI service to authenticate requests.
  • The node uses the official Literal AI client library (@literalai/client) to interact with the API.
  • Proper configuration of the API key credential in n8n is necessary before using this node.

Troubleshooting

  • Common issues:

    • Invalid or missing API key credential will cause authentication failures.
    • Malformed JSON in the "Rollouts" property can lead to parsing errors.
    • Specifying a prompt name that does not exist may result in an error from the API.
  • Error messages and resolutions:

    • "Invalid API key": Verify that the API key credential is correctly set up and has proper permissions.
    • "Unexpected token ... in JSON at position ...": Check the JSON syntax in the "Rollouts" input; ensure it is valid JSON.
    • "Prompt not found" or similar: Confirm the prompt name exists in the Literal AI system before attempting to update its A/B testing configuration.

Links and References

Discussion