Skip to content

Commit

Permalink
feat: Added Enums. Fixed some bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed May 31, 2024
1 parent ec027e7 commit f9e1a1b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/libs/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<PropertyGroup Label="Nuget">
<Version>1.2.0</Version>
<Version>1.2.1</Version>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors>tryAGI and contributors</Authors>
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Ollama.Models/Message.Constructors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public Message()
/// <param name="role"></param>
/// <param name="content"></param>
[SetsRequiredMembers]
public Message(string role, string content)
public Message(MessageRole role, string content)
{
Role = role;
Content = content;
Expand Down
4 changes: 2 additions & 2 deletions src/libs/Ollama.Models/Ollama.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<OpenApiGenerator_Namespace>Ollama</OpenApiGenerator_Namespace>
<OpenApiGenerator_GenerateSdk>false</OpenApiGenerator_GenerateSdk>
<OpenApiGenerator_GenerateModels>true</OpenApiGenerator_GenerateModels>
<OpenApiGenerator_GenerateSuperTypeForJsonSerializerContext>true</OpenApiGenerator_GenerateSuperTypeForJsonSerializerContext>
<OpenApiGenerator_GenerateJsonSerializerContextTypes>true</OpenApiGenerator_GenerateJsonSerializerContextTypes>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,7 +26,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="OpenApiGenerator" Version="0.8.6">
<PackageReference Include="OpenApiGenerator" Version="0.9.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/libs/Ollama/Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Task<Message> SendAsync(
/// <param name="message">The message to send</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
public Task<Message> SendAsAsync(
string role,
MessageRole role,
string message,
CancellationToken cancellationToken = default)
{
Expand All @@ -80,7 +80,7 @@ public Task<Message> SendAsAsync(
/// <param name="imagesAsBase64">Base64 encoded images to send to the model</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
public async Task<Message> SendAsAsync(
string role,
MessageRole role,
string message,
IEnumerable<string?>? imagesAsBase64,
CancellationToken cancellationToken = default)
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Ollama/Ollama.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="OpenApiGenerator" Version="0.8.6">
<PackageReference Include="OpenApiGenerator" Version="0.9.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/libs/Ollama/OllamaApiClientExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void EnsureSuccess(
{
response = response ?? throw new ArgumentNullException(nameof(response));

if (response.Status != "success")
if (response.Status != PullModelResponseStatus.Success)
{
throw new InvalidOperationException($"Failed to pull model with status {response.Status}");
}
Expand Down Expand Up @@ -106,7 +106,7 @@ public static async Task<GenerateChatCompletionResponse> WaitAsync(
{
enumerable = enumerable ?? throw new ArgumentNullException(nameof(enumerable));

string? responseRole = null;
MessageRole? responseRole = null;
var responseContent = new StringBuilder();

var currentResponse = new GenerateChatCompletionResponse();
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Ollama/SourceGenerationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
namespace Ollama;

[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(OpenApiGeneratorTrimmableSupport))]
[JsonSerializable(typeof(JsonSerializerContextTypes))]
internal sealed partial class SourceGenerationContext : JsonSerializerContext;

0 comments on commit f9e1a1b

Please sign in to comment.