Actions9
- Text Actions
- Image Actions
- Audio Actions
- Embedding Actions
Overview
This node integrates with Cloudflare Workers AI models to perform various AI-powered text processing tasks. Specifically, for the Text Generation operation, it generates text based on a user-provided prompt using selected large language models (LLMs). This is useful in scenarios such as content creation, automated writing assistance, brainstorming ideas, or generating responses in chatbots.
For example, you can input a creative writing prompt and receive a continuation or completion of the text, or generate marketing copy from a brief description.
Properties
| Name | Meaning |
|---|---|
| Model | The AI model to use for text generation. Options include: - Llama 3.1 8B Instruct - Llama 3 8B Instruct - Mistral 7B Instruct - Gemma 7B |
| Prompt | The text prompt that serves as the input for the text generation process. |
| Options | Additional parameters controlling generation behavior: - Max Tokens: Maximum tokens to generate (default 256) - Temperature: Sampling temperature controlling randomness (0-2, default 0.7) - Stream: Whether to stream the response (true/false) |
Output
The output JSON contains the generated text result from the AI model under the json field. The exact structure depends on the API response but generally includes the generated text content.
No binary data is produced for this operation.
Example output snippet:
{
"json": {
"text": "Generated text based on the prompt..."
}
}
Dependencies
- Requires a valid Cloudflare API key credential with appropriate permissions.
- The node makes HTTP POST requests to Cloudflare's AI API endpoints specific to the chosen model.
- No additional external dependencies beyond the configured Cloudflare API credentials.
Troubleshooting
Common issues:
- Invalid or missing API credentials will cause authentication failures.
- Exceeding token limits or rate limits imposed by Cloudflare AI services may result in errors.
- Incorrect model selection or unsupported prompt formats could lead to unexpected results or errors.
Error messages:
"Request failed": General failure; check API key validity and network connectivity.- Errors returned from the API are surfaced with their message; review these for details.
Resolution tips:
- Verify your Cloudflare API key and account ID are correctly configured.
- Ensure the prompt is properly formatted and not empty.
- Adjust max tokens and temperature settings if generation quality is poor or errors occur.
- Enable "Continue On Fail" in the node settings to handle individual item errors gracefully.
Links and References
- Cloudflare Workers AI Documentation
- n8n Documentation on Custom Nodes
- OpenAI GPT-like Models Overview (for conceptual understanding of text generation models)