Mythosia.AI.Abstractions 1.1.0

dotnet add package Mythosia.AI.Abstractions --version 1.1.0
                    
NuGet\Install-Package Mythosia.AI.Abstractions -Version 1.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="Mythosia.AI.Abstractions" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mythosia.AI.Abstractions" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Mythosia.AI.Abstractions" />
                    
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 Mythosia.AI.Abstractions --version 1.1.0
                    
#r "nuget: Mythosia.AI.Abstractions, 1.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 Mythosia.AI.Abstractions@1.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=Mythosia.AI.Abstractions&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Mythosia.AI.Abstractions&version=1.1.0
                    
Install as a Cake Tool

Mythosia.AI.Abstractions

Core contracts and shared models for the Mythosia.AI ecosystem. Defines IAIService, all model types, and streaming primitives. Consumed by Mythosia.AI.Rag and any library that needs the AI service contract without pulling in heavy provider implementations.

Installation

dotnet add package Mythosia.AI.Abstractions

Install this package directly only when writing a library that depends on the AI service contract (e.g., RAG orchestration, custom middleware). Applications normally take a transitive dependency through Mythosia.AI.


Core Interface

IAIService

The central abstraction for AI completion and streaming.

public interface IAIService
{
    string Model { get; }
    string Provider { get; }
    string SystemMessage { get; set; }
    bool StatelessMode { get; set; }
    ChatBlock ActivateChat { get; }

    // Completion
    Task<string> GetCompletionAsync(string prompt);
    Task<string> GetCompletionAsync(Message message);
    Task<string> GetCompletionAsync(Message message, AIRequestContext context);
    // ... additional overloads with AIRequestProfile

    // Streaming
    IAsyncEnumerable<string> StreamAsync(string prompt, CancellationToken ct = default);
    IAsyncEnumerable<StreamingContent> StreamAsync(Message message, StreamOptions options, CancellationToken ct = default);
    // ... additional overloads
}

All concrete providers (OpenAIService, AnthropicService, GoogleAIService, etc.) in Mythosia.AI implement this interface.


Models

Type Description
Message A conversation message with role, content, and optional multimodal content
MessageContent Base class for multimodal content (TextContent, ImageContent, AudioContent)
ChatBlock Conversation container holding system message and message history
ActorRole Message role enum (System, User, Assistant, Function)
AIRequestContext Per-request context overrides (system message prefix/suffix, message override)
AIRequestProfile Per-request parameter overrides (temperature, max tokens, stateless mode)
AIModels Model identifier constants for all supported providers
AIProvider Provider enum (OpenAI, Anthropic, Google, xAI, DeepSeek, Perplexity)

Streaming

Type Description
StreamingContent Streaming chunk with content, type, metadata, and token usage
StreamingContentType Chunk type enum (Text, Reasoning, FunctionCall, FunctionResult, Status, Error, Completion)
StreamOptions Streaming behavior options (metadata, function calls, reasoning)
TokenUsage Token count data (input, output, cached, reasoning)

Functions

Type Description
FunctionDefinition Function schema for LLM function calling
FunctionCallingPolicy Controls function calling behavior and iteration limits
AiFunctionAttribute Marks a method as an AI-callable function
AiParameterAttribute Describes a function parameter for the AI

Exceptions

Type Description
AIServiceException Base exception for AI service errors
AgentMaxStepsExceededException Thrown when agent exceeds maximum iteration steps

Relationship to Microsoft.Extensions.AI

Microsoft.Extensions.AI (IChatClient) and IAIService solve different problems at different layers.

IAIService (Mythosia.AI) IChatClient (MS.Extensions.AI)
State Stateful — ChatBlock accumulates conversation history automatically Stateless — caller passes the full message list on every call
Session management Multiple ChatBlock sessions per service instance, switchable at runtime None; caller manages message lists
System message First-class property; supports per-request prefix/suffix injection via AIRequestContext Passed as a ChatMessage with Role = system
Request parameters Strongly-typed AIRequestProfile (temperature, max tokens, stateless, disable functions) ChatOptions dictionary
Function calling Automatic ReAct loop with configurable FunctionCallingPolicy (max rounds, timeout, concurrency) Single-round; caller implements the loop
Streaming chunks Typed StreamingContentText, Reasoning, FunctionCall, FunctionResult, Completion, Error Text content updates only
Conversation summarization Built-in SummaryConversationPolicy — auto-summarizes when token/message thresholds are exceeded Not provided
Multimodal Message serializes to each provider's wire format automatically Caller constructs provider-specific content objects
Token usage Tracks input, output, cached, cache-creation, and reasoning tokens Input and output tokens only

IAIService sits at a higher abstraction level than IChatClient. Implementing IChatClient on top of IAIService would discard stateful session management, typed streaming, and the function-calling loop. The two interfaces are not interchangeable.

If interoperability with the MS ecosystem is required, the recommended direction is to accept an IChatClient as a constructor dependency inside a Mythosia.AI provider — not to replace IAIService with IChatClient.


Why This Package?

Mythosia.AI.Rag  →  Mythosia.AI.Abstractions  (zero heavy dependencies)
                     instead of
                     Mythosia.AI  (Azure.AI.OpenAI, NJsonSchema, TiktokenSharp, ...)

By depending on abstractions rather than the full implementation package, libraries like Mythosia.AI.Rag avoid pulling in provider-specific dependencies. The concrete provider is chosen by the final application.


Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Mythosia.AI.Abstractions:

Package Downloads
Mythosia.AI

## What's New in v5.2.0 ### Abstractions Package Split - All shared model/contract types extracted into `Mythosia.AI.Abstractions` (zero heavy dependencies) - `AIService` now implements `IAIService` interface for abstraction-based dependency - Downstream libraries (e.g., `Mythosia.AI.Rag`) can depend on the lightweight abstractions instead of the full implementation - Source-level fully compatible ? all namespaces unchanged, no code changes needed ## Supported Models ### OpenAI - GPT-5, GPT-5 Mini, GPT-5 Nano, GPT-5 Chat Latest - GPT-5.1 - GPT-5.2, GPT-5.2 Pro, GPT-5.2 Codex - GPT-5.3 Codex - GPT-5.4, GPT-5.4 Mini, GPT-5.4 Nano, GPT-5.4 Pro - o3, o3-pro - GPT-4.1, GPT-4.1 Mini, GPT-4.1 Nano - GPT-4o, GPT-4o Mini, GPT-4 Vision ### Anthropic Claude - Claude Opus 4.6, Opus 4.5, Opus 4.1, Opus 4 - Claude Sonnet 4.6, Sonnet 4.5, Sonnet 4 - Claude Haiku 4.5 ### xAI Grok - Grok 4, Grok 4.1 Fast - Grok 3, Grok 3 Mini ### Google Gemini - Gemini 2.5 Pro, Flash, Flash-Lite - Gemini 3 Pro Preview, Flash Preview ### DeepSeek - DeepSeek Chat, DeepSeek Reasoner ### Perplexity - Sonar, Sonar Pro, Sonar Reasoning ## Documentation - Basic Usage: https://github.com/AJ-comp/Mythosia.AI/wiki - Advanced Features: https://github.com/AJ-comp/Mythosia.AI/wiki/Advanced-Features - Release Notes: https://github.com/AJ-comp/Mythosia.AI/wiki/Release-Notes - GitHub: https://github.com/AJ-comp/Mythosia.AI

Mythosia.AI.Rag

RAG (Retrieval Augmented Generation) orchestration for Mythosia.AI. Implements Mythosia.AI.Rag.Abstractions v5.x. Includes RagPipeline, text splitters, context builder, OpenAI/vLLM embedding providers, hybrid search (BM25 + Vector + RRF), re-ranking (Cohere, LLM, vLLM), search gate, keyword extraction, weighted-blend final selection, progress reporting, DoclingDocument-to-RagDocument conversion, and per-query VectorFilter passthrough (StoreFilter). Depends on Mythosia.AI.Abstractions (IAIService) instead of the full Mythosia.AI implementation.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 0 4/2/2026
1.0.0 140 3/29/2026

v1.1.0: Add IFunctionRegisterable interface. README — added comparison table between IAIService and Microsoft.Extensions.AI IChatClient to clarify design scope and interoperability position.