Hevolus.XRCopilot.Client.Public
2.2.7
dotnet add package Hevolus.XRCopilot.Client.Public --version 2.2.7
NuGet\Install-Package Hevolus.XRCopilot.Client.Public -Version 2.2.7
<PackageReference Include="Hevolus.XRCopilot.Client.Public" Version="2.2.7" />
<PackageVersion Include="Hevolus.XRCopilot.Client.Public" Version="2.2.7" />
<PackageReference Include="Hevolus.XRCopilot.Client.Public" />
paket add Hevolus.XRCopilot.Client.Public --version 2.2.7
#r "nuget: Hevolus.XRCopilot.Client.Public, 2.2.7"
#:package Hevolus.XRCopilot.Client.Public@2.2.7
#addin nuget:?package=Hevolus.XRCopilot.Client.Public&version=2.2.7
#tool nuget:?package=Hevolus.XRCopilot.Client.Public&version=2.2.7
XRCopilotPublicClient
The XRCopilotPublicClient library provides a simple and efficient way to interact with the XRCopilot API, enabling developers to easily integrate XRCopilot's assistant and speech capabilities into their .NET applications.
Features
- Chat with the XRCopilot assistant.
- Convert text to speech.
- Retrieve a welcome message in different languages.
- Check for data and AI capabilities by resource ID.
- Save and retrieve system data and parameters
- Manage storage and file indexing
Getting Started
Prerequisites
- .NET Core 3.1 or later
- An API key for the XRCopilot service
Installation
To install the XRCopilotPublicClient package, use the following NuGet command:
dotnet add package Hevolus.XRCopilot.Public.Client --version
Replace <version> with the specific version of the package you want to use.
Usage
First, create an instance of the XRCopilotPublicClient class with your endpoint and API key:
using XRCopilot.Client;
var apiKey = "your_api_key_here";
var client = new XRCopilotPublicClient(apiKey);
Chat with the Assistant
To chat with the XRCopilot assistant, use the ChatAsync method:
// Create a UserPrompt object
var prompt = new UserPrompt
{
TenantId = "your_tenant_id_here",
ResourceId = "your_resource_id_here",
Message = "Hello, how can I assist you?",
AnswerLanguage = "it",
ConversationId = "your_conversation_id_here"
};
// Call the ChatAsync method
var response = await client.ChatAsync(prompt);
// Check the response
if (response != null)
{
Console.WriteLine($"ResponseType: {response.ResponseType}");
Console.WriteLine($"Message: {response.Message}");
Console.WriteLine($"ConversationId: {response.ConversationId}");
Console.WriteLine($"AnswareLanguage: {response.AnswerLanguage}");
}
Convert Text to Speech
To convert text to speech, use the SpeechAsync method:
// Prepare the request with the text you want to convert to speech
var speechRequest = new SpeechRequest
{
Text = "Hello, world! This is a test of the SpeechAsync method.",
Language = "en",
VoiceGender = "male"
};
// Call the SpeechAsync method
var speechResponse = await client.SpeechAsync(speechRequest);
// Check the response
if (speechResponse != null)
{
var audio = speechResponse.VoiceData;
}
Retrieve a Welcome Message
To retrieve a welcome message in different languages, use the GetWelcomeMessageAsync method:
var language = "en";
var welcomeMessage = await client.GetWelcomeMessageAsync(language);
Console.WriteLine(welcomeMessage.Message);
Check for Data and AI Capabilities
To check for data and AI capabilities by resource ID, use the CheckCapabilitiesAsync method:
var resourceId = "your_resource_id_here";
var hasData = await client.HasDataAsync(resourceId);
Console.WriteLine($"Has Data: {hasData}");
var hasAI = await client.HasAIAsync(resourceId);
Console.WriteLine($"Has AI: {hasAI}");
Save and Retrieve System Data and Parameters
To save and retrieve system data and parameters, use the SaveDataAsync and GetDataAsync methods:
var sd = new SystemData
{
resourceId = "your_resource_id_here",
systemMessage = "Hello, how can I assist you?",
documentsLanguage = "en",
maxTokens = 800,
temperature = 0.5f,
minRankingScore = 1.2f,
minWordsValidation = 50,
numberOfInteractions = 2
};
var response = await client.SaveSystemDataAsync(sd);
Console.WriteLine($"SaveSystemData: {response}");
var resourceId = "your_resource_id_here";
var response = await client.GetSystemDataAsync(resourceId);
Console.WriteLine($"GetSystemData: {response.systemMessage}");
Manage Storage and File Indexing
To manage storage and file indexing, use the UploadFileAsync, ListFileAsync, GetFileAsync, GetFileUriAsync, DeleteFileAsync, DeleteFileAsync, DeleteAllAsync, PerformIndexingAsync, and DeleteIndexAsync methods:
var streamData = new MemoryStream(Encoding.UTF8.GetBytes("Hello, world!"));
var response = await client.UploadFileAsync("your_resource_id_here", "file_name", streamData);
Console.WriteLine($"UploadFile: {response}");
var response = await client.ListFileAsync("your_resource_id_here");
Console.WriteLine($"ListFile: {response}");
var response = await client.GetFileAsync("your_resource_id_here", "file_name");
Console.WriteLine($"GetFile: {response}");
var response = await client.GetFileUriAsync("your_resource_id_here", "file_name");
Console.WriteLine($"GetFileUri: {response}");
var response = await client.DeleteFileAsync("your_resource_id_here", "file_name");
Console.WriteLine($"DeleteFile: {response}");
var response = await client.DeleteAllAsync("your_resource_id_here");
Console.WriteLine($"DeleteAll: {response}");
var options = new IndexingOptions
{
regenerateIndex = true
};
var response = await client.PerformIndexingAsync("your_company_id_here", "your_resource_id_here", options);
Console.WriteLine($"PerformIndexing: {response}");
var response = await client.DeleteIndexAsync("your_company_id_here", "your_resource_id_here");
Console.WriteLine($"DeleteIndex: {response}");
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. |
-
net8.0
- Hevolus.XRCopilot.Core (>= 2.2.6)
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 |
|---|---|---|
| 2.2.7 | 236 | 12/19/2024 |
| 2.2.6 | 161 | 12/19/2024 |
| 2.2.5 | 168 | 12/19/2024 |
| 2.2.4 | 177 | 12/6/2024 |
| 2.2.3 | 163 | 12/6/2024 |
| 2.2.2 | 223 | 11/8/2024 |
| 2.2.1 | 173 | 11/6/2024 |
| 2.2.0 | 181 | 10/25/2024 |
| 2.1.9 | 171 | 10/25/2024 |
| 2.1.7 | 180 | 10/4/2024 |
| 2.1.6 | 206 | 9/16/2024 |
| 2.1.4 | 191 | 8/26/2024 |
| 2.1.3 | 202 | 8/26/2024 |
| 2.1.2 | 203 | 8/13/2024 |
| 2.1.1 | 159 | 7/26/2024 |
| 2.1.0 | 202 | 7/24/2024 |
| 2.0.10 | 182 | 7/24/2024 |
| 2.0.9 | 186 | 7/23/2024 |
| 2.0.8 | 176 | 7/22/2024 |
| 2.0.7 | 196 | 7/19/2024 |