modules Add detailed README documentation for 15+ bot templates including: - Platform analytics, BI reporting, and web crawler templates - CRM, contacts, and marketing automation templates - Legal document processing and office productivity templates - LLM tools, LLM server, and API client integration templates - Reminder management and meta-template for creating new templates Add new Rust configuration modules: - BM25 config for Tantivy-based sparse
7.1 KiB
Template for Creating Templates (template.gbai)
A General Bots meta-template that serves as a starting point for creating new bot templates.
Overview
The Template template (yes, it's a template for templates!) provides the essential structure and best practices for creating new General Bots templates. Use this as your foundation when building custom templates for specific use cases.
Features
- Standard Structure - Pre-configured folder hierarchy
- Best Practices - Follows General Bots conventions
- Documentation Ready - Includes README template
- Quick Start - Minimal setup required
Package Structure
template.gbai/
├── README.md # This documentation
├── template.gbdialog/ # Dialog scripts
│ └── send.bas # Example script (placeholder)
├── template.gbdrive/ # File storage
│ └── (your files here)
├── template.gbkb/ # Knowledge base (optional)
│ └── docs/
└── template.gbot/ # Bot configuration
└── config.csv
Creating a New Template
Step 1: Copy the Template
cp -r templates/template.gbai templates/your-template.gbai
Step 2: Rename Internal Folders
Rename all internal folders to match your template name:
cd templates/your-template.gbai
mv template.gbdialog your-template.gbdialog
mv template.gbdrive your-template.gbdrive
mv template.gbot your-template.gbot
Step 3: Configure Your Bot
Edit your-template.gbot/config.csv:
name,value
Bot Name,Your Bot Name
Theme Color,blue
Answer Mode,default
LLM Provider,openai
Step 4: Create Dialog Scripts
Add your BASIC scripts to your-template.gbdialog/:
' start.bas - Main entry point
ADD TOOL "your-tool"
USE KB "your-template.gbkb"
CLEAR SUGGESTIONS
ADD SUGGESTION "option1" AS "First Option"
ADD SUGGESTION "option2" AS "Second Option"
ADD SUGGESTION "help" AS "Get Help"
BEGIN TALK
**Your Bot Name**
Welcome! I can help you with:
• Feature 1
• Feature 2
• Feature 3
What would you like to do?
END TALK
BEGIN SYSTEM PROMPT
You are a helpful assistant for [your use case].
Guidelines:
- Be helpful and concise
- Use the available tools when appropriate
- Ask clarifying questions when needed
END SYSTEM PROMPT
Step 5: Add Tools
Create tool scripts with proper parameters:
' your-tool.bas
PARAM input AS STRING LIKE "example" DESCRIPTION "Description of this parameter"
PARAM optional_param AS STRING DESCRIPTION "Optional parameter" OPTIONAL
DESCRIPTION "What this tool does - this helps the LLM decide when to use it"
' Your implementation here
result = DO_SOMETHING(input)
IF result THEN
RETURN result
ELSE
RETURN {"error": "Something went wrong"}
END IF
Step 6: Add Knowledge Base (Optional)
If your template needs reference documentation:
your-template.gbkb/
└── docs/
├── feature1.md
├── feature2.md
└── faq.md
Step 7: Update README
Replace this README with documentation for your template:
# Your Template Name (your-template.gbai)
Description of what your template does.
## Overview
Detailed overview...
## Features
- Feature 1
- Feature 2
- Feature 3
## Package Structure
(Document your structure)
## Configuration
(Document configuration options)
## Usage
(Document how to use)
## Customization
(Document how to customize)
## License
AGPL-3.0 - Part of General Bots Open Source Platform.
Template Checklist
Before publishing your template, ensure:
- All folders renamed to match template name
config.csvconfigured with appropriate defaultsstart.basprovides clear entry point- All tools have
PARAMandDESCRIPTION - System prompt guides LLM behavior
- README documents all features
- No hardcoded credentials or secrets
- Error handling implemented
- Example conversations documented
Naming Conventions
| Item | Convention | Example |
|---|---|---|
| Template folder | kebab-case.gbai |
my-crm.gbai |
| Dialog scripts | kebab-case.bas |
add-contact.bas |
| Tools | kebab-case |
search-products |
| Config keys | Title Case |
Theme Color |
| Table names | PascalCase |
CustomerOrders |
Best Practices
Dialog Scripts
- Clear entry point -
start.basshould be the main entry - Register tools - Use
ADD TOOLfor LLM-callable functions - Set context - Use
SET CONTEXTandBEGIN SYSTEM PROMPT - Add suggestions - Guide users with quick actions
- Welcome message - Use
BEGIN TALKfor introduction
Tools
- Descriptive names - Tool names should indicate function
- Parameter examples - Use
LIKEto show expected format - Clear descriptions - Help LLM understand when to use
- Return values - Always return meaningful results
- Error handling - Handle edge cases gracefully
Configuration
- Sensible defaults - Work out of the box
- Document options - Explain each setting
- No secrets - Use environment variables for credentials
- Flexible - Allow customization without code changes
Documentation
- Clear overview - Explain what the template does
- Feature list - Highlight capabilities
- Usage examples - Show common scenarios
- Configuration guide - Document all settings
- Troubleshooting - Address common issues
File Templates
config.csv Template
name,value
Bot Name,Your Bot Name
Theme Color,blue
Answer Mode,default
LLM Provider,openai
Admin Email,admin@company.com
start.bas Template
' Register tools
ADD TOOL "tool-name"
' Load knowledge base
USE KB "your-template.gbkb"
' Configure suggestions
CLEAR SUGGESTIONS
ADD SUGGESTION "action" AS "Do Something"
' Welcome message
BEGIN TALK
**Bot Name**
Welcome message here.
END TALK
' System prompt
BEGIN SYSTEM PROMPT
You are a helpful assistant.
Define behavior and guidelines here.
END SYSTEM PROMPT
Tool Template
PARAM required_param AS STRING LIKE "example" DESCRIPTION "What this is"
PARAM optional_param AS STRING DESCRIPTION "Optional input" OPTIONAL
DESCRIPTION "What this tool does"
' Implementation
result = YOUR_LOGIC_HERE
IF result THEN
RETURN result
ELSE
RETURN {"error": "Error message"}
END IF
Publishing Your Template
- Test thoroughly - Verify all features work
- Document completely - Users should be self-sufficient
- Follow conventions - Consistent with other templates
- Update main README - Add to templates list
- Submit PR - Include template and documentation
Related Resources
Support
For questions about creating templates:
- Documentation: See General Bots docs
- Issues: GitHub Issues
- Community: Discord/Slack channels
License
AGPL-3.0 - Part of General Bots Open Source Platform.
Pragmatismo - General Bots