AI-Driven Nutritional Info Extraction Workflow

somdn_product_page

This n8n workflow automates the process of obtaining precise nutritional information from food items using an AI language model. The core goal is to generate structured JSON data with details such as calories, proteins, carbs, fats, sodium, and a health score. The workflow starts with a webhook trigger that captures user input, which is then sent to an OpenAI GPT-4 model configured to act as a nutrition expert. The AI’s response is manually validated against a predefined JSON schema to ensure correctness, especially since the built-in structured output parser can be unreliable. If the output is invalid, the workflow retries the query up to four times, prompting the AI to correct its response. Once a valid response is received, the data is stored under a clear variable name for further processing or display. The setup is designed for use cases requiring accurate, formatted nutritional data, such as in health apps, dietary planning tools, or food database enrichment. It effectively replaces the unreliable built-in output parser with a robust manual validation and retry mechanism, ensuring consistent data quality.

Node Count

11 – 20 Nodes

Nodes Used

@n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.chatTrigger, @n8n/n8n-nodes-langchain.lmChatOpenAi, @n8n/n8n-nodes-langchain.memoryBufferWindow, set, stickyNote, switch

Reviews

There are no reviews yet.

Be the first to review “AI-Driven Nutritional Info Extraction Workflow”

Your email address will not be published. Required fields are marked *