Examples · learn/24-models · 271 of 339
task-1.solution
tin run examples/learn/24-models/task-1.solution.tin/// Fetch an article's text by title.
tool fn article(title: string): string => "tin ".repeat(200)
agent Summariser {
model: "mock"
tools: [article]
maxTokens: 30
}
fn summarise(title: string): string {
match Summariser.try("summarise the article '{title}'") {
Ok(s) => s
Err(OverBudget(n)) => "(too long to summarise within {n} tokens)"
Err(e) => "(failed: {e})"
}
}
fn main() {
print(summarise("Tin"))
}