diff --git a/Directory.Build.targets b/Directory.Build.targets
index c9bca6e..ba40ce5 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -3,5 +3,8 @@
preview
enable
enable
+
+
+ IDE0130
\ No newline at end of file
diff --git a/demo/OllamaApiConsole.csproj b/demo/OllamaApiConsole.csproj
index f9f65e7..1c07f27 100644
--- a/demo/OllamaApiConsole.csproj
+++ b/demo/OllamaApiConsole.csproj
@@ -6,6 +6,7 @@
+
diff --git a/src/AsyncEnumerableExtensions/ChatResponseStreamAppender.cs b/src/AsyncEnumerableExtensions/ChatResponseStreamAppender.cs
index 9c76d20..1af1c54 100644
--- a/src/AsyncEnumerableExtensions/ChatResponseStreamAppender.cs
+++ b/src/AsyncEnumerableExtensions/ChatResponseStreamAppender.cs
@@ -1,10 +1,9 @@
-using System;
using OllamaSharp.Models.Chat;
namespace OllamaSharp.AsyncEnumerableExtensions;
///
-/// Appender to stream to
+/// Appender to stream to
/// build up one single object
///
internal class ChatResponseStreamAppender : IAppender
diff --git a/src/AsyncEnumerableExtensions/GenerateResponseStreamAppender.cs b/src/AsyncEnumerableExtensions/GenerateResponseStreamAppender.cs
index 11e1649..c6ef35f 100644
--- a/src/AsyncEnumerableExtensions/GenerateResponseStreamAppender.cs
+++ b/src/AsyncEnumerableExtensions/GenerateResponseStreamAppender.cs
@@ -1,11 +1,12 @@
using System;
+using System.Collections.Generic;
using System.Text;
using OllamaSharp.Models;
namespace OllamaSharp.AsyncEnumerableExtensions;
///
-/// Appender to stream
+/// Appender to stream
/// to build up one single object
///
internal class GenerateResponseStreamAppender : IAppender
diff --git a/src/AsyncEnumerableExtensions/IAsyncEnumerableExtensions.cs b/src/AsyncEnumerableExtensions/IAsyncEnumerableExtensions.cs
index 3a93901..bf0d9ab 100644
--- a/src/AsyncEnumerableExtensions/IAsyncEnumerableExtensions.cs
+++ b/src/AsyncEnumerableExtensions/IAsyncEnumerableExtensions.cs
@@ -1,13 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
using OllamaSharp.AsyncEnumerableExtensions;
using OllamaSharp.Models;
using OllamaSharp.Models.Chat;
-#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace OllamaSharp;
-#pragma warning restore IDE0130 // Namespace does not match folder structure
///
/// Extension methods to stream IAsyncEnumerable to its end and return one single result value
diff --git a/src/AsyncEnumerableExtensions/StringAppender.cs b/src/AsyncEnumerableExtensions/StringAppender.cs
index 6b3dd1d..ef8c746 100644
--- a/src/AsyncEnumerableExtensions/StringAppender.cs
+++ b/src/AsyncEnumerableExtensions/StringAppender.cs
@@ -1,9 +1,10 @@
using System.Text;
+using System.Collections.Generic;
namespace OllamaSharp.AsyncEnumerableExtensions;
///
-/// Appender to stream to build up one single result string
+/// Appender to stream to build up one single result string
///
internal class StringAppender : IAppender
{
diff --git a/src/ByteArrayExtensions.cs b/src/ByteArrayExtensions.cs
index ffea185..92028f3 100644
--- a/src/ByteArrayExtensions.cs
+++ b/src/ByteArrayExtensions.cs
@@ -16,7 +16,6 @@ internal static class ByteArrayExtensions
/// A base-64 encoded string representation of the input byte sequence.
public static string ToBase64(this IEnumerable bytes) => Convert.ToBase64String(bytes.ToArray());
-
///
/// Converts a collection of byte arrays to a collection of base64 strings.
///
diff --git a/src/Chat.cs b/src/Chat.cs
index 4022087..2f3125b 100644
--- a/src/Chat.cs
+++ b/src/Chat.cs
@@ -127,7 +127,7 @@ public IAsyncEnumerable SendAsync(string message, CancellationToken canc
///
///
public IAsyncEnumerable SendAsync(string message, IEnumerable>? imagesAsBytes, CancellationToken cancellationToken = default)
- => SendAsync(message, imagesAsBase64: imagesAsBytes?.ToBase64() ?? [], cancellationToken: cancellationToken);
+ => SendAsync(message, imagesAsBase64: imagesAsBytes?.ToBase64(), cancellationToken: cancellationToken);
///
/// Sends a message to the currently selected model and streams its response
@@ -155,7 +155,7 @@ public IAsyncEnumerable SendAsync(string message, IEnumerable
///
public IAsyncEnumerable SendAsync(string message, IEnumerable? imagesAsBase64, CancellationToken cancellationToken = default)
- => SendAsync(message, tools: [], imagesAsBase64: imagesAsBase64, cancellationToken: cancellationToken);
+ => SendAsync(message, tools: null, imagesAsBase64: imagesAsBase64, cancellationToken: cancellationToken);
///
/// Sends a message to the currently selected model and streams its response
@@ -185,7 +185,7 @@ public IAsyncEnumerable SendAsAsync(ChatRole role, string message, Cance
/// Images in byte representation to send to the model
/// The token to cancel the operation with
public IAsyncEnumerable SendAsAsync(ChatRole role, string message, IEnumerable>? imagesAsBytes, CancellationToken cancellationToken = default)
- => SendAsAsync(role, message, imagesAsBase64: imagesAsBytes?.ToBase64() ?? [], cancellationToken: cancellationToken);
+ => SendAsAsync(role, message, imagesAsBase64: imagesAsBytes?.ToBase64(), cancellationToken: cancellationToken);
///
/// Sends a message in a given role to the currently selected model and streams its response
@@ -195,7 +195,7 @@ public IAsyncEnumerable SendAsAsync(ChatRole role, string message, IEnum
/// Base64 encoded images to send to the model
/// The token to cancel the operation with
public IAsyncEnumerable SendAsAsync(ChatRole role, string message, IEnumerable? imagesAsBase64, CancellationToken cancellationToken = default)
- => SendAsAsync(role, message, tools: [], imagesAsBase64: imagesAsBase64, cancellationToken: cancellationToken);
+ => SendAsAsync(role, message, tools: null, imagesAsBase64: imagesAsBase64, cancellationToken: cancellationToken);
///
/// Sends a message in a given role to the currently selected model and streams its response
diff --git a/src/IOllamaApiClient.cs b/src/IOllamaApiClient.cs
index a9f3686..7bf03a2 100644
--- a/src/IOllamaApiClient.cs
+++ b/src/IOllamaApiClient.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
using System.Runtime.CompilerServices;
-using System.Threading;
-using System.Threading.Tasks;
using OllamaSharp.Models;
using OllamaSharp.Models.Chat;
diff --git a/src/MicrosoftAi/AbstractionMapper.cs b/src/MicrosoftAi/AbstractionMapper.cs
index 378539f..476d480 100644
--- a/src/MicrosoftAi/AbstractionMapper.cs
+++ b/src/MicrosoftAi/AbstractionMapper.cs
@@ -290,7 +290,7 @@ private static Models.Chat.ChatRole ToOllamaSharpRole(Microsoft.Extensions.AI.Ch
"system" => Models.Chat.ChatRole.System,
"user" => Models.Chat.ChatRole.User,
"tool" => Models.Chat.ChatRole.Tool,
- _ => new OllamaSharp.Models.Chat.ChatRole(role.Value),
+ _ => new Models.Chat.ChatRole(role.Value),
};
}
diff --git a/src/MicrosoftAi/ChatOptionsExtensions.cs b/src/MicrosoftAi/ChatOptionsExtensions.cs
index 31fee77..f544297 100644
--- a/src/MicrosoftAi/ChatOptionsExtensions.cs
+++ b/src/MicrosoftAi/ChatOptionsExtensions.cs
@@ -1,9 +1,7 @@
using Microsoft.Extensions.AI;
using OllamaSharp.Models;
-#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace OllamaSharp;
-#pragma warning restore IDE0130 // Namespace does not match folder structure
///
/// Extension methods to stream IAsyncEnumerable to its end and return one single result value
diff --git a/src/MicrosoftAi/IAsyncEnumerableExtensions.cs b/src/MicrosoftAi/IAsyncEnumerableExtensions.cs
index 43bf37a..970f44f 100644
--- a/src/MicrosoftAi/IAsyncEnumerableExtensions.cs
+++ b/src/MicrosoftAi/IAsyncEnumerableExtensions.cs
@@ -1,11 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
using Microsoft.Extensions.AI;
-#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace OllamaSharp;
-#pragma warning restore IDE0130 // Namespace does not match folder structure
///
/// Extension methods to stream IAsyncEnumerable to its end and return one single result value
@@ -13,11 +8,11 @@ namespace OllamaSharp;
public static partial class IAsyncEnumerableExtensions
{
///
- /// Streams a given of response chunks to its end and builds one single out of them.
+ /// Streams a given of response chunks to its end and builds one single out of them.
///
- /// The to stream
- /// An optional callback to additionally process every single item from the IAsyncEnumerable
- /// A single built up from every single IAsyncEnumerable item
+ /// The to stream.
+ /// An optional callback to additionally process every single item from the IAsyncEnumerable.
+ /// A single built up from every single IAsyncEnumerable item.
public static Task StreamToEndAsync(this IAsyncEnumerable stream, Action? itemCallback = null)
=> stream.StreamToEndAsync(new MicrosoftAi.StreamingChatCompletionUpdateAppender(), itemCallback);
-}
+}
\ No newline at end of file
diff --git a/src/MicrosoftAi/StreamingChatCompletionUpdateAppender.cs b/src/MicrosoftAi/StreamingChatCompletionUpdateAppender.cs
index 1ab216c..36165df 100644
--- a/src/MicrosoftAi/StreamingChatCompletionUpdateAppender.cs
+++ b/src/MicrosoftAi/StreamingChatCompletionUpdateAppender.cs
@@ -3,7 +3,7 @@
namespace OllamaSharp.MicrosoftAi;
///
-/// Appender to stream
+/// Appender to stream
/// to build up one consolidated object
///
internal class StreamingChatCompletionUpdateAppender : IAppender
diff --git a/src/MicrosoftAi/StreamingChatCompletionUpdateBuilder.cs b/src/MicrosoftAi/StreamingChatCompletionUpdateBuilder.cs
index 0a37613..cc9399f 100644
--- a/src/MicrosoftAi/StreamingChatCompletionUpdateBuilder.cs
+++ b/src/MicrosoftAi/StreamingChatCompletionUpdateBuilder.cs
@@ -1,4 +1,3 @@
-using System.Collections.Generic;
using System.Text;
using Microsoft.Extensions.AI;
diff --git a/src/Models/PushModel.cs b/src/Models/PushModel.cs
index 61495f0..b066a3c 100644
--- a/src/Models/PushModel.cs
+++ b/src/Models/PushModel.cs
@@ -3,9 +3,7 @@
namespace OllamaSharp.Models;
///
-/// Upload a model to a model library. Requires registering for ollama.ai and
-/// adding a public key first.
-///
+/// Upload a model to a model library. Requires registering for ollama.ai and adding a public key first.
/// Ollama API docs
///
public class PushModelRequest : OllamaRequest
diff --git a/src/Models/ShowModel.cs b/src/Models/ShowModel.cs
index d77cdb2..d43e615 100644
--- a/src/Models/ShowModel.cs
+++ b/src/Models/ShowModel.cs
@@ -4,9 +4,7 @@
namespace OllamaSharp.Models;
///
-/// Show information about a model including details, modelfile, template,
-/// parameters, license, system prompt.
-///
+/// Show information about a model including details, modelfile, template, parameters, license, system prompt.
/// Ollama API docs
///
[JsonUnmappedMemberHandling(JsonUnmappedMemberHandling.Skip)]
diff --git a/src/OllamaApiClientExtensions.cs b/src/OllamaApiClientExtensions.cs
index e5000d1..1e9e180 100644
--- a/src/OllamaApiClientExtensions.cs
+++ b/src/OllamaApiClientExtensions.cs
@@ -133,7 +133,7 @@ public static Task EmbedAsync(this IOllamaApiClient client, strin
Prompt = prompt,
Model = client.SelectedModel,
Stream = true,
- Context = context?.Context ?? []
+ Context = context?.Context
};
return client.GenerateAsync(request, cancellationToken);
}
diff --git a/test/FunctionalTests/ChatTests.cs b/test/FunctionalTests/ChatTests.cs
index 359944e..48cd394 100644
--- a/test/FunctionalTests/ChatTests.cs
+++ b/test/FunctionalTests/ChatTests.cs
@@ -9,10 +9,8 @@ public class ChatTests
private readonly Uri _baseUri = new("http://localhost:11434");
private readonly string _model = "llama3.2:1b";
-#pragma warning disable NUnit1032
private OllamaApiClient _client = null!;
private Chat _chat = null!;
-#pragma warning restore NUnit1032
[SetUp]
public async Task Setup()