Qwen.ASPClient is a lightweight and efficient ASP.NET wrapper for the Qwen AI API, providing seamless integration into .NET applications.
- Simple and fluent API
- Supports Dependency Injection
- Built-in error handling
- Utilizes
HttpClient
best practices for performance
Install the package via NuGet:
dotnet add package Qwen.ASPClient
var client = new QwenClient("your-api-key");
var response = await client.GenerateResponseAsync("Hello Qwen!");
Console.WriteLine(response.Choices[0].Message.Content);
To register the client in an ASP.NET Core application:
services.AddSingleton<IQwenClient>(provider =>
new QwenClient(Configuration["Qwen:ApiKey"]));
The library provides structured error handling with custom exceptions:
try
{
var response = await client.GenerateResponseAsync("Tell me a joke!");
Console.WriteLine(response.Choices[0].Message.Content);
}
catch (QwenException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature-name
) - Commit your changes (
git commit -m "Add new feature"
) - Push to the branch (
git push origin feature-name
) - Open a Pull Request
If you encounter any issues or have feature requests, please open an issue on GitHub: Issues
This project is licensed under the MIT License - see the LICENSE file for details.