Literal AI icon

Literal AI

Use the Literal AI API

Overview

This node integrates with the Literal AI API to manage various AI-related resources, including prompts. Specifically, the Create Lineage operation under the Prompt resource allows users to create a lineage record for a prompt by specifying its name and an optional description. This is useful for tracking the evolution or versions of prompts in AI workflows.

Common scenarios where this node is beneficial include:

  • Managing prompt version histories in AI projects.
  • Organizing prompt development by linking related prompts through lineage.
  • Automating prompt metadata management within n8n workflows.

For example, a user might create a new prompt lineage to document changes or improvements made to a prompt over time, facilitating better traceability and collaboration.

Properties

Name Meaning
Name The name of the prompt for which the lineage is being created.
Additional Fields Optional fields to provide extra information about the prompt lineage:
- Description A textual description of the prompt lineage, explaining its purpose or details.
- Settings JSON object representing settings associated with the prompt (not used directly here).
- Tools JSON object representing tools associated with the prompt (not used directly here).

Note: For the Create Lineage operation, only the "Name" and "Description" from Additional Fields are relevant; "Settings" and "Tools" are part of the broader prompt properties but not used in this operation.

Output

The node outputs a JSON object under the json field with a single property:

  • content: Contains the response from the Literal AI API after creating the prompt lineage. This typically includes details about the newly created lineage such as identifiers, timestamps, and any metadata returned by the API.

No binary data output is produced by this operation.

Example output structure:

{
  "content": {
    "id": "lineage-id",
    "name": "example-prompt",
    "description": "Optional description",
    "createdAt": "2024-06-01T12:00:00Z",
    ...
  }
}

Dependencies

  • Requires an active connection to the Literal AI API via an API key credential configured in n8n.
  • The node depends on the @literalai/client package to interact with the Literal AI service.
  • Proper API credentials must be set up in n8n to authenticate requests.

Troubleshooting

  • Common issues:

    • Missing or invalid API key credential will cause authentication failures.
    • Providing an empty or missing prompt name will likely result in an error from the API.
    • Malformed JSON in additional fields (if extended) can cause parsing errors.
  • Error messages:

    • Authentication errors: Ensure the API key credential is correctly configured and valid.
    • Validation errors: Check that the "Name" property is provided and non-empty.
    • API errors: Review the Literal AI API documentation for specific error codes and messages.
  • To resolve errors, verify input parameters, ensure proper credential setup, and confirm network connectivity to the Literal AI API endpoint.

Links and References

Discussion