Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 815 Bytes

File metadata and controls

34 lines (23 loc) · 815 Bytes

01 Tool-Calling Assistant

Learn the core pattern behind tool use: detect intent, validate inputs, run a bounded tool, and return structured JSON.

What this example teaches

  • Deterministic routing to allowed tools.
  • Basic input validation and error handling.
  • Structured output for easy downstream use.

Tools included

  • calculator: safe arithmetic evaluation (+ - * / ( )).
  • date: returns current UTC date/time.
  • word_count: counts words in provided text.

Run

python3 run.py --query "what is (12 * 5) + 7"
python3 run.py --query "date"
python3 run.py --query "word count: AI systems need evals"

Run tests

python3 -m unittest discover -s tests -p "test_*.py"

Sample artifacts

  • Input: sample_input/request.json
  • Output: sample_output/response.json