sm-chat
1767.581.686.845
dotnet add package sm-chat --version 1767.581.686.845
NuGet\Install-Package sm-chat -Version 1767.581.686.845
<PackageReference Include="sm-chat" Version="1767.581.686.845" />
<PackageVersion Include="sm-chat" Version="1767.581.686.845" />
<PackageReference Include="sm-chat" />
paket add sm-chat --version 1767.581.686.845
#r "nuget: sm-chat, 1767.581.686.845"
#:package sm-chat@1767.581.686.845
#addin nuget:?package=sm-chat&version=1767.581.686.845
#tool nuget:?package=sm-chat&version=1767.581.686.845
sm-chat
A streamlined .NET library for interacting with the SuperMaker AI Chat API. Simplifies integration and provides a robust foundation for building chat-enabled applications.
Installation
To install the sm-chat package, use the following command in your .NET project:
bash
dotnet add package sm-chat
Usage Examples
Here are several examples demonstrating common use cases for the sm-chat library:
1. Simple Text-Based Chat Interaction: csharp using SmChat;
// Replace with your actual API key string apiKey = "YOUR_API_KEY"; var chatClient = new ChatClient(apiKey);
async Task ExampleAsync() { string userMessage = "Hello, SuperMaker AI!"; ChatMessage response = await chatClient.SendMessageAsync(userMessage);
if (response != null && !string.IsNullOrEmpty(response.Content))
{
Console.WriteLine($"AI Response: {response.Content}");
}
else
{
Console.WriteLine("Error: No response received from the AI.");
}
}
ExampleAsync().Wait();
2. Handling Multiple Chat Turns (Conversation): csharp using SmChat; using System.Collections.Generic;
// Replace with your actual API key string apiKey = "YOUR_API_KEY"; var chatClient = new ChatClient(apiKey);
async Task ExampleAsync() { var conversationHistory = new List<ChatMessage>();
// First message
string userMessage1 = "What is the capital of France?";
ChatMessage response1 = await chatClient.SendMessageAsync(userMessage1, conversationHistory);
conversationHistory.Add(new ChatMessage { Role = "user", Content = userMessage1 });
conversationHistory.Add(response1);
Console.WriteLine($"AI Response 1: {response1.Content}");
// Second message, building on the previous context
string userMessage2 = "And what is the population of that city?";
ChatMessage response2 = await chatClient.SendMessageAsync(userMessage2, conversationHistory);
conversationHistory.Add(new ChatMessage { Role = "user", Content = userMessage2 });
conversationHistory.Add(response2);
Console.WriteLine($"AI Response 2: {response2.Content}");
}
ExampleAsync().Wait();
3. Error Handling and Exception Management: csharp using SmChat; using System;
// Replace with your actual API key string apiKey = "YOUR_API_KEY"; var chatClient = new ChatClient(apiKey);
async Task ExampleAsync() { try { string userMessage = "This is a test message."; ChatMessage response = await chatClient.SendMessageAsync(userMessage);
if (response != null && !string.IsNullOrEmpty(response.Content))
{
Console.WriteLine($"AI Response: {response.Content}");
}
else
{
Console.WriteLine("Error: No response received from the AI.");
}
}
catch (ApiException ex)
{
Console.WriteLine($"API Error: {ex.Message}");
// Handle specific API errors, e.g., rate limiting, invalid API key
}
catch (Exception ex)
{
Console.WriteLine($"General Error: {ex.Message}");
// Handle other potential exceptions
}
}
ExampleAsync().Wait();
4. Configuring API Endpoint (Optional): csharp using SmChat;
// Replace with your actual API key and custom endpoint if needed. string apiKey = "YOUR_API_KEY"; string apiEndpoint = "https://custom.supermaker.ai/chat/api"; // Example Custom Endpoint var chatClient = new ChatClient(apiKey, apiEndpoint);
// Use the chatClient as in the previous examples.
Feature Summary
- Simplified Chat Integration: Provides a clean and intuitive API for seamless integration with the SuperMaker AI Chat service.
- Asynchronous Operations: Leverages asynchronous methods for non-blocking operations, ensuring optimal performance.
- Conversation Management: Supports maintaining conversation history for context-aware interactions.
- Error Handling: Includes built-in exception handling for robust and reliable applications.
- Configurable API Endpoint: Allows customization of the API endpoint for advanced configurations.
License
This project is licensed under the MIT License - see the LICENSE file for details.
This package is part of the sm-chat ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/chat/
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1767.581.686.845 | 125 | 1/5/2026 |