GenAI.Reference.Samples has 2 samples:
- Wade, the AI Meteorologist - this sample demonstrates simple tool calling to fetch weather from an API and have the LLM provide a weather report in Wade's persona.
- TaxImpactAnalyzer - demonstrates AgentGroupChat that leverages the Semantic Kernel to analyze and review the tax implications of documents, focusing on US tax law. The application uses two agents:
TaxImpactAnalyzerAgentandTaxImpactReviewerAgent. TheTaxImpactAnalyzerAgentanalyzes the tax implications of an image, while theTaxImpactReviewerAgentreviews the analysis and provides a recommendation on whether to keep or discard the document.
- Wade, the AI Meteorologist:
- Accepts a valid location
- Fetches weather data json from an API.
- Wade provides the weather report based on the weather data.
- TaxImpactAnalyzer:
- Analyze tax implications of documents based on US tax law.
- Review the analysis and provide recommendations.
- Supports image uploads for analysis.
- Interactive chat interface using Spectre.Console.
- .NET 8.0 SDK or later
- Visual Studio 2022/VS Code or later
- Azure OpenAI API Key and Endpoint
- WeatherAPI.com api key
Add your Azure OpenAI API Key and Endpoint to the user secrets:
dotnet user-secrets set "AI:EASub:AzureOpenAI:Endpoint" "<azure openai endpoint goes here>"
dotnet user-secrets set "AI:EASub:AzureOpenAI:ApiKey" "<azure openai api key goes here>"
dotnet user-secrets set "AI:WeatherApi:ApiKey" "<weather api key goes here>"Restore the required NuGet packages:
dotnet restoreComment the line await RunTaxImpactAnalyzer(kernel); and uncomment the line await RunWadeTheMeteorologist(weatherApiKey, kernel); in Program.cs
Comment the line await RunWadeTheMeteorologist(weatherApiKey, kernel); and uncomment the line await RunTaxImpactAnalyzer(kernel); in Program.cs
Run the application using Visual Studio or the .NET CLI:
dotnet runEnter the path for the document you want to analyze when prompted. The application will analyze the document and provide a recommendation based on the tax implications. In the User Prompt type in 'data/donation01.jpg' as the path for the sample receipt in the data folder.
- When prompted, upload your receipt, letter, or document for tax impact analysis. There's a sample receipt in the data folder.
- The
TaxImpactAnalyzerAgentwill analyze the document and provide an analysis. - The
TaxImpactReviewerAgentwill review the analysis and ask a key question based on the user's input. - The application will provide a recommendation on whether to keep or discard the document.
Program.cs: Main entry point of the application.GenAI.AgentGroupChat.Core: Core logic and classes for the application.
Contributions are welcome! Please open an issue or submit a pull request for any changes.
The main entry point of the application. It sets up the configuration, initializes the agents, and handles the user interaction loop.
Defines a custom termination strategy for the chat. The conversation terminates when the final message contains the term "I recommend".
Contains the SP (System Prompt) instructions for the TaxImpactAnalyzerAgent. This agent analyzes the tax implications of an image, focusing on US tax law.
Contains the SP (System Prompt) instructions for the TaxImpactReviewerAgent. This agent reviews the Tax Impact Analysis provided by the TaxImpactAnalyzerAgent and asks the user key questions to provide a recommendation.
Provides weather data from weatherapi.com using Semantic Kernel's KernelFunction invokation