2025-10-25 14:50:14 -03:00
|
|
|
# Dialog Basics
|
2025-10-25 15:59:06 -03:00
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
BASIC dialogs in General Bots are designed for the LLM era - you write tools and context setters, not complex conversation flows.
|
2025-10-25 15:59:06 -03:00
|
|
|
|
|
|
|
|
## Core Concepts
|
|
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
| Concept | Description |
|
|
|
|
|
|---------|-------------|
|
|
|
|
|
| **LLM Tools** | BASIC scripts that become callable tools for the LLM |
|
|
|
|
|
| **Context** | SET CONTEXT provides knowledge to the LLM |
|
|
|
|
|
| **Suggestions** | ADD SUGGESTION guides conversations |
|
|
|
|
|
| **Memory** | GET/SET BOT/USER MEMORY for persistent data |
|
2025-10-25 15:59:06 -03:00
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
## LLM-First Example
|
2025-10-25 15:59:06 -03:00
|
|
|
|
|
|
|
|
```basic
|
2025-11-24 13:02:30 -03:00
|
|
|
' Load context from memory
|
2025-12-01 02:22:35 -03:00
|
|
|
resume = GET BOT MEMORY "announcements"
|
|
|
|
|
context = GET BOT MEMORY "company_info"
|
2025-11-24 13:02:30 -03:00
|
|
|
|
|
|
|
|
' Give LLM the context it needs
|
2025-12-01 02:22:35 -03:00
|
|
|
SET CONTEXT "announcements" AS resume
|
|
|
|
|
SET CONTEXT "company" AS context
|
2025-11-24 13:02:30 -03:00
|
|
|
|
|
|
|
|
' Guide the conversation
|
2025-12-01 02:22:35 -03:00
|
|
|
CLEAR SUGGESTIONS
|
|
|
|
|
ADD SUGGESTION "announcements" AS "Show me this week's updates"
|
|
|
|
|
ADD SUGGESTION "company" AS "Tell me about the company"
|
2025-11-24 13:02:30 -03:00
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
' Start conversation
|
2025-11-24 13:02:30 -03:00
|
|
|
TALK "What would you like to know?"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Creating LLM Tools
|
|
|
|
|
|
|
|
|
|
Instead of parsing user input, create tools the LLM can call:
|
|
|
|
|
|
|
|
|
|
```basic
|
|
|
|
|
' update-summary.bas - A tool the LLM can invoke
|
|
|
|
|
PARAM topic AS STRING LIKE "Q4 Results" DESCRIPTION "Topic to summarize"
|
|
|
|
|
PARAM length AS STRING LIKE "brief" DESCRIPTION "brief or detailed"
|
|
|
|
|
|
|
|
|
|
DESCRIPTION "Creates a summary of the requested topic"
|
|
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
data = GET BOT MEMORY topic
|
2025-11-24 13:02:30 -03:00
|
|
|
summary = LLM "Summarize this " + length + ": " + data
|
|
|
|
|
TALK summary
|
2025-10-25 15:59:06 -03:00
|
|
|
```
|
|
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
## Traditional vs LLM Approach
|
2025-11-24 13:02:30 -03:00
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
| Traditional | LLM + BASIC |
|
|
|
|
|
|-------------|-------------|
|
2025-11-24 13:02:30 -03:00
|
|
|
| Parse user input manually | LLM understands naturally |
|
|
|
|
|
| Complex IF/ELSE trees | Tools with PARAMs |
|
|
|
|
|
| Validate every field | LLM handles validation |
|
|
|
|
|
| Design conversation flows | LLM manages conversation |
|
|
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
## Tool Pattern Example
|
2025-11-24 13:02:30 -03:00
|
|
|
|
|
|
|
|
```basic
|
2025-12-01 02:22:35 -03:00
|
|
|
' schedule-appointment.bas
|
2025-11-24 13:02:30 -03:00
|
|
|
PARAM service AS STRING LIKE "consultation" DESCRIPTION "Type of appointment"
|
2025-12-01 02:22:35 -03:00
|
|
|
PARAM date AS DATE LIKE "tomorrow at 3pm" DESCRIPTION "Preferred date/time"
|
2025-11-24 13:02:30 -03:00
|
|
|
|
|
|
|
|
DESCRIPTION "Schedules an appointment and sends confirmation"
|
|
|
|
|
|
|
|
|
|
appointment = GET "api/appointments/available" WITH service, date
|
|
|
|
|
IF appointment.available THEN
|
2025-12-01 02:22:35 -03:00
|
|
|
SET BOT MEMORY "last_appointment" AS appointment.id
|
2025-11-24 13:02:30 -03:00
|
|
|
SEND EMAIL TO user.email WITH appointment.details
|
2025-12-01 02:22:35 -03:00
|
|
|
TALK "Scheduled your " + service + " for " + date
|
2025-11-24 13:02:30 -03:00
|
|
|
ELSE
|
|
|
|
|
alternatives = GET "api/appointments/suggest" WITH service, date
|
2025-12-01 02:22:35 -03:00
|
|
|
TALK "That time isn't available. Alternatives: " + alternatives
|
2025-11-24 13:02:30 -03:00
|
|
|
END IF
|
|
|
|
|
```
|
2025-11-23 17:02:22 -03:00
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
## Best Practices
|
|
|
|
|
|
|
|
|
|
| Do | Don't |
|
|
|
|
|
|----|-------|
|
|
|
|
|
| Write focused tools | Create complex conversation flows |
|
|
|
|
|
| Use context wisely | Micromanage the LLM |
|
|
|
|
|
| Trust the LLM | Parse user input manually |
|
|
|
|
|
| Use suggestions | Force rigid paths |
|
2025-10-25 15:59:06 -03:00
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
## See Also
|
2025-10-25 15:59:06 -03:00
|
|
|
|
2025-12-01 02:22:35 -03:00
|
|
|
- [Keywords Reference](./keywords.md) - Complete keyword list
|
|
|
|
|
- [Chapter Overview](./README.md) - Philosophy and introduction
|
|
|
|
|
- [Templates](./templates.md) - Real-world examples
|