|
| 1 | +<div align="center"> |
| 2 | + |
| 3 | +# Burger data generator |
| 4 | + |
| 5 | +[](https://codespaces.new/Azure-Samples/mcp-agent-langchainjs?hide_repo_select=true&ref=main&quickstart=true) |
| 6 | + |
| 7 | +[](https://aka.ms/genaiscript) |
| 8 | + |
| 9 | +[Overview](#overview) • [Installation](#installation) • [Usage](#scripts) • [How it works](#how-it-works) |
| 10 | + |
| 11 | +</div> |
| 12 | + |
| 13 | +This package contains [GenAIScript](https://aka.ms/genaiscript)-powered tools for generating burger restaurant data, including the menu and images. The generated data is then used by the burger API service. |
| 14 | + |
| 15 | +## Overview |
| 16 | + |
| 17 | +The data generated includes: |
| 18 | +- Burger menu data (names, descriptions, prices, toppings) |
| 19 | +- High-quality food images for burgers and toppings |
| 20 | + |
| 21 | +## Installation |
| 22 | + |
| 23 | +1. Run `npm install` to install the necessary dependencies. |
| 24 | +2. Make sure you have access to a large language model (LLM) like `gpt-4o`, `gpt-4.1` or `gpt-5` on either OpenAI or Azure OpenAI for the text data generation, to a model like `gpt-image-1` or `dall-e-3` for image generation. |
| 25 | + * See this [guide](https://learn.microsoft.com/azure/ai-foundry/openai/how-to/create-resource?pivots=web-portal) for deploying a text generation model on Azure OpenAI. |
| 26 | + * See this [guide](https://learn.microsoft.com/azure/ai-foundry/openai/how-to/dall-e?tabs=gpt-image-1) for deploying an image generation model on Azure OpenAI. |
| 27 | +3. Set these environment variables or add them to a `.env` file: |
| 28 | + |
| 29 | +```bash |
| 30 | +GENAISCRIPT_DEFAULT_MODEL="azure:gpt-5" # or "openai:gpt-5" |
| 31 | +GENAISCRIPT_IMAGE_MODEL="azure:gpt-image-1" # or "openai:gpt-image-1" |
| 32 | + |
| 33 | +# For Azure OpenAI, set the following variables: |
| 34 | +AZURE_OPENAI_API_KEY="your-azure-openai-api-key" |
| 35 | +AZURE_OPENAI_API_ENDPOINT="https://your-azure-openai-endpoint.openai.azure.com" |
| 36 | + |
| 37 | +# For OpenAI, set the following variable: |
| 38 | +OPENAI_API_KEY="your-openai-api-key" |
| 39 | +``` |
| 40 | + |
| 41 | +## Usage |
| 42 | + |
| 43 | +### Generate burger menu data |
| 44 | + |
| 45 | +```bash |
| 46 | +npm run generate:burgers |
| 47 | +``` |
| 48 | +Generates a complete burger menu with original burgers and toppings. |
| 49 | + |
| 50 | +### Generate food images |
| 51 | + |
| 52 | +```bash |
| 53 | +npm run generate:images |
| 54 | +``` |
| 55 | +Generates realistic food images for the menu items using AI image generation. |
| 56 | + |
| 57 | +> [!NOTE] |
| 58 | +> You first need to generate the burger menu data before generating images, as the image generation script uses the generated menu data. |
| 59 | +
|
| 60 | +## How it works |
| 61 | + |
| 62 | +Open the scripts in `scripts/` to see how GenAIScript is used along with TypeScript to generate the data. The scripts use prompts to guide the LLM in creating realistic and appealing burger names, descriptions, prices, and images. |
| 63 | + |
| 64 | +### Techniques used |
| 65 | + |
| 66 | +- **Structured outputs**: We use [zod](https://zod.dev) schemas to defined the expected JSON output structure, which helps ensure the generated data is valid and consistent. |
| 67 | +- **LLM-generated prompts**: We use the LLM to dynamically create prompts for generating appealing images. |
| 68 | +- **Sanity checks**: We perform basic sanity checks on the generated data to detect any invalid content. |
0 commit comments