< Summary

Information
Class: NexusLabs.Needlr.Copilot.RequestToolCallFunction
Assembly: NexusLabs.Needlr.Copilot
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Copilot/CopilotApiModels.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 210
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_Name()100%11100%
get_Arguments()100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Copilot/CopilotApiModels.cs

#LineLine coverage
 1using System.Text.Json.Serialization;
 2
 3namespace NexusLabs.Needlr.Copilot;
 4
 5// ── Request DTOs ──
 6
 7internal sealed class ChatCompletionRequest
 8{
 9    [JsonPropertyName("model")]
 10    public string Model { get; set; } = "";
 11
 12    [JsonPropertyName("messages")]
 13    public List<RequestMessage> Messages { get; set; } = [];
 14
 15    [JsonPropertyName("tools")]
 16    public List<RequestTool>? Tools { get; set; }
 17
 18    [JsonPropertyName("stream")]
 19    public bool Stream { get; set; }
 20
 21    [JsonPropertyName("temperature")]
 22    public float? Temperature { get; set; }
 23
 24    [JsonPropertyName("top_p")]
 25    public float? TopP { get; set; }
 26
 27    [JsonPropertyName("max_tokens")]
 28    public int? MaxTokens { get; set; }
 29
 30    [JsonPropertyName("stop")]
 31    public List<string>? Stop { get; set; }
 32
 33    [JsonPropertyName("frequency_penalty")]
 34    public float? FrequencyPenalty { get; set; }
 35
 36    [JsonPropertyName("presence_penalty")]
 37    public float? PresencePenalty { get; set; }
 38}
 39
 40internal sealed class RequestMessage
 41{
 42    [JsonPropertyName("role")]
 43    public string Role { get; set; } = "";
 44
 45    [JsonPropertyName("content")]
 46    public object? Content { get; set; }
 47
 48    [JsonPropertyName("name")]
 49    public string? Name { get; set; }
 50
 51    [JsonPropertyName("tool_calls")]
 52    public List<RequestToolCall>? ToolCalls { get; set; }
 53
 54    [JsonPropertyName("tool_call_id")]
 55    public string? ToolCallId { get; set; }
 56}
 57
 58internal sealed class RequestToolCall
 59{
 60    [JsonPropertyName("id")]
 61    public string Id { get; set; } = "";
 62
 63    [JsonPropertyName("type")]
 64    public string Type { get; set; } = "function";
 65
 66    [JsonPropertyName("function")]
 67    public RequestToolCallFunction Function { get; set; } = new();
 68}
 69
 70internal sealed class RequestToolCallFunction
 71{
 72    [JsonPropertyName("name")]
 1673    public string Name { get; set; } = "";
 74
 75    [JsonPropertyName("arguments")]
 1676    public string Arguments { get; set; } = "";
 77}
 78
 79internal sealed class RequestTool
 80{
 81    [JsonPropertyName("type")]
 82    public string Type { get; set; } = "function";
 83
 84    [JsonPropertyName("function")]
 85    public RequestToolFunction Function { get; set; } = new();
 86}
 87
 88internal sealed class RequestToolFunction
 89{
 90    [JsonPropertyName("name")]
 91    public string Name { get; set; } = "";
 92
 93    [JsonPropertyName("description")]
 94    public string? Description { get; set; }
 95
 96    [JsonPropertyName("parameters")]
 97    public object? Parameters { get; set; }
 98
 99    [JsonPropertyName("strict")]
 100    public bool? Strict { get; set; }
 101}
 102
 103// ── Response DTOs ──
 104
 105internal sealed class ChatCompletionResponse
 106{
 107    [JsonPropertyName("id")]
 108    public string? Id { get; set; }
 109
 110    [JsonPropertyName("object")]
 111    public string? Object { get; set; }
 112
 113    [JsonPropertyName("created")]
 114    public long Created { get; set; }
 115
 116    [JsonPropertyName("model")]
 117    public string? Model { get; set; }
 118
 119    [JsonPropertyName("choices")]
 120    public List<ResponseChoice> Choices { get; set; } = [];
 121
 122    [JsonPropertyName("usage")]
 123    public ResponseUsage? Usage { get; set; }
 124}
 125
 126internal sealed class ResponseChoice
 127{
 128    [JsonPropertyName("index")]
 129    public int Index { get; set; }
 130
 131    [JsonPropertyName("message")]
 132    public ResponseMessage? Message { get; set; }
 133
 134    [JsonPropertyName("delta")]
 135    public ResponseMessage? Delta { get; set; }
 136
 137    [JsonPropertyName("finish_reason")]
 138    public string? FinishReason { get; set; }
 139}
 140
 141internal sealed class ResponseMessage
 142{
 143    [JsonPropertyName("role")]
 144    public string? Role { get; set; }
 145
 146    [JsonPropertyName("content")]
 147    public string? Content { get; set; }
 148
 149    [JsonPropertyName("tool_calls")]
 150    public List<ResponseToolCall>? ToolCalls { get; set; }
 151}
 152
 153internal sealed class ResponseToolCall
 154{
 155    [JsonPropertyName("index")]
 156    public int Index { get; set; }
 157
 158    [JsonPropertyName("id")]
 159    public string? Id { get; set; }
 160
 161    [JsonPropertyName("type")]
 162    public string? Type { get; set; }
 163
 164    [JsonPropertyName("function")]
 165    public ResponseToolCallFunction? Function { get; set; }
 166}
 167
 168internal sealed class ResponseToolCallFunction
 169{
 170    [JsonPropertyName("name")]
 171    public string? Name { get; set; }
 172
 173    [JsonPropertyName("arguments")]
 174    public string? Arguments { get; set; }
 175}
 176
 177internal sealed class ResponseUsage
 178{
 179    [JsonPropertyName("prompt_tokens")]
 180    public int PromptTokens { get; set; }
 181
 182    [JsonPropertyName("completion_tokens")]
 183    public int CompletionTokens { get; set; }
 184
 185    [JsonPropertyName("total_tokens")]
 186    public int TotalTokens { get; set; }
 187}
 188
 189// ── Streaming chunk ──
 190
 191internal sealed class ChatCompletionChunk
 192{
 193    [JsonPropertyName("id")]
 194    public string? Id { get; set; }
 195
 196    [JsonPropertyName("object")]
 197    public string? Object { get; set; }
 198
 199    [JsonPropertyName("created")]
 200    public long Created { get; set; }
 201
 202    [JsonPropertyName("model")]
 203    public string? Model { get; set; }
 204
 205    [JsonPropertyName("choices")]
 206    public List<ResponseChoice> Choices { get; set; } = [];
 207
 208    [JsonPropertyName("usage")]
 209    public ResponseUsage? Usage { get; set; }
 210}

Methods/Properties

get_Name()
get_Arguments()