Literal AI icon

Literal AI

Use the Literal AI API

Overview

This node integrates with the Literal AI API to manage experiments within the Literal AI platform. Specifically, the "Experiment - Create" operation allows users to create a new experiment by specifying its name and optional associated data such as dataset ID, prompt variant ID, and additional parameters.

Common scenarios where this node is beneficial include:

  • Automating the creation of AI experiments as part of a larger workflow.
  • Integrating experiment setup into CI/CD pipelines for machine learning projects.
  • Managing experiments programmatically without manual intervention in the Literal AI dashboard.

For example, a user can create an experiment named "Image Classification Test" linked to a specific dataset and prompt variant, passing custom parameters that define experiment behavior or configuration.

Properties

Name Meaning
Name The name of the experiment to be created (required).
Additional Fields Optional fields to provide extra details about the experiment:
- Dataset ID The identifier of the dataset to associate with the experiment.
- Prompt Variant ID The identifier of the prompt variant to associate with the experiment.
- Parameters JSON object containing additional parameters for configuring the experiment.

Output

The node outputs a JSON object under the content field containing the response from the Literal AI API after creating the experiment. This typically includes details of the newly created experiment such as its unique ID, name, associated dataset and prompt variant IDs, parameters, timestamps, and other metadata returned by the API.

No binary data output is produced by this operation.

Example output structure (simplified):

{
  "content": {
    "id": "experiment_12345",
    "name": "My Experiment",
    "datasetId": "dataset_67890",
    "promptVariantId": "variant_abcde",
    "params": { /* experiment parameters */ },
    "createdAt": "2024-01-01T12:00:00Z",
    // ... other metadata fields
  }
}

Dependencies

  • Requires an active API key credential for the Literal AI service configured in n8n.
  • Depends on the @literalai/client npm package to interact with the Literal AI API.
  • Network connectivity to the Literal AI API endpoint is necessary.

Troubleshooting

  • Invalid or missing API key: The node will fail if the API key credential is not set or invalid. Ensure the API key is correctly configured in n8n credentials.
  • Malformed JSON in parameters: If the Parameters field contains invalid JSON, the node will throw a parsing error. Validate JSON syntax before input.
  • Missing required fields: The Name property is mandatory; omitting it will cause the API call to fail.
  • API errors: Any errors returned by the Literal AI API (e.g., invalid dataset or prompt variant IDs) will be surfaced in the node's output. Review the error message for corrective action.
  • To continue processing subsequent items even if one fails, enable the "Continue On Fail" option in the node settings.

Links and References

Discussion