From ELIZA to Modern AI Apps: Learn the Ideas, Then Build Something
This beginner-friendly lesson explains how conversational AI evolved, why prompt design matters, how to choose an AI model by task, and how AI-assisted coding changes the development workflow. You will also use live browser simulations to see the concepts in action without exposing an API key.
1. How AI Conversation Changed: ELIZA vs Modern Language Models
One of the easiest ways to understand modern AI is to compare it with an early chatbot. ELIZA, created in the 1960s, used hand-written patterns. If it detected a phrase such as “I feel sad,” it could transform that phrase into a response such as “Why do you feel sad?” The system did not need a deep representation of sadness. It matched text to rules.
Modern language models work very differently. They are trained on large collections of text and learn statistical patterns that help them predict and generate sequences of tokens. A model can use surrounding context, follow instructions, transform information, write code, summarize documents, and produce many plausible responses to the same request. This does not mean the model “understands” in exactly the human sense, and it can still be wrong.
Static example: the same message, two very different systems
The response can be produced by transforming a recognized pattern.
A modern model can condition its response on more of the message and the instruction context.
2. Prompt Engineering: Better Instructions Create Better Conditions
A prompt is not magic wording. It is a way to provide the model with the information it needs to produce a useful response. A short prompt may be enough for a simple task. A complex task usually benefits from more context, a clear objective, constraints, the intended audience, and the expected output format.
Weak prompt
The model must guess the audience, depth, business setting, and response format.
Better-framed prompt
The task is now easier to evaluate because the desired result is explicit.
The CO-STAR framework
| Part | Meaning | Example |
|---|---|---|
| C | Context | “I manage a SaaS product for small teams.” |
| O | Objective | “Generate ideas to reduce trial churn.” |
| S | Style | “Concise, practical, no marketing language.” |
| T | Tone | “Analytical and direct.” |
| A | Audience | “Product manager with basic analytics knowledge.” |
| R | Response | “Table with idea, expected effect, effort, and metric.” |
Prompt techniques worth learning
Useful when expertise, viewpoint, or evaluation criteria matter. Example: “Review this dashboard as a retail operations manager.”
A few examples can teach the desired pattern. This is often called few-shot prompting.
Specify what must or must not happen, such as a length limit, data source, calculation method, or output format.
3. Choosing an AI Model: Start With the Task, Not the Brand
Model names change quickly. A more durable skill is learning how to select a model by requirement. Ask what the task needs: deep reasoning, low latency, long context, multimodal input, coding ability, tool use, privacy controls, or low cost.
| Need | What to prioritize | Typical business example |
|---|---|---|
| Complex reasoning | Higher-capability reasoning model | Evaluating pricing scenarios with multiple constraints |
| High-volume simple tasks | Fast, efficient model | Classifying thousands of customer comments |
| Very large documents | Long context + reliable retrieval strategy | Analyzing policy manuals or large codebases |
| Images, audio, or video | Multimodal support | Reviewing product images or call recordings |
| Production automation | Tool use, structured output, reliability, monitoring | Agent that updates a CRM after validated steps |
4. Agentic Coding: From Writing Every Line to Directing a Workflow
Traditional coding puts the developer directly in the loop for each line: write code, run it, inspect the result, debug, and repeat. AI-assisted coding can compress some of those steps. You describe a change, an AI coding system proposes edits, tests or inspects the result, and you review the work.
Traditional workflow
PlanWriteRunDebugDeploy
The developer controls the implementation directly and manually coordinates most steps.
Agent-assisted workflow
DescribeReview planAI editsTestsHuman verifies
The human shifts toward requirements, review, testing, security, and deciding whether the generated change is acceptable.
What does not change
Faster code generation does not remove the need to understand the system. You still need to check whether the code solves the actual business problem, whether it handles errors, whether dependencies are safe, whether secrets are protected, and whether tests cover the important cases.
5. Live Code Lab: See What Small JavaScript Changes Do
The following examples show the result of simple front-end logic. The visible code is static HTML text, so the lesson remains understandable if JavaScript fails. The “Run” buttons trigger pre-written safe demonstrations; they do not use eval() and they do not execute arbitrary user code.
const message = document.querySelector("#message");
message.textContent = "Your dashboard is ready!";
Before running
The code can update visible page content after a user action.
Why this matters for analytics apps
The same basic pattern appears in calculators, dashboards, filters, quizzes, and simulations. JavaScript reads an input, applies logic, and updates part of the page. For an educational article, the key explanation should still exist in normal HTML. JavaScript should make the lesson easier to explore rather than being the only place where the lesson exists.
6. Fridge Hero: A Live AI-App-Style Simulation Without Exposing a Key
The original exercise is a recipe generator: enter three ingredients, send them to a generative model, and display the response. A public Blogger page should not contain a private API key. So the live version below simulates the app interface locally. It teaches the front-end workflow safely: collect inputs, validate them, show a loading state, generate a result, and render it.
Static fallback example
- Season and sear the chicken until the surface is golden.
- Add garlic and lemon to build a quick pan sauce.
- Finish the chicken in the sauce and serve with a simple vegetable or grain.
Interpretation: in a real AI application, the model would create the recipe text. The browser would still need input validation, loading feedback, error handling, and safe rendering.
7. Connecting a Real AI Backend Safely
A production API key should not be hardcoded into a public Blogger post or other client-side JavaScript. Anyone can inspect browser code. The safer pattern is: browser → your backend → AI provider. The backend reads the secret from an environment variable and returns only the result the browser needs.
const API_KEY = "AIza...";. Even if the page looks private, client-side code can be inspected.
Backend example using the current Google GenAI JavaScript SDK pattern
The following is an educational server-side example. It intentionally keeps GEMINI_API_KEY on the server. Model availability changes, so verify the model ID in Google AI documentation when you build the project.
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({
apiKey: process.env.GEMINI_API_KEY
});
export async function createRecipe(prompt) {
const interaction = await ai.interactions.create({
model: "gemini-3.6-flash",
input: prompt
});
return interaction.output_text;
}
Browser-side pattern
async function requestRecipe(ingredients) {
const response = await fetch("/api/recipe", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ingredients })
});
if (!response.ok) {
throw new Error("Recipe request failed");
}
return response.json();
}
The important architecture idea is not the specific vendor. Keep long-lived secrets outside the public page, validate incoming data on the server, handle failures, and place usage limits around any endpoint that can create billable requests.
Reject empty, oversized, or unexpected inputs before calling the model.
Store secrets in environment variables or a secret manager, not in Blogger HTML.
Track errors, usage, rate limits, latency, and cost before scaling the app.
Sources and 2026 Update Note
AI products and model names change quickly. The historical teaching structure in this lesson is based on the supplied Session 1 material, while current implementation details were checked against official documentation before publication.
- Google AI for Developers: Gemini API key security
- Google AI for Developers: current text-generation examples
- Google AI for Developers: current Gemini model list
- Google Search Central: JavaScript SEO basics
- Google Search Central: FAQ rich-result removal update
9. Knowledge Check
Answer the three questions. The explanations are also included in the page so the learning value is not dependent on the quiz script.

1 Comments
Really liked how this explained AI prompting in such a practical way. The examples make it much easier to understand how a small change in a prompt can improve the output. Very useful for anyone starting with AI and coding!
ReplyDelete