Turn Any Interface Into an AI Tool — Shiny DI 3.0
Writing AIFunction subclasses by hand for every operation you want to expose to an LLM is tedious and error-prone. Shiny DI 3.0 adds a [Tool] attribute to your existing service interfaces, and the source generator produces the AI tool adapters automatically — complete with metadata, argument parsing, and registration.
What you’ll learn
- How
[Tool]on an interface and[Description]on methods/parameters drives AI tool generation - How the source generator produces
AIFunctionsubclasses with typed metadata and argument extraction - AOT-safe argument extraction: direct
JsonElementaccessors for standard types, no reflection - How
CancellationTokenparameters are handled automatically without being exposed to the LLM - Conditional generation: AI tool code only emits when
Microsoft.Extensions.AIis referenced - How
AddGeneratedAITools()registers all generated tools as transientAIToolservices