< Summary

Information
Class: Elsa.AI.Abstractions.Models.AIProviderToolInvocation
Assembly: Elsa.AI.Abstractions
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.AI.Abstractions/Models/AIConversation.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 123
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_ToolName()100%11100%
get_Arguments()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.AI.Abstractions/Models/AIConversation.cs

#LineLine coverage
 1namespace Elsa.AI.Abstractions.Models;
 2
 3public record AIConversation
 4{
 5    public string Id { get; init; } = default!;
 6    public string? TenantId { get; init; }
 7    public string UserId { get; init; } = default!;
 8    public string? Title { get; init; }
 9    public AIConversationStatus Status { get; init; } = AIConversationStatus.Active;
 10    public DateTimeOffset CreatedAt { get; init; }
 11    public DateTimeOffset UpdatedAt { get; init; }
 12    public string? ProviderSessionId { get; init; }
 13    public AIRetentionMode RetentionMode { get; init; } = AIRetentionMode.Configured;
 14    public DateTimeOffset? RetentionExpiresAt { get; init; }
 15    public IReadOnlyCollection<AIMessage> Messages { get; init; } = [];
 16}
 17
 18public record AIMessage
 19{
 20    public string Id { get; init; } = default!;
 21    public string ConversationId { get; init; } = default!;
 22    public AIMessageRole Role { get; init; }
 23    public string Content { get; init; } = "";
 24    public DateTimeOffset CreatedAt { get; init; }
 25    public long StreamSequence { get; init; }
 26    public JsonObject Metadata { get; init; } = [];
 27}
 28
 29public record AIChatRequest
 30{
 31    public string? ConversationId { get; init; }
 32    public string Message { get; init; } = "";
 33    public string? Agent { get; init; }
 34    public string? ProviderName { get; init; }
 35    public ICollection<AIContextAttachment> Attachments { get; init; } = [];
 36    public string? TenantId { get; init; }
 37    public string UserId { get; init; } = default!;
 38    public ICollection<string> UserPermissions { get; init; } = [];
 39    public bool IsReconnect { get; init; }
 40}
 41
 42public record AIStreamEvent
 43{
 44    public string Type { get; init; } = default!;
 45    public string ConversationId { get; init; } = default!;
 46    public long Sequence { get; init; }
 47    public DateTimeOffset Timestamp { get; init; }
 48    public JsonObject Data { get; init; } = [];
 49}
 50
 51public record AISessionHandle
 52{
 53    public string Id { get; init; } = Guid.NewGuid().ToString("N");
 54    public string? ProviderSessionId { get; init; }
 55}
 56
 57public record CreateAISessionRequest
 58{
 59    public string ConversationId { get; init; } = default!;
 60    public string? Agent { get; init; }
 61    public string? TenantId { get; init; }
 62    public AIProviderConfiguration? ProviderConfiguration { get; init; }
 63    public JsonObject Metadata { get; init; } = [];
 64}
 65
 66public record AITurnRequest
 67{
 68    public string ConversationId { get; init; } = default!;
 69    public string? ProviderSessionId { get; init; }
 70    public string Message { get; init; } = "";
 71    public IReadOnlyCollection<AIMessage> Messages { get; init; } = [];
 72    public IReadOnlyCollection<AIResolvedContext> Context { get; init; } = [];
 73    public IReadOnlyCollection<AIToolDefinition> Tools { get; init; } = [];
 74    public string? Agent { get; init; }
 75    public AIProviderConfiguration? ProviderConfiguration { get; init; }
 76}
 77
 78public record AIProviderConfiguration
 79{
 80    public string Name { get; init; } = default!;
 81    public string Provider { get; init; } = default!;
 82    public string? Model { get; init; }
 83    public string? ApiKeySecretName { get; init; }
 84    public string? Endpoint { get; init; }
 85}
 86
 87public record AIProviderToolInvocation
 88{
 1889    public string Id { get; init; } = Guid.NewGuid().ToString("N");
 1890    public string ToolName { get; init; } = default!;
 1891    public JsonObject Arguments { get; init; } = [];
 92}
 93
 94public record AIProviderEvent
 95{
 96    public string Type { get; init; } = default!;
 97    public long Sequence { get; init; }
 98    public DateTimeOffset Timestamp { get; init; }
 99    public JsonObject Data { get; init; } = [];
 100}
 101
 102public enum AIConversationStatus
 103{
 104    Active,
 105    Completed,
 106    Failed,
 107    Expired
 108}
 109
 110public enum AIRetentionMode
 111{
 112    Configured,
 113    Ephemeral,
 114    Durable
 115}
 116
 117public enum AIMessageRole
 118{
 119    User,
 120    Assistant,
 121    System,
 122    Tool
 123}