resume = LLM "In a few words, resume this: " + text
```
The `LLM` keyword sends a prompt to the language model and returns the response. Here it's creating a concise summary of the document.
### Storing in Bot Memory
```basic
SET BOT MEMORY "resume", resume
```
Bot memories are persistent key-value pairs that survive across sessions. They're perfect for storing pre-processed content that needs quick access.
## Use Cases
### Daily News Digest
```basic
SET SCHEDULE "0 6 * * *" ' Daily at 6 AM
news = GET "knowledge/daily-news.txt"
summary = LLM "Create a brief summary of today's key points: " + news
SET BOT MEMORY "daily_digest", summary
```
### Weekly Report Generation
```basic
SET SCHEDULE "0 9 * * 1" ' Monday at 9 AM
data = GET "reports/weekly-data.csv"
analysis = LLM "Analyze this weekly data and highlight trends: " + data
SET BOT MEMORY "weekly_report", analysis
```
### Content Freshness Check
```basic
SET SCHEDULE "0 */4 ** *" ' Every 4 hours
doc = GET "policies/current-policy.pdf"
extract = LLM "Extract the version and date from this document: " + doc
SET BOT MEMORY "policy_version", extract
```
## Best Practices
1.**Schedule Wisely**: Avoid scheduling resource-intensive tasks too frequently
2.**Handle Errors**: Check if documents exist before processing
3.**Optimize Prompts**: Use clear, concise prompts for better LLM responses
4.**Memory Management**: Use meaningful keys for bot memories
5.**Test First**: Run the script manually before scheduling
## Integration with Start Dialog
The memories set by scheduled tasks can be used in the start dialog:
```basic
' In start.bas
resume = GET BOT MEMORY "resume"
SET CONTEXT "summary" AS resume
TALK resume
```
## Monitoring Scheduled Tasks
Scheduled tasks run in the background. Check logs for execution status:
- Successful runs are logged at INFO level
- Errors are logged at ERROR level
- Schedule changes are logged when the script runs
## Common Patterns
### Conditional Updates
```basic
SET SCHEDULE "0 * ** *" ' Hourly
current = GET "data/current.json"
stored = GET BOT MEMORY "last_data"
IF current <> stored THEN
summary = LLM "Summarize changes in: " + current
SET BOT MEMORY "last_data", current
SET BOT MEMORY "change_summary", summary
END IF
```
### Multiple Document Processing
```basic
SET SCHEDULE "0 0 * * *" ' Daily at midnight
docs = ["doc1.pdf", "doc2.pdf", "doc3.pdf"]
combined = ""
FOR EACH doc IN docs
content = GET "knowledge/" + doc
combined = combined + "\n---\n" + content
NEXT
summary = LLM "Create an executive summary: " + combined
SET BOT MEMORY "daily_summary", summary
```
### Time-Based Content
```basic
SET SCHEDULE "0 7 * * *" ' Daily at 7 AM
hour = HOUR(NOW())
greeting = ""
IF hour <12THEN
greeting = "Good morning! "
ELSE
greeting = "Good day! "
END IF
news = GET "updates/daily.txt"
brief = LLM "Summarize in one sentence: " + news
SET BOT MEMORY "daily_greeting", greeting + brief
```
## Limitations
- Scripts run asynchronously - don't expect immediate updates
- Long-running scripts may timeout
- Memory updates are not instantly visible to active sessions
- Schedule syntax must be valid cron format
## Summary
The update-summary pattern enables bots to maintain fresh, pre-processed content without manual intervention. By combining `SET_SCHEDULE`, `GET`, `LLM`, and `SET_BOT_MEMORY`, you can create intelligent bots that stay current with changing information and provide instant access to summarized content.