Basic Prompting (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 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 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 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
Basic Prompting (Hello, World)
🧩 Overview
This workflow demonstrates a minimal end‑to‑end interaction in the Playground: a user submits a chat message, a prompt template is applied, a Google Generative AI model generates a response, and the output is displayed back to the user. It showcases how input text is transformed, sent to an LLM, and returned as a chat response.
⚙️ Main Features
- Captures and stores user chat input.
- Dynamically builds a prompt from a predefined template.
- Sends the prompt to a Google Generative AI model for text generation.
- Displays the model’s response in the chat UI.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Chat Input | Accepts user text and optional metadata. | User message, sender type, sender name, session ID, optional files. | Message object containing the user’s input. |
| Prompt | Formats the user message into a prompt template. | Message from Chat Input. | Prompt message ready for the model. |
| Google Generative AI | Generates text using the provided prompt. | Prompt message, system message (optional), model parameters. | Generated text message from the model. |
| Chat Output | Renders the model’s response in the Playground. | Generated text message from the model. | Visible chat message displayed to the user. |
🧠 Notes
- The Google Generative AI component requires a valid Google API key; key management is handled outside the workflow.
- Streaming output is enabled by default, which may affect latency and UI rendering.
- The model used in this example is gemini‑1.5‑flash, a lightweight, fast‑responding variant suitable for quick demonstrations.
- Because the workflow does not retain conversation context beyond a single turn, repeated interactions will not carry over prior messages unless session handling is extended.
- Input validation and error handling are performed internally by each component; users should be aware of API quotas and possible rate‑limit responses from Google.