ResearchAI 1.2.3
dotnet add package ResearchAI --version 1.2.3
NuGet\Install-Package ResearchAI -Version 1.2.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ResearchAI" Version="1.2.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ResearchAI" Version="1.2.3" />
<PackageReference Include="ResearchAI" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ResearchAI --version 1.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ResearchAI, 1.2.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ResearchAI@1.2.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ResearchAI&version=1.2.3
#tool nuget:?package=ResearchAI&version=1.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ResearchAI (.NET Class Library)
ResearchAI is a modular .NET class library for building AI-powered applications with Azure OpenAI, chat history management, and computer vision/image analytics. It is designed for easy integration into your .NET projects, supporting both in-memory and MongoDB storage, and providing extensible service interfaces.
Features
- Azure OpenAI Integration: Seamlessly connect to Azure OpenAI for chat completions and generative AI tasks.
- Chat History Management: Store, retrieve, and manage chat conversations using in-memory or MongoDB backends.
- Vision/Image Analytics: Analyze images and extract insights using Azure Computer Vision APIs.
- Extensible Architecture: Swap or extend storage and service implementations as needed.
Installation & Configuration
Add Reference
- Add the
ResearchAI
library to your .NET project (via NuGet).
- Add the
Configure Services
- Register services in your DI container:
string systemContextPath = Path.Combine(Directory.GetCurrentDirectory(), "system_context");
string systemContext = File.ReadAllText(systemContextPath);
builder.Services.AddAzureOpenAI(builder.Configuration, systemContext);
Usage Example: Web API Controller
Azure OpenAI Chat Completion
using Microsoft.AspNetCore.Mvc;
using ResearchAI.Services;
[ApiController]
[Route("api/[controller]")]
public class ChatController : ControllerBase
{
private readonly AzureOpenAI _azureOpenAI;
public ChatController(AzureOpenAI azureOpenAI)
{
_azureOpenAI = azureOpenAI;
}
// POST:/stream
[HttpPost("stream")]
public async Task StreamMessage([FromBody] CoversationRequest request)
{
Response.Headers.Append("Cache-Control", "no-cache");
Response.Headers.Append("X-Accel-Buffering", "no");
Response.ContentType = "text/event-stream";
await foreach (var chunk in StreamMessagesAsync(SessionId, request.ConversationId, request.Message))
{
await Response.WriteAsync(chunk);
await Response.Body.FlushAsync();
}
}
private async IAsyncEnumerable<string> StreamMessagesAsync(string sessionId, string conversationId, string userInput)
{
await foreach (var response in _azureOpenAI.StreamMessageAsync(sessionId, conversationId, userInput))
{
yield return response;
}
}
}
ImageClient Example
using ResearchAI.Vision;
// Create an ImageClient instance
var imageClient = new ImageClient(new ImageClientModel
{
Endpoint = "<your-vision-endpoint>",
Key = "<your-vision-key>"
});
// Analyze an image (basic)
var analysisResult = await imageClient.AnalyzeImageAsync("https://example.com/image.jpg");
// If you want to use AzureOpenAI for advanced vision+chat scenarios:
var openAI = new AzureOpenAI(openAIOptions, null);
var imageClientWithAI = new ImageClient(new ImageClientModel
{
Endpoint = "<your-vision-endpoint>",
Key = "<your-vision-key>"
}, openAI);
var resultWithChat = await imageClientWithAI.AnalyzeImageWithChatAsync("https://example.com/image.jpg", "session-id");
License
This project is licensed under the terms of the Apache License Version 2.0.
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Azure.AI.OpenAI (>= 2.1.0)
- Azure.AI.Vision.ImageAnalysis (>= 1.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.8)
- Microsoft.Extensions.Options (>= 9.0.7)
- MongoDB.Driver (>= 3.4.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.