Literal AI icon

Literal AI

Use the Literal AI API

Overview

This node integrates with the Literal AI API to retrieve multiple generation records related to "steps" in a project or workflow. Specifically, the "Get Many Generations" operation fetches a list of generation objects, allowing users to specify how many results to return and apply filters to narrow down the data.

Common scenarios where this node is beneficial include:

  • Retrieving a batch of AI-generated content or outputs for analysis or further processing.
  • Filtering generations based on criteria such as creation date, status, or other metadata.
  • Integrating generation data into automated workflows for reporting, auditing, or downstream tasks.

For example, a user might want to get the latest 50 generations filtered by a specific project ID or generation status to review recent AI outputs.

Properties

Name Meaning
Return Item Count Maximum number of generation results to return (minimum 1). Default is 50.
Filters JSON array of filter objects to apply when retrieving generations, e.g., by status or date.

Output

The node outputs an array of items, each containing a json object with a single property:

  • content: This holds the response from the Literal AI API's getGenerations method. It typically includes an array of generation objects matching the requested filters and limit.

If the API returns binary data related to generations (not indicated here), it would be included accordingly, but this operation primarily returns JSON data representing generation metadata and details.

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 within n8n is necessary before using this node.

Troubleshooting

  • Common Issues:

    • Invalid or missing API key credential will cause authentication failures.
    • Malformed JSON in the "Filters" property can lead to parsing errors.
    • Requesting too many items (exceeding API limits) may result in errors or truncated responses.
  • Error Messages:

    • Errors returned from the API are captured and can appear in the output if "Continue On Fail" is enabled.
    • Typical error messages include authentication failures, invalid parameters, or rate limiting notices.
  • Resolutions:

    • Ensure the API key credential is correctly set up and valid.
    • Validate JSON syntax in the "Filters" input.
    • Adjust the "Return Item Count" to comply with API limits.

Links and References

Discussion