An AI-powered error analysis tool that provides intelligent suggestions and fixes for stack traces using LLM models.
$ dotnet add package AIErrorAnalyzerAn AI-powered error analysis tool that provides intelligent suggestions and fixes for stack traces using LLM models.
Install the package via NuGet:
dotnet add package AIErrorAnalyzer
Program.cs or Startup.cs:services.AddErrorAnalyzer(options =>
{
options.HuggingFaceApiKey = "your-api-key";
options.TimeoutSeconds = 30;
});
public class ErrorHandler
{
private readonly IErrorAnalyzer _analyzer;
public ErrorHandler(IErrorAnalyzer analyzer)
{
_analyzer = analyzer;
}
public async Task HandleErrorAsync(Exception ex)
{
var result = await _analyzer.AnalyzeErrorAsync(ex.StackTrace);
if (result.WasSuccessful)
{
Console.WriteLine($"Analysis: {result.Message}");
Console.WriteLine("Suggestions:");
foreach (var suggestion in result.Suggestions)
{
Console.WriteLine($"- {suggestion}");
}
if (!string.IsNullOrEmpty(result.SuggestedCode))
{
Console.WriteLine("Suggested Fix:");
Console.WriteLine(result.SuggestedCode);
}
}
}
}
PythonPath: Path to Python executable (default: "python")ScriptPath: Path to the analyzer script (default: "error_analyzer.py")HuggingFaceApiKey: Your Hugging Face API keyTimeoutSeconds: Maximum time to wait for analysis (default: 30)This project is licensed under the MIT License - see the LICENSE file for details.