Basic instructions (Hello, world)
Basic interaction between user input, the instruction template (prompt), and an AI model's response.
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
ChatOutput-2qvaz[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output]
style ChatOutput-2qvaz stroke:#a170ff
GoogleGenerativeAIModel-n5twn[Google Generative AI]
style GoogleGenerativeAIModel-n5twn stroke:#a170ff
Prompt-061ik[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt]
style Prompt-061ik stroke:#a170ff
ChatInput-3x8pa[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Input]
style ChatInput-3x8pa stroke:#a170ff
ChatInput-3x8pa -.- Prompt-061ik
linkStyle 0 stroke:#a170ff
Prompt-061ik -.- GoogleGenerativeAIModel-n5twn
linkStyle 1 stroke:#a170ff
GoogleGenerativeAIModel-n5twn -.- ChatOutput-2qvaz
linkStyle 2 stroke:#a170ff
🧩 Overview
This workflow implements a simple “Hello, World” chat interaction.
It captures a user’s message, formats it into a prompt, sends the prompt to a Google Generative AI model, and returns the AI’s reply to the chat interface. The process automates the full round‑trip from input to output, enabling instant, AI‑driven responses without manual intervention.
⚙️ Main Features
- User Input Capture – Collects the user’s text message and conversation context.
- Prompt Generation – Constructs a template‑based prompt that embeds the user’s input.
- AI Text Generation – Sends the prompt to Google Generative AI (Gemini) and receives a generated response.
- Response Display – Renders the AI’s reply back into the chat UI for the user to see.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Label Component | Provides a descriptive header for the workflow. | – | Header text displayed to users. |
| Chat Input | Accepts the user’s message and conversation metadata. | User text, conversation ID, sender details, session ID | Chat message object containing the user input. |
| Prompt | Builds a prompt string that incorporates the user’s message. | User message object | Prompt message ready for the AI model. |
| Google Generative AI | Sends the prompt to the Gemini model and retrieves a response. | Prompt string, model parameters (e.g., model name, temperature, max tokens) | AI‑generated text message. |
| Chat Output | Displays the AI’s reply in the chat interface. | AI‑generated text | Message shown to the user. |
🧠 Notes
- The workflow requires a valid Google API key configured for the Gemini model.
- The default model is Gemini 1.5 Flash, but it can be changed via the model parameter.
- Streaming is enabled; the response is streamed back as it is generated.
- User messages are stored in the conversation history by default.
- The prompt template can be edited to modify the instructions given to the AI.
- All components are fully typed, ensuring clear data flow between steps.