Skip to content

Commit

Permalink
refactor namespace to SpongeLLM and misc
Browse files Browse the repository at this point in the history
  • Loading branch information
dclipca committed Jan 26, 2025
1 parent 4918e25 commit edb62f8
Show file tree
Hide file tree
Showing 43 changed files with 120 additions and 73 deletions.
28 changes: 10 additions & 18 deletions SpongeEngine.KoboldSharp.Tests/Integration/IntegrationTestBase.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
using Microsoft.Extensions.Logging;
using SpongeEngine.KoboldSharp.Tests.Common;
using SpongeEngine.LLMSharp.Core;
using SpongeEngine.SpongeLLM.Core.Interfaces;
using Xunit;
using Xunit.Abstractions;

namespace SpongeEngine.KoboldSharp.Tests.Integration
{
public abstract class IntegrationTestBase : TestBase, IAsyncLifetime
{
protected readonly KoboldSharpClient Client;
protected readonly KoboldSharpClient? Client;
protected readonly ITestOutputHelper Output;
protected readonly ILogger Logger;
protected bool ServerAvailable;

protected IntegrationTestBase(ITestOutputHelper output)
{
Output = output;
Logger = LoggerFactory
.Create(builder => builder.AddXUnit(output))
.CreateLogger(GetType());

Client = new KoboldSharpClient(
new KoboldSharpClientOptions()
Expand All @@ -27,7 +23,9 @@ protected IntegrationTestBase(ITestOutputHelper output)
{
BaseAddress = new Uri(TestConfig.BaseUrl)
},
Logger = Logger,
Logger = LoggerFactory
.Create(builder => builder.AddXUnit(output))
.CreateLogger(GetType())
});
}

Expand All @@ -36,6 +34,7 @@ public async Task InitializeAsync()
try
{
ServerAvailable = await Client.IsAvailableAsync();

if (ServerAvailable)
{
Output.WriteLine("KoboldCpp server is available");
Expand All @@ -55,18 +54,11 @@ public async Task InitializeAsync()
}
}

public Task DisposeAsync()
public async Task DisposeAsync()
{
if (Client is IDisposable disposable)
{
disposable.Dispose();
}
return Task.CompletedTask;
}

private class SkipException : Exception
{
public SkipException(string message) : base(message) { }
Client?.Options.HttpClient?.Dispose();

await Task.CompletedTask;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="WireMock.Net" Version="1.6.9" />
<PackageReference Include="WireMock.Net" Version="1.7.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp.Tests/Unit/Extra/AbortGenerate.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp.Tests/Unit/Extra/LogProbs.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp.Tests/Unit/Extra/PendingOutput.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp.Tests/Unit/Extra/PerfInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using FluentAssertions;
using Microsoft.Extensions.Logging;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Xunit;
Expand Down
6 changes: 6 additions & 0 deletions SpongeEngine.KoboldSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpongeEngine.KoboldSharp",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpongeEngine.KoboldSharp.Tests", "SpongeEngine.KoboldSharp.Tests\SpongeEngine.KoboldSharp.Tests.csproj", "{B4C06852-1A11-45B9-8E83-CF7ABEE36F12}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpongeEngine.SpongeLLM.Core", "..\SpongeLLM.Core\SpongeEngine.SpongeLLM.Core\SpongeEngine.SpongeLLM.Core.csproj", "{9223BC93-3F5D-4A17-B564-59C662F4B63F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -17,5 +19,9 @@ Global
{B4C06852-1A11-45B9-8E83-CF7ABEE36F12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4C06852-1A11-45B9-8E83-CF7ABEE36F12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4C06852-1A11-45B9-8E83-CF7ABEE36F12}.Release|Any CPU.Build.0 = Release|Any CPU
{9223BC93-3F5D-4A17-B564-59C662F4B63F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9223BC93-3F5D-4A17-B564-59C662F4B63F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9223BC93-3F5D-4A17-B564-59C662F4B63F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9223BC93-3F5D-4A17-B564-59C662F4B63F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp/Extra/AbortGenerateAsync.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp/Extra/CountTokensAsync.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp/Extra/DetokenizeAsync.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
6 changes: 3 additions & 3 deletions SpongeEngine.KoboldSharp/Extra/GenerateStreamAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.Extensions.Logging;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
public partial class KoboldSharpClient
{
/// <summary>
{
/// <summary>
/// Generates text given a prompt and generation settings, with SSE streaming. Unspecified values are set to defaults.
/// SSE streaming establishes a persistent connection, returning ongoing process in the form of message events.
/// event: message
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp/Extra/GetExtraVersionInfoAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp/Extra/GetLastLogProbsAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp/Extra/GetPendingOutputAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Net.Http.Json;
using System.Text.Json;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp/Extra/GetPerfInfoAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp/Extra/GetServerPropertiesAsync.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.KoboldSharp/Extra/WebSearchAsync.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
using SpongeEngine.LLMSharp.Core.Exceptions;
using SpongeEngine.SpongeLLM.Core.Exceptions;

namespace SpongeEngine.KoboldSharp
{
Expand Down
Loading

0 comments on commit edb62f8

Please sign in to comment.