Project 1 — Basic LLM chatbot
Words made simple
A few useful meanings before you read the explanation.
- LLM
- A model trained to work with language. It can write or summarize text, but its answer still needs checking against reliable information.
- AI
- Software techniques for tasks such as recognizing patterns, understanding language or generating content.
- API
- A way for one piece of software to ask another for data or an action. A claims API might return the current status of a claim.
More words from this lesson
- Token
- A small piece of text processed by a model. It may be a whole word, part of a word, or punctuation.
- Retrieval
- Finding and fetching information that is useful for the current question.
- Agent
- An application that uses a model to choose its next action within defined limits. It can use tools and continue through several steps.
- Authorization
- Checking what that identity is allowed to read or do. Being logged in does not grant access to every record.
- Tenant
- A customer or organization whose data must stay separate from other customers in a shared application.
- Build in this order.
- Each project extends a capability, not necessarily a separate repository.
- These are future learning projects; the notes remain in this one file.
- Move forward when you can explain the trade-offs and demonstrate the acceptance criteria, rather than after an arbitrary number of days.
Requirements
An authenticated user submits bounded text and receives an answer. Handle provider refusal, timeout, empty output, and missing configuration clearly.
Architecture
React → Node API → approved LLM → validated answer → React. React collects input, Node owns credentials and policy, and the model performs the language task.
Technologies
Existing MERN/Next.js stack, one provider SDK, Zod, normal backend logs. No agent framework is required.
Database design
- Conversation and message records with tenant/user ownership, roles, timestamps, prompt/model version, and completion status.
- Store only required content under a retention policy.
API design
POST /chat accepts a message and authorized conversation ID. Reject oversized input and return structured failure codes.
AI design
Clear system task and unknown behavior; bounded recent history; one model call. Begin with supplied-text explanation so no private facts need retrieval.
Security
Server-side credentials, session checks, scoped conversation reads, escaping in React, quotas, and redacted logs.
Evaluation
Test ordinary input, empty/large input, injected request, refusal, timeout, and invented account facts. Check usefulness and safe failure, not exact wording.
Observability
Request/model spans, latency, tokens, error category, task outcome, and safe run ID.
Deployment
Existing Node/container/serverless hosting with request limits verified and secrets configured. Separate development and production credentials.
Interview questions
- “Why no agent?” Answer: one language task needs one call.
- “How do you prevent client key leakage?” Answer: the browser calls authenticated backend routes and never receives the provider secret.
Acceptance: No key in the client bundle; unauthorized conversations fail; provider failure never produces a fabricated successful answer.
Can you explain it without the notes?
Project 1 — Basic LLM chatbot
Use your own words. Explain an example and one limitation before checking the explanation.
Check your explanation
Build in this order. Each project extends a capability, not necessarily a separate repository. These are future learning projects; the notes remain in this one file. Move forward when you can explain the trade-offs and demonstrate the acceptance criteria,…
Turn this concept into a clear answer.
Practice this conceptAdapted from 13_AI.MD · “Project 1 — Basic LLM chatbot”. Examples are study fragments; framework behavior can depend on your version.