Tin

Examples · learn/24-models · 268 of 339

budget

examples/learn/24-models/budget.tintin run examples/learn/24-models/budget.tin
/// Look up a word in the dictionary.
tool fn define(word: string): string => "a soft, silvery metal, used to coat steel so it does not rust"

agent Lexicographer {
  model: "mock"
  tools: [define]
  maxTokens: 40          // the most one question may use, input plus output
}

fn main() {
  match Lexicographer.try("define 'tin'") {
    Ok(text) => print(text)
    Err(e) => print("stopped: {e}")
  }
  print("used {Lexicographer.tokens()} tokens")
}