botserver/docs/src/chapter-06-gbdialog/README.md

334 lines
9.7 KiB
Markdown
Raw Normal View History

2025-11-24 13:02:30 -03:00
# Chapter 06: BASIC + LLM - The Perfect Match
2025-11-24 13:02:30 -03:00
## Why BASIC? Because Everyone Can Code
2025-11-24 13:02:30 -03:00
In 1964, John Kemeny and Thomas Kurtz created BASIC (Beginner's All-purpose Symbolic Instruction Code) at Dartmouth College with a revolutionary idea: programming should be for everyone, not just computer scientists. They wanted students from all disciplines - humanities, arts, sciences - to experience the power of computing. Today, General Bots brings this philosophy to the AI era. We chose BASIC not despite its simplicity, but because of it.
2025-11-23 20:12:09 -03:00
2025-11-24 13:02:30 -03:00
**The truth about modern programming:** Most frameworks are overengineered. Most diagrams are unnecessary. Most technical complexity serves no real purpose except to exclude people.
2025-11-24 13:02:30 -03:00
With BASIC + LLM, you write:
```basic
TALK "What's your name?"
HEAR name
poem = LLM "Create a beautiful, heartfelt poem using the name " + name + " that celebrates this person's uniqueness"
TALK "Hello, " + name + "! I wrote something special for you:"
TALK poem
```
Not this:
```javascript
const bot = new BotFramework.ActivityHandler();
bot.onMessage(async (context, next) => {
await context.sendActivity(MessageFactory.text("What's your name?"));
// 50 more lines of boilerplate...
});
```
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
## No Spaghetti. No Diagrams. Just Conversation.
2025-11-23 20:12:09 -03:00
2025-11-24 13:02:30 -03:00
Traditional programming creates spaghetti code with complex flows, state machines, and architectural diagrams. But human conversation doesn't need diagrams. Neither should bot programming.
2025-11-23 20:12:09 -03:00
2025-11-24 13:02:30 -03:00
**BASIC + LLM means:**
- Write code like you speak
- No abstract concepts to master
- No frameworks to learn
- No dependencies to manage
- Just a FEW keywords that do EVERYTHING
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
## The Magic: LLM Fills the Gaps
Here's the revolutionary insight: LLMs understand context. You don't need to program every detail. Write the skeleton, let AI handle the flesh.
2025-11-23 09:19:06 -03:00
```basic
2025-11-24 13:02:30 -03:00
TALK "Tell me about your dream"
HEAR dream
insight = LLM "Provide a thoughtful, encouraging response about this dream: " + dream
TALK insight
2025-11-23 09:19:06 -03:00
```
2025-11-24 13:02:30 -03:00
Traditional programming would require date parsers, validation logic, error handling. With BASIC + LLM, the intelligence is built-in.
## Everyone Is Invited to Program
**You don't need:**
- A computer science degree
- Years of experience
- Understanding of algorithms
- Knowledge of design patterns
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
**You just need:**
- An idea
- 10 minutes to learn BASIC
- Creativity
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
### Real People Writing Real Code
- **Teachers** creating educational assistants
- **Doctors** building diagnostic helpers
- **Lawyers** automating document review
- **Artists** making interactive experiences
- **Students** learning by doing
- **Retirees** solving real problems
## The Core Keywords - That's All
Just SEVEN main keywords power everything:
### 1. TALK - Output to User
2025-11-23 09:19:06 -03:00
```basic
2025-11-24 13:02:30 -03:00
TALK "Hello, world!"
TALK "The answer is: " + answer
2025-11-23 09:19:06 -03:00
```
2025-11-24 13:02:30 -03:00
### 2. HEAR - Input from User
```basic
HEAR name
HEAR age AS NUMBER
HEAR confirm AS BOOLEAN
```
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
### 3. USE KB - Knowledge Base
```basic
USE KB "company-docs"
' Now the bot knows everything in those documents
```
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
### 4. USE TOOL - Enable Functions
2025-11-23 17:02:22 -03:00
```basic
USE TOOL "weather"
2025-11-24 13:02:30 -03:00
USE TOOL "calculator"
' LLM decides when to use them
```
### 5. GET - Access Data
```basic
user_data = GET "api/user/profile"
weather = GET "weather/london"
```
### 6. IF/THEN/ELSE - Logic
```basic
IF age >= 18 THEN
TALK "Welcome!"
ELSE
TALK "Sorry, adults only"
END IF
```
### 7. FOR/NEXT - Loops
```basic
FOR i = 1 TO 10
TALK "Number: " + i
NEXT
2025-11-23 17:02:22 -03:00
```
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
That's it. Seven keywords. Infinite possibilities.
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
## Breaking the Barriers
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
### From Consumer to Creator
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
Most people consume technology but never create it. BASIC changes this:
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
**Monday:** Never programmed before
**Tuesday:** Writing first TALK/HEAR script
**Wednesday:** Adding knowledge bases
**Thursday:** Integrating tools
**Friday:** Deploying production bot
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
### Real Examples from Real People
2025-11-23 17:02:22 -03:00
2025-11-24 13:02:30 -03:00
**Maria, 62, Retired Teacher:**
2025-11-23 09:19:06 -03:00
```basic
2025-11-24 13:02:30 -03:00
' My first bot helps students learn with encouragement
TALK "What's your name, dear student?"
HEAR name
TALK "Let's practice multiplication, " + name + "!"
x = RANDOM(1, 10)
y = RANDOM(1, 10)
TALK "What is " + x + " times " + y + "?"
HEAR answer AS NUMBER
correct = x * y
IF answer = correct THEN
praise = LLM "Create an encouraging message for a student named " + name + " who just got a math problem correct"
TALK praise
2025-11-23 09:19:06 -03:00
ELSE
2025-11-24 13:02:30 -03:00
comfort = LLM "Gently encourage " + name + " after a wrong answer, explaining that " + x + " times " + y + "Correct! Well done!"
ELSE
TALK "Not quite. The answer is " + correct
2025-11-23 09:19:06 -03:00
END IF
```
2025-11-24 13:02:30 -03:00
**João, 45, Small Business Owner:**
2025-11-23 09:19:06 -03:00
```basic
2025-11-24 13:02:30 -03:00
' Customer service bot for my restaurant
USE KB "menu"
USE TOOL "reservations"
TALK "Welcome to João's Kitchen!"
TALK "I can help with our menu or reservations."
2025-11-23 09:19:06 -03:00
```
2025-11-24 13:02:30 -03:00
## The Democratization Movement
### It's Not About Being Easy - It's About Being Possible
Complex languages aren't "better" - they're exclusionary. When programming is hard, only few can participate. When it's simple, everyone can contribute.
### Your Voice Matters
Every person who learns BASIC brings unique perspective:
- Different problems to solve
- Different ways of thinking
- Different communities to serve
### Join the Revolution
1. **Start Today** - Download General Bots, write your first script
2. **Share Your Creation** - Every bot inspires others
3. **Teach Someone** - Pass the knowledge forward
4. **Build Something Real** - Solve actual problems
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
## Advanced Power, Simple Syntax
Don't let simplicity fool you. BASIC can:
### Web Automation
2025-11-23 09:19:06 -03:00
```basic
2025-11-24 13:02:30 -03:00
URL "https://example.com"
CLICK "Login"
TYPE "email" "user@example.com"
2025-11-23 09:19:06 -03:00
```
2025-11-24 13:02:30 -03:00
### API Integration
```basic
USE TOOL "payment-api"
TALK "Processing your payment..."
```
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
### Enterprise Scale
2025-11-23 09:19:06 -03:00
```basic
2025-11-24 13:02:30 -03:00
customers = GET "database/customers"
FOR EACH customer IN customers
SEND EMAIL TO customer
NEXT
2025-11-23 09:19:06 -03:00
```
2025-11-24 13:02:30 -03:00
## No Technical Debt
2025-11-23 17:02:22 -03:00
2025-11-24 13:02:30 -03:00
Traditional programming accumulates technical debt:
- Dependencies need updating
- Frameworks become obsolete
- Code becomes unmaintainable
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
BASIC scripts remain readable forever. A script from today will make sense in 10 years.
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
## The Future Is Conversational
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
Programming is evolving from writing instructions to having conversations. BASIC + LLM is the bridge:
2025-11-23 17:02:22 -03:00
2025-11-23 09:19:06 -03:00
```basic
2025-11-24 13:02:30 -03:00
' The future of programming
TALK "Build me a customer dashboard"
HEAR requirements
solution = ANSWER requirements WITH TOOLS
TALK "Done! " + solution
2025-11-23 09:19:06 -03:00
```
2025-11-24 13:02:30 -03:00
## Start Your Journey Now
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
### Minute 1: Hello World
```basic
TALK "Hello, beautiful world!"
TALK "I'm here to listen and help."
```
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
### Minute 5: Interactive & Emotional
```basic
TALK "What's your name?"
HEAR name
poem = LLM "Write a touching 2-line poem that includes the name " + name + " and makes them feel special and valued"
TALK poem
TALK "It's truly wonderful to meet you, " + name
2025-11-23 09:19:06 -03:00
```
2025-11-24 13:02:30 -03:00
### Day 1: Production Ready
```basic
USE KB "support"
USE TOOL "ticket-system"
USE TOOL "email"
TALK "I'm your support assistant. How can I help?"
2025-11-23 17:02:22 -03:00
```
2025-11-24 13:02:30 -03:00
## Your First LLM Tool - Complete Example
In the LLM world, you don't write complex menu systems. You write tools that the AI can use intelligently. Here's a real enrollment tool:
2025-11-23 09:19:06 -03:00
```basic
2025-11-24 13:02:30 -03:00
' enrollment.bas - An LLM-callable tool
' The LLM collects the information naturally through conversation
PARAM name AS string LIKE "John Smith" DESCRIPTION "Full name of the person"
PARAM email AS string LIKE "john@example.com" DESCRIPTION "Email address"
PARAM course AS string LIKE "Introduction to AI" DESCRIPTION "Course to enroll in"
2025-11-23 17:02:22 -03:00
2025-11-24 13:02:30 -03:00
DESCRIPTION "Enrolls a student in a course. The LLM will collect all required information through natural conversation before calling this tool."
' The actual tool logic is simple
SAVE "enrollments.csv", name, email, course, NOW()
TALK "Successfully enrolled " + name + " in " + course
' That's it! The LLM handles:
' - Collecting information naturally
' - Validating inputs
' - Confirming with the user
' - Error handling
' - All the conversation flow
2025-11-23 09:19:06 -03:00
```
2025-11-24 13:02:30 -03:00
This is the power of BASIC + LLM: You define WHAT (the tool), the LLM handles HOW (the conversation).
## Why We Believe in You
Every person who learns BASIC proves that programming isn't just for the "technical" people. It's for everyone with ideas, problems to solve, and creativity to share.
**You don't need permission to be a programmer.**
**You already are one.**
**You just need to start.**
## Join the Community
The BASIC revolution isn't just about code - it's about people:
- **No question is too simple**
- **Every contribution matters**
- **Beginners teach us most**
- **Your perspective is unique**
2025-11-23 17:02:22 -03:00
2025-11-24 13:02:30 -03:00
## Learn More - Real Stories, Real Code
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
Visit our blog for inspiration and practical examples:
2025-11-23 17:02:22 -03:00
2025-11-24 13:02:30 -03:00
- **[BASIC for Everyone: Making AI Accessible](https://pragmatismo.com.br/blog/basic-for-everyone)** - The philosophy behind our choice of BASIC
- **[BASIC LLM Tools](https://pragmatismo.com.br/blog/basic-llm-tools)** - How to create tools that LLMs can use
- **[MCP is the new API](https://pragmatismo.com.br/blog/mcp-is-the-new-api)** - Understanding modern tool integration
- **[No Forms, Just Conversation](https://pragmatismo.com.br/blog/no-forms)** - Why conversational UI is the future
- **[Beyond Chatbots](https://pragmatismo.com.br/blog/beyond-chatbots)** - Building real business solutions
2025-11-23 17:02:22 -03:00
2025-11-24 13:02:30 -03:00
Read stories from people just like you who discovered they could code.
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
## Final Thought
2025-11-23 09:19:06 -03:00
2025-11-24 13:02:30 -03:00
BASIC has always been about democratization. From mainframes to personal computers, from computers to smartphones, and now from AI to everyone. General Bots continues this 60-year tradition, bringing BASIC to the age of artificial intelligence.
2025-11-23 17:02:22 -03:00
2025-11-24 13:02:30 -03:00
The question isn't whether you can learn to program.
The question is: what will you create?
2025-11-23 20:12:09 -03:00
2025-11-24 13:02:30 -03:00
**Start writing. The world is waiting for your bot.**
2025-11-23 20:12:09 -03:00
2025-11-24 13:02:30 -03:00
---
2025-11-23 20:12:09 -03:00
2025-11-24 13:02:30 -03:00
*"The beauty of BASIC lies not in what it can do, but in who it enables to do it."*
2025-11-23 20:12:09 -03:00
2025-11-24 13:02:30 -03:00
Continue to [BASIC Keywords Reference](./keywords.md) when you're ready for the complete reference.