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

96 lines
2.9 KiB
Markdown
Raw Normal View History

2025-11-24 13:02:30 -03:00
# Chapter 06: BASIC + LLM - The Perfect Match
2025-12-01 02:22:35 -03:00
## Why BASIC?
2025-12-01 02:22:35 -03:00
In 1964, John Kemeny and Thomas Kurtz created BASIC with a revolutionary idea: programming should be for everyone. Today, General Bots brings this philosophy to the AI era.
2025-11-23 20:12:09 -03:00
2025-12-01 02:22:35 -03:00
**With BASIC + LLM, you write:**
2025-11-24 13:02:30 -03:00
```basic
TALK "What's your name?"
HEAR name
2025-12-01 02:22:35 -03:00
poem = LLM "Create a heartfelt poem for " + name
2025-11-24 13:02:30 -03:00
TALK poem
```
2025-12-01 02:22:35 -03:00
**Not 50 lines of boilerplate.**
2025-11-23 09:19:06 -03:00
2025-12-01 02:22:35 -03:00
## The Core Keywords
2025-11-23 20:12:09 -03:00
2025-12-01 02:22:35 -03:00
Just SEVEN main keywords power everything:
2025-11-23 20:12:09 -03:00
2025-12-01 02:22:35 -03:00
| Keyword | Purpose | Example |
|---------|---------|---------|
| **TALK** | Output | `TALK "Hello!"` |
| **HEAR** | Input | `HEAR name AS NAME` |
| **USE KB** | Knowledge | `USE KB "docs"` |
| **USE TOOL** | Functions | `USE TOOL "weather"` |
| **GET** | Data | `GET "api/users"` |
| **IF/THEN** | Logic | `IF age >= 18 THEN ...` |
| **FOR/NEXT** | Loops | `FOR i = 1 TO 10 ...` |
2025-11-23 09:19:06 -03:00
2025-12-01 02:22:35 -03:00
## Your First Tool
2025-11-24 13:02:30 -03:00
2025-12-01 02:22:35 -03:00
In the LLM world, you write tools that AI can use:
2025-11-23 09:19:06 -03:00
```basic
2025-12-01 02:22:35 -03:00
' enrollment.bas - An LLM-callable tool
PARAM name AS STRING LIKE "John Smith" DESCRIPTION "Full name"
PARAM email AS STRING LIKE "john@example.com" DESCRIPTION "Email"
PARAM course AS STRING LIKE "Introduction to AI" DESCRIPTION "Course"
DESCRIPTION "Enrolls a student in a course"
SAVE "enrollments.csv", name, email, course, NOW()
TALK "Enrolled " + name + " in " + course
2025-11-23 09:19:06 -03:00
```
2025-12-01 02:22:35 -03:00
The LLM handles the conversation. You define the action.
2025-11-24 13:02:30 -03:00
2025-12-01 02:22:35 -03:00
## Everyone Can Program
2025-11-24 13:02:30 -03:00
**You don't need:**
- A computer science degree
- Years of experience
- Understanding of algorithms
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-12-01 02:22:35 -03:00
## Getting Started
2025-11-23 17:02:22 -03:00
2025-12-01 02:22:35 -03:00
| Time | Goal |
|------|------|
| Minute 1 | `TALK "Hello, world!"` |
| Minute 5 | Add HEAR and LLM |
| Day 1 | Production-ready bot |
2025-11-23 20:12:09 -03:00
2025-12-01 02:22:35 -03:00
## Documentation Guide
2025-11-23 20:12:09 -03:00
2025-12-01 02:22:35 -03:00
| Document | Purpose |
|----------|---------|
| [Basics](./basics.md) | Core LLM-first concepts |
| [Keywords Reference](./keywords.md) | Complete keyword list |
| [Templates](./templates.md) | Real-world examples |
| [Universal Messaging](./universal-messaging.md) | Multi-channel support |
2025-11-23 20:12:09 -03:00
2025-12-01 02:22:35 -03:00
### Keyword Categories
2025-11-23 20:12:09 -03:00
2025-12-01 02:22:35 -03:00
- **Core:** [TALK](./keyword-talk.md), [HEAR](./keyword-hear.md)
- **Context:** [SET CONTEXT](./keyword-set-context.md), [USE KB](./keyword-use-kb.md)
- **Memory:** [GET/SET BOT MEMORY](./keyword-get-bot-memory.md), [GET/SET USER MEMORY](./keyword-get-user-memory.md)
- **Data:** [GET](./keyword-get.md), [SAVE](./keyword-save.md), [FIND](./keyword-find.md)
- **HTTP:** [POST](./keyword-post.md), [PUT](./keyword-put.md), [DELETE](./keyword-delete-http.md)
- **Files:** [READ](./keyword-read.md), [WRITE](./keyword-write.md), [UPLOAD](./keyword-upload.md)
2025-11-24 14:15:01 -03:00
2025-12-01 02:22:35 -03:00
## The Philosophy
2025-11-24 14:15:01 -03:00
2025-12-01 02:22:35 -03:00
BASIC in General Bots isn't about controlling conversation flow - it's about providing tools and context that LLMs use intelligently.
2025-12-01 02:22:35 -03:00
**Write simple tools. Let AI handle the complexity.**
2025-11-24 14:15:01 -03:00
---
2025-12-01 02:22:35 -03:00
*"The beauty of BASIC lies not in what it can do, but in who it enables to do it."*