Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
dclipca committed Jan 31, 2025
1 parent 2fc867a commit a226d6e
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<IsPackable>false</IsPackable>
<TargetFrameworks>net8.0;net6.0;net7.0</TargetFrameworks>
<LangVersion>10</LangVersion>
<Version>0.0.3</Version>
<Version>0.1.0</Version>
<PackageId>SpongeEngine.SpongeLLM.Core.Tests</PackageId>
<Authors>SpongeEngine.SpongeLLM.Core.Tests</Authors>
<AssemblyName>SpongeEngine.SpongeLLM.Core.Tests</AssemblyName>
Expand Down
16 changes: 0 additions & 16 deletions SpongeEngine.SpongeLLM.Core/Exceptions/ModelNotFoundException.cs

This file was deleted.

13 changes: 0 additions & 13 deletions SpongeEngine.SpongeLLM.Core/Exceptions/ProviderException.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace SpongeEngine.SpongeLLM.Core.Exceptions
namespace SpongeEngine.LLMSharp.Core.Exceptions
{
public class LlmSharpException : Exception
public class SpongeLLMException : Exception
{
public int? StatusCode { get; }
public string? ResponseContent { get; }

public LlmSharpException(
public SpongeLLMException(
string message,
int? statusCode = null,
string? responseContent = null,
Expand Down
4 changes: 2 additions & 2 deletions SpongeEngine.SpongeLLM.Core/Exceptions/ValidationException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace SpongeEngine.SpongeLLM.Core.Exceptions
namespace SpongeEngine.LLMSharp.Core.Exceptions
{
public class ValidationException : LlmSharpException
public class ValidationException : SpongeLLMException
{
public IDictionary<string, string> ValidationErrors { get; }

Expand Down
7 changes: 1 addition & 6 deletions SpongeEngine.SpongeLLM.Core/LLMClientBase.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using Microsoft.Extensions.Logging;
using Polly;
using Polly.CircuitBreaker;
using Polly.Retry;

namespace SpongeEngine.SpongeLLM.Core
namespace SpongeEngine.SpongeLLM.Core
{
public abstract class LLMClientBase
{
Expand Down
2 changes: 1 addition & 1 deletion SpongeEngine.SpongeLLM.Core/LLMClientBaseOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Polly;
using Polly.CircuitBreaker;
using Polly.Retry;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using SpongeEngine.LLMSharp.Core.Exceptions;

namespace SpongeEngine.SpongeLLM.Core
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!-- Package Info -->
<PackageId>SpongeEngine.SpongeLLM.Core</PackageId>
<Title>SpongeEngine.SpongeLLM.Core</Title>
<Version>0.0.3</Version>
<Version>0.1.0</Version>
<Authors>Dan Clipca</Authors>
<Company>Sponge Engine</Company>
<Description>Common logic for SpongeLLM, unified C# client for LLM providers.</Description>
Expand Down
6 changes: 3 additions & 3 deletions SpongeEngine.SpongeLLM.Core/Utils/RetryPolicy.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.Extensions.Logging;
using SpongeEngine.SpongeLLM.Core.Exceptions;
using SpongeEngine.LLMSharp.Core.Exceptions;

namespace SpongeEngine.SpongeLLM.Core.Utils
{
Expand Down Expand Up @@ -40,12 +40,12 @@ public async Task<T> ExecuteAsync<T>(Func<Task<T>> operation, CancellationToken
}
}

throw new LlmSharpException("Operation failed after retries", innerException: lastException);
throw new SpongeLLMException("Operation failed after retries", innerException: lastException);
}

private bool ShouldRetry(Exception ex)
{
return ex is HttpRequestException || ex is TimeoutException || (ex is LlmSharpException llmEx && llmEx.StatusCode >= 500);
return ex is HttpRequestException || ex is TimeoutException || (ex is SpongeLLMException llmEx && llmEx.StatusCode >= 500);
}
}
}
55 changes: 0 additions & 55 deletions SpongeEngine.SpongeLLM.Core/Utils/ValidationHelper.cs

This file was deleted.

0 comments on commit a226d6e

Please sign in to comment.