openai-normalizer
Service icon

OpenAI Normalizer

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 9 Oct (yesterday)
 by 
Eone Technologies pvt ltd
0.0
 (0 ratings)
openai-normalizer

OpenAI Normalizer

Documentation
1.0.0


The OpenAI Normalizer component leverages OpenAI’s GPT model to intelligently normalize and structure grocery or food item data from unstructured text (like receipts or shopping lists).
It transforms messy product names into canonical, structured JSON — identifying the item’s standard name, quantity, and whether it is organic.

This component is especially useful for:

  • Grocery receipt parsing

  • Inventory standardization

  • Product data cleaning before analytics

  • Importing external datasets with inconsistent naming


Example Use Case

Input:

organic milk 1L CKN BRST 1KG ORG Ambrosia apple juice 2L

Output:

{ "items": [ { "name": "Milk", "quantity": "1L", "organic": true }, { "name": "Chicken Breast", "quantity": "1KG", "organic": true }, { "name": "Apple Juice", "quantity": "2L", "organic": false } ] }

Technical Overview

API Endpoint:
https://api.openai.com/v1/chat/completions

Model Used:
gpt-4o-mini

Request Format:

{ "model": "gpt-4o-mini", "messages": [ { "role": "system", "content": "You are a grocery receipt normalizer. Return structured JSON only. For product names, always use canonical names." }, { "role": "user", "content": "organic milk 1L\nCKN BRST 1KG ORG\nAmbrosia apple juice 2L" } ], "temperature": 0 }

Response Example:

{ "id": "chatcmpl-CIuKpQjvvO1qMizjaTTc506yF9Rq8", "object": "chat.completion", "model": "gpt-4o-mini-2024-07-18", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "{ \"items\": [ { \"name\": \"Milk\", \"quantity\": \"1L\", \"organic\": true }, { \"name\": \"Chicken Breast\", \"quantity\": \"1KG\", \"organic\": true }, { \"name\": \"Apple Juice\", \"quantity\": \"2L\", \"organic\": false } ] }" } } ] }

Component Features

✅ Cleans and normalizes food item names into canonical English terms
✅ Detects quantities and units (e.g., 1L, 500g, 2kg)
✅ Identifies “organic” items from common keywords
✅ Outputs JSON data ready for storage or analytics
✅ Can be easily integrated with OutSystems Data Models, Entities, and REST Integrations


How to Use in OutSystems

  1. Install the Component from Forge

  2. Configure API Key

    • Set your OpenAI API Key in Site Properties (e.g., OpenAI_APIKey)

  3. Create a REST Integration

    • Endpoint: https://api.openai.com/v1/chat/completions

    • HTTP Method: POST

    • Add Header: Authorization: Bearer <Your_API_Key>

    • Add Header: Content-Type: application/json

  4. Prepare the Request Body

    • Build a JSON payload like the example above

  5. Parse the Response

    • Use JSON Deserialize to convert the response to OutSystems structures

Happy coding :)