Actions41
- Step/Generation Actions
- Thread Actions
- User Actions
- Dataset Actions
- Experiment Actions
- File Actions
- Prompt Actions
- Score Actions
Overview
This node integrates with the Literal AI API to manage prompts and related entities. Specifically, for the "Prompt" resource with the "Get or Create" operation, it attempts to retrieve an existing prompt by name and template messages or creates a new one if it does not exist. This is useful in scenarios where you want to ensure a prompt exists before proceeding, such as preparing conversational AI workflows, automating prompt management, or dynamically creating prompts based on input data.
Practical examples:
- Automatically create a new prompt with specific template messages if it doesn't already exist in your Literal AI project.
- Retrieve an existing prompt to use its configuration or metadata in subsequent workflow steps.
- Manage prompt settings and tools programmatically within n8n workflows.
Properties
| Name | Meaning |
|---|---|
| Name | The unique name of the prompt to get or create. |
| Template Messages | JSON array representing the template messages that define the prompt's content or structure. |
| Additional Fields | Optional extra fields for the prompt: |
| - Description | A textual description of the prompt. |
| - Settings | JSON object containing configuration settings for the prompt. |
| - Tools | JSON object specifying tools associated with the prompt. |
Output
The node outputs a single item with a json field containing a content property. This content holds the response from the Literal AI API representing the prompt object that was retrieved or created. The structure typically includes details about the prompt such as its ID, name, template messages, settings, tools, and other metadata.
No binary data output is produced by this operation.
Example output snippet (conceptual):
{
"content": {
"id": "prompt_123",
"name": "My Prompt",
"templateMessages": [...],
"settings": {...},
"tools": {...},
"description": "Optional description"
}
}
Dependencies
- Requires an API key credential for the Literal AI API configured in n8n.
- Uses the official Literal AI client library (
@literalai/client) bundled with the node. - Network access to the Literal AI service endpoint.
Troubleshooting
Common issues:
- Invalid or missing API key credential will cause authentication failures.
- Malformed JSON in the "Template Messages" or "Additional Fields" properties can cause parsing errors.
- Providing a prompt name that conflicts with existing resources may lead to unexpected results.
Error messages:
- Authentication errors: Verify that the API key credential is correctly set up and has necessary permissions.
- JSON parse errors: Ensure that JSON inputs are valid and properly formatted.
- API errors from Literal AI: Check the error message returned; it may indicate invalid parameters or service issues.
To resolve errors, double-check all input parameters, especially JSON fields, and confirm API credentials are valid.
Links and References
- Literal AI API documentation: https://docs.literal.ai/
- n8n documentation on credentials: https://docs.n8n.io/credentials/overview/
- JSON formatting help: https://jsonlint.com/