Skip to content

Commit

Permalink
feat: Added generated methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed May 20, 2024
1 parent cda3940 commit 942036d
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 588 deletions.
12 changes: 6 additions & 6 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ paths:
'200':
description: Successful operation.
content:
application/json:
application/x-ndjson:
schema:
$ref: '#/components/schemas/PullModelResponse'
/push:
Expand All @@ -190,7 +190,7 @@ paths:
'200':
description: Successful operation.
content:
application/json:
application/x-ndjson:
schema:
$ref: '#/components/schemas/PushModelResponse'
/blobs/{digest}:
Expand All @@ -200,8 +200,8 @@ paths:
- Models
summary: Check to see if a blob exists on the Ollama server which is useful when creating models.
parameters:
- in: query
name: name
- in: path
name: digest
schema:
type: string
required: true
Expand All @@ -218,8 +218,8 @@ paths:
- Models
summary: Create a blob from a file. Returns the server file path.
parameters:
- in: query
name: name
- in: path
name: digest
schema:
type: string
required: true
Expand Down
6 changes: 3 additions & 3 deletions src/libs/Ollama.Models/Ollama.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

<PropertyGroup Label="OpenApiGenerator">
<OpenApiGenerator_Namespace>Ollama</OpenApiGenerator_Namespace>
<OpenApiGenerator_ClassName>OllamaApi</OpenApiGenerator_ClassName>
<OpenApiGenerator_GenerateModels>true</OpenApiGenerator_GenerateModels>
<OpenApiGenerator_GenerateSdk>false</OpenApiGenerator_GenerateSdk>
<OpenApiGenerator_GenerateModels>true</OpenApiGenerator_GenerateModels>
<OpenApiGenerator_GenerateSuperTypeForJsonSerializerContext>true</OpenApiGenerator_GenerateSuperTypeForJsonSerializerContext>
</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.3.2">
<PackageReference Include="OpenApiGenerator" Version="0.6.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Ollama/Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task<Message> SendAsAsync(
Stream = true,
};

var answer = await Client.SendChatAsync(request, cancellationToken).WaitAsync().ConfigureAwait(false);
var answer = await Client.GenerateChatCompletionAsync(request, cancellationToken).WaitAsync().ConfigureAwait(false);
if (answer.Message == null)
{
throw new InvalidOperationException("Response message was null.");
Expand Down
17 changes: 17 additions & 0 deletions src/libs/Ollama/Ollama.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,29 @@
<Description>Generated C# SDK based on Ollama OpenAPI specification.</Description>
<PackageTags>api;client;sdk;dotnet;swagger;openapi;specification;ollama;generated</PackageTags>
</PropertyGroup>

<PropertyGroup Label="OpenApiGenerator">
<OpenApiGenerator_Namespace>Ollama</OpenApiGenerator_Namespace>
<OpenApiGenerator_ClassName>OllamaApiClient</OpenApiGenerator_ClassName>
<OpenApiGenerator_GenerateSdk>false</OpenApiGenerator_GenerateSdk>
<OpenApiGenerator_GenerateMethods>true</OpenApiGenerator_GenerateMethods>
<OpenApiGenerator_GenerateConstructors>true</OpenApiGenerator_GenerateConstructors>
<OpenApiGenerator_JsonSerializerContext>Ollama.SourceGenerationContext</OpenApiGenerator_JsonSerializerContext>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)../../../docs/openapi.yaml" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="PolySharp" Version="1.14.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="OpenApiGenerator" Version="0.6.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="8.0.3" />
</ItemGroup>

Expand Down
Loading

0 comments on commit 942036d

Please sign in to comment.