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" />
                    
Directory.Packages.props
<PackageReference Include="ResearchAI" />
                    
Project file
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
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=ResearchAI&version=1.2.3
                    
Install as a Cake Tool

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

  1. Add Reference

    • Add the ResearchAI library to your .NET project (via NuGet).
  2. 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 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.

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
1.2.3 135 8/14/2025
1.2.2 140 8/12/2025
1.2.1 126 8/10/2025
1.2.0 332 7/20/2025
1.0.0 277 7/18/2025