Skip to main content
Use ToolSet to resolve tools dynamically at runtime. This example shows how tools automatically adapt based on the content type:
The resolve() method is called before each LLM call. It detects the file type and returns different tools:
  • Text/no file: No tools available
  • Image files: Adds analyze_image
  • PDF files: Adds analyze_pdf

Key Features

  • File Type Detection: Automatically detects file type from content type
  • Context-Aware Tools: Only relevant tools are exposed based on content type
  • Token Efficiency: Reduces token usage by showing only necessary tools
  • Flexible: Easily extend to support more file types