RiskAI.Ollama 0.1.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package RiskAI.Ollama --version 0.1.0
                    
NuGet\Install-Package RiskAI.Ollama -Version 0.1.0
                    
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="RiskAI.Ollama" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RiskAI.Ollama" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="RiskAI.Ollama" />
                    
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 RiskAI.Ollama --version 0.1.0
                    
#r "nuget: RiskAI.Ollama, 0.1.0"
                    
#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 RiskAI.Ollama@0.1.0
                    
#: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=RiskAI.Ollama&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=RiskAI.Ollama&version=0.1.0
                    
Install as a Cake Tool

RiskAI.Ollama

RiskAI.Ollama provides an Ollama-backed implementation of the RiskAI service for industrial hazard summary and control suggestion workflows.

Installation

dotnet add package RiskAI.Ollama

Prerequisites

  • Ollama must be installed and running
  • The model you want to use must already be pulled locally

Example:

ollama pull gemma3:4b
ollama serve

Service Registration

using RiskAI.Ollama.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRiskAI(
    "http://localhost:11434",
    "gemma3:4b");

ASP.NET Core Example

using RiskAI.Abstractions.DTOs;
using RiskAI.Abstractions.Interfaces;
using RiskAI.Ollama.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRiskAI(
    "http://localhost:11434",
    "gemma3:4b");

var app = builder.Build();

app.MapPost("/api/risk-ai/summary", async (HazardRequest request, IRiskAIService riskAI) =>
{
    var result = await riskAI.GenerateHazardSummaryAsync(request);
    return Results.Ok(result);
});

app.MapPost("/api/risk-ai/controls", async (HazardRequest request, IRiskAIService riskAI) =>
{
    var result = await riskAI.SuggestControlsAsync(request);
    return Results.Ok(result);
});

app.Run();

Example request body:

{
  "hazardType": "Mechanical",
  "hazard": "Rotating blade exposure",
  "consequence": "Severe laceration or amputation",
  "machineName": "Cutting Machine A"
}

Console App Example

using Microsoft.Extensions.DependencyInjection;
using RiskAI.Abstractions.DTOs;
using RiskAI.Abstractions.Interfaces;
using RiskAI.Ollama.Extensions;

var services = new ServiceCollection();

services.AddRiskAI(
    "http://localhost:11434",
    "gemma3:4b");

var serviceProvider = services.BuildServiceProvider();
var riskAI = serviceProvider.GetRequiredService<IRiskAIService>();

var request = new HazardRequest
{
    HazardType = "Electrical",
    Hazard = "Exposed live conductor",
    Consequence = "Electric shock or burn injury",
    MachineName = "Control Cabinet 01"
};

var summary = await riskAI.GenerateHazardSummaryAsync(request);
var controls = await riskAI.SuggestControlsAsync(request);

Console.WriteLine("Hazard Summary:");
Console.WriteLine(summary);
Console.WriteLine();
Console.WriteLine("Suggested Controls:");
Console.WriteLine(controls);

Public API

using RiskAI.Abstractions.DTOs;
using RiskAI.Abstractions.Interfaces;

Task<string> GenerateHazardSummaryAsync(HazardRequest request);
Task<string> SuggestControlsAsync(HazardRequest request);
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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
0.1.1-preview 108 5/16/2026
0.1.0 124 5/16/2026
0.1.0-preview 104 5/16/2026

Preview release with hazard summary generation, control suggestion workflows, and ASP.NET Core dependency injection helpers.