This documentation provides examples of how to format prompts for different output structures and validation schemas. The examples illustrate requests for information about the first four presidents of the United States and their ages when they assumed office. Below are different prompting formats along with their descriptions.
To request data in CSV format, use the csv command followed by the desired data schema enclosed in curly braces {}. Each property in the schema is represented by a key-value pair, where the key is the column name and the value is the data type as a string.
csv({name:"string", age:"string"}): Who were the first four presidents of the US and how old were they when they became president
This prompt would generate a CSV output with two columns: name and age, both expected to contain string values.
To request data in a simple JSON format, use the json command with a similar data schema as used for the CSV format.
json({name:"string", age:"string"}): Who were the first four presidents of the US and how old were they when they became president
This prompt would result in a JSON object output where the name and age keys are expected to have string values.
For a more advanced JSON format with validation, use the json! keyword. The JSON schema provided should adhere to standards such as the JSON Schema Draft 07 or other relevant drafts.
json!({
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer",
"minimum": 0
}
},
"required": ["name", "age"]
}) Who were the first presidents of the US and the age they became president?
In this example, the JSON schema ensures that the output will be an object with the name as a string and the age as a non-negative integer. Additionally, both name and age fields are required in the output.
- The structure of the command and schema should match the intended output format.
- When using the
json!format for schema validation, ensure that the schema provided is compatible with the relevant JSON Schema draft specification. - The data types and constraints within the schema, such as
type,minimum, orrequired, can be customized to fit the needs of the user's request.
Docker
Build locally:
docker build -t dev-gen-ai-image .
docker run -p 3000:3000 dev-gen-ai-image
docker run --env-file ./.env.local -p 3000:3000 dev-gen-ai-image to pull in env file for multiple azure variables neededPull from ghcr:
docker run -p 3000:3000 ghcr.io/mckaywrigley/chatbot-ui:main
1. Clone Repo
git clone https://github.com/mckaywrigley/chatbot-ui.git2. Install Dependencies
npm i3. Run App
npm run dev4. Use It
You should be able to start chatting.
When deploying the application, the following environment variables can be set:
| Environment Variable | Default value | Description |
|---|---|---|
| OpenAI | ||
| OPENAI_API_HOST | https://api.openai.com |
The base url, for Azure use https://<endpoint>.openai.azure.com |
| OPENAI_API_TYPE | openai |
The API type, options are openai or azure |
| OPENAI_API_VERSION | 2023-03-15-preview |
Only applicable for Azure OpenAI |
| AZURE_DEPLOYMENT_ID | Needed when Azure OpenAI, Ref Azure OpenAI API | |
| OPENAI_ORGANIZATION | Your OpenAI organization ID | |
| DEFAULT_MODEL | gpt-3.5-turbo |
The default model to use on new conversations, for Azure use gpt-35-turbo |
| NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT | see here | The default system prompt to use on new conversations |
| NEXT_PUBLIC_DEFAULT_TEMPERATURE | 1 | The default temperature to use on new conversations |
| GOOGLE_API_KEY | See Custom Search JSON API documentation | |
| GOOGLE_CSE_ID | See Custom Search JSON API documentation |
If you have any questions, feel free to reach out to Mckay on Twitter.
Updated 7/2/2025
In order to limit the number of custom file changes, most .tsx files remain intact with the exception of a few that require customization. The custom branding take place mostly in the global.css and tailwindcss.config.js files, which affect the classes in untouched tsx files. This PR applies to dark mode only.
Package updates (2):
- package-lock.json
- package.json
Customized file changes (15):
- amplify_tutorial_prompt.txt: Name changed to ChattUTC and email change to [email protected]
- basePrompts.tsx: Changed "Amplify Helpers" to "ChattUTC Helpers" in the name and description
- _document.tsx: added google brand fonts (Raleway, Oswald) as in header to accommodate Windows 11
- Chat.tsx: Hid some buttons to help with UX in the top bar navigation and added classes for clarification, added font-sans class to "Start a new conversation" div
- ChatMessage.tsx: Power C icon
- ChatInput.tsx: Name change, feature removals, class control for branding, Library link added under the chat input field
- ChatLoader.tsx: Power C icon, class control for mobile application
- ChatbarSettings.tsx: Email changed to [email protected] along with subject "Feedback for ChattUTC". Hid "Manage Account" button
- globals.css: Includes using branding variables for consistency
- home.tsx: Name change, favicon, logo, login page, background images, default to dark mode, etc.
- KebabMenu.tsx: Menu icon change, class control of submenus for branding
- SettingDialog.tsx: Ensures that when initial settings window is opened, the dark mode option is checked to match the default in home.tsx file.
- OpenCloseButton.tsx: Hide right sidebar
- PromptStatus.tsx: Class control for mobile application
- Sidebar.tsx: Branded UTC dotted arrow, branded separator, color change, unwanted features hidden, class control for branding
- tailwind.config.js: Brand colors and fonts
Public folder additions (4):
- ai-stripes-animation.gif
- chattutc-darkest-bg.jpg
- chattutc-ligh-bg.jpg
- favicon.ico
NOTE: If you are working on a M2 processor Mac, you may need to adjust the Dockerfile to avoid container errors. You may need to remove "--platform=linux/amd64 " from lines 2 and 24.
Corrected code:
FROM node:lts-alpine3.20 AS base