Actions2
Overview
This node interacts with the g4f API to perform operations related to large language models (LLMs). Specifically, it supports two operations: 'Ask AI' for chatting with a language model, and 'Generate Image' for generating images from prompts. However, the 'Generate Image' operation is not yet implemented. The node is useful for scenarios where users want to integrate AI-driven text generation or chat capabilities into their workflows, such as generating responses, completing text, or simulating conversations with AI models.
Use Case Examples
- Using the 'Ask AI' operation to send a conversation history and receive a model-generated response for customer support automation.
- Preparing prompts and options to generate creative text completions or summaries using different AI providers and models.
Properties
| Name | Meaning |
|---|---|
| Operation | The action to perform with the g4f API, either chatting with a language model ('Ask AI') or generating an image ('Generate Image'). |
Output
JSON
jsonrole- Role of the message sender in the AI response (e.g., assistant).content- The content of the AI-generated message or response.usage- Token usage statistics from the AI response (if available).model- The model used to generate the response.id- Identifier of the AI response.fullResponse- The full raw response from the g4f API.
Dependencies
- Requires an API key credential for the g4f API, including base URL and optional API key for authorization.
Troubleshooting
- Common issues include failure to get a response from the g4f API, which may be due to network problems, invalid credentials, or API errors. The node throws a descriptive error message indicating failure to get a response.
- If the 'Generate Image' operation is selected, the node will throw an error because this feature is not yet implemented.
- Ensure that the API key and base URL credentials are correctly configured to avoid authorization errors.