Skip to content

Anwar-alhitar/qwen.ASPClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Qwen.ASPClient

Qwen.ASPClient is a lightweight and efficient ASP.NET wrapper for the Qwen AI API, providing seamless integration into .NET applications.

qwen asp

Features

  • Simple and fluent API
  • Supports Dependency Injection
  • Built-in error handling
  • Utilizes HttpClient best practices for performance

Installation

Install the package via NuGet:

dotnet add package Qwen.ASPClient

Usage Example

var client = new QwenClient("your-api-key");
var response = await client.GenerateResponseAsync("Hello Qwen!");
Console.WriteLine(response.Choices[0].Message.Content);

Dependency Injection

To register the client in an ASP.NET Core application:

services.AddSingleton<IQwenClient>(provider =>
    new QwenClient(Configuration["Qwen:ApiKey"]));

Error Handling

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}");
}

Contributing

Contributions are welcome! If you'd like to contribute, please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature-name)
  3. Commit your changes (git commit -m "Add new feature")
  4. Push to the branch (git push origin feature-name)
  5. Open a Pull Request

Reporting Issues

If you encounter any issues or have feature requests, please open an issue on GitHub: Issues

License

This project is licensed under the MIT License - see the LICENSE file for details.


Created by Anwar Al-Hitar

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages