AI Foundations & Speed Coding: From ELIZA to Modern AI Apps

AI Foundations · Prompting · Speed Coding

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.

Rule-based AI Probabilistic models CO-STAR prompting Model selection Agentic coding Live code previews

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.

1960s: Rule-based chatPattern matching and hand-written response rules.
1980s–1990s: Expert systemsLarger rule bases encoded specialist knowledge for narrow domains.
2000s: Statistical machine learningSystems increasingly learned patterns from data instead of relying only on explicit rules.
2017: Transformer architectureAttention-based models made large-scale language modeling far more practical.
2020s: Large multimodal and agentic systemsModels increasingly work across text, images, audio, video, code, and tools.

Static example: the same message, two very different systems

Rule-based pattern
I feel worried about my exam.
Why do you feel worried about your exam?

The response can be produced by transforming a recognized pattern.

Context-sensitive generation
I feel worried about my exam. I understand the theory but freeze during timed questions.
A useful next step may be timed practice with short sets, then reviewing where the time went. That targets the problem you described rather than only revising theory.

A modern model can condition its response on more of the message and the instruction context.

Live simulation: rule-based reply vs context-aware style
This is a local teaching simulation, not a real AI model call.
No API · Works locally
Simulated response Why do you feel nervous about presenting to your team?
Business interpretation: rule-based systems are useful when the possible cases are narrow and predictable, such as a tightly controlled decision tree. Generative models are more flexible when inputs vary widely, but flexibility creates new risks such as hallucination, inconsistent output, and higher evaluation requirements.

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

Explain A/B testing.

The model must guess the audience, depth, business setting, and response format.

Better-framed prompt

Context: I am a junior product analyst. Objective: Explain A/B testing for an e-commerce checkout test. Style: Simple language with one numeric example. Tone: Practical and educational. Audience: Beginner analysts. Response: 5 short sections + one practice question.

The task is now easier to evaluate because the desired result is explicit.

The CO-STAR framework

PartMeaningExample
CContext“I manage a SaaS product for small teams.”
OObjective“Generate ideas to reduce trial churn.”
SStyle“Concise, practical, no marketing language.”
TTone“Analytical and direct.”
AAudience“Product manager with basic analytics knowledge.”
RResponse“Table with idea, expected effect, effort, and metric.”
Interactive CO-STAR prompt builder
Fill the fields and watch the prompt-quality meter update.
Interactive
Prompt completeness: 0%
Generated prompt Add details above to build a structured prompt.

Prompt techniques worth learning

Role or perspective

Useful when expertise, viewpoint, or evaluation criteria matter. Example: “Review this dashboard as a retail operations manager.”

Examples

A few examples can teach the desired pattern. This is often called few-shot prompting.

Constraints

Specify what must or must not happen, such as a length limit, data source, calculation method, or output format.

Important: a more detailed prompt is not automatically a better prompt. Extra instructions can conflict. Add details that reduce ambiguity, and remove details that do not change the task.

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.

NeedWhat to prioritizeTypical business example
Complex reasoningHigher-capability reasoning modelEvaluating pricing scenarios with multiple constraints
High-volume simple tasksFast, efficient modelClassifying thousands of customer comments
Very large documentsLong context + reliable retrieval strategyAnalyzing policy manuals or large codebases
Images, audio, or videoMultimodal supportReviewing product images or call recordings
Production automationTool use, structured output, reliability, monitoringAgent that updates a CRM after validated steps
Model-selection practice wizard
This recommends a model category, not a specific vendor.
Decision practice
Recommendation Choose your task and priorities, then run the recommendation.
Why context windows matter: a context window limits how much input and generated material a model can work with in one interaction. A larger window can help with long documents, but larger context does not eliminate the need for good retrieval, careful instructions, and evaluation.

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.

Useful mental model: AI can accelerate implementation, but responsibility for requirements, validation, security, and deployment remains with the developer or team using it.

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.

Choose a code example
Run each example and compare code with the live result.
Safe preset runner
Code
const message = document.querySelector("#message");
message.textContent = "Your dashboard is ready!";
Live result

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.

Fridge Hero 🍳
Local simulation only. No ingredients are sent to an external service.
Live simulation
Example output Enter three ingredients and run the simulation.

Static fallback example

Inputs: Chicken, lemon, garlic
  1. Season and sear the chicken until the surface is golden.
  2. Add garlic and lemon to build a quick pan sauce.
  3. 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.

Do not do this on a public page: 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.

1. Validate

Reject empty, oversized, or unexpected inputs before calling the model.

2. Protect

Store secrets in environment variables or a secret manager, not in Blogger HTML.

3. Monitor

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.

Publishing note: verify fast-changing API model names, pricing, quotas, and product features again whenever you materially update this article.

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.

Question 1: What best describes a classic ELIZA-style system?
Explanation: early chatbots could produce convincing exchanges with pattern matching, even without modern language-model training.
Question 2: Why should a real API key not be placed in Blogger JavaScript?
Explanation: browser source and network requests can be inspected, so long-lived production secrets belong on a backend.
Question 3: Which is the strongest model-selection habit?
Explanation: quality, latency, context, modality, reliability, and cost requirements differ by use case.
Score0 / 3 answered correctly so far.

10. Frequently Asked Questions

What is the main difference between ELIZA and a modern large language model?
ELIZA relied on hand-written patterns and transformations. Modern language models learn statistical patterns from training data and can generate responses based on much broader context and instructions.
Does a better prompt guarantee a correct AI answer?
No. Clear prompts can reduce ambiguity and improve consistency, but a model can still make factual, reasoning, or formatting errors. Important outputs should be checked against reliable sources or evaluated with tests.
What is a context window?
A context window is the amount of tokenized information a model can work with in an interaction. The practical amount of text varies by tokenizer, language, formatting, media inputs, and the model's limits.
Can I put a Gemini API key directly in a Blogger post?
You should not put a long-lived production API key in public client-side Blogger code. Visitors can inspect client-side code and requests. Use a backend or another secure server-side layer that keeps the secret outside the page.
Is the Fridge Hero demo on this page calling a real AI model?
No. It is intentionally a local simulation that demonstrates input collection, validation, loading state, and result rendering without sending data to an external AI service.
Will FAQ schema make this article rank higher or show FAQ rich results?
No. Structured data does not guarantee indexing or ranking. Google stopped showing the FAQ rich-result feature in Search in May 2026, so the FAQ markup included with this lesson should be treated as descriptive structured data rather than a promise of an FAQ rich result.
What should a beginner learn after this lesson?
A useful next sequence is prompt evaluation, API basics, structured outputs, error handling, simple web application architecture, and then a small project where the model output is evaluated against clear success criteria.
Made by Shaleen Shekhar

Post a Comment

1 Comments

  1. 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