Skip to content

Commit

Permalink
feat: Updated to use CLI instead source generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Jul 8, 2024
1 parent 31019ba commit 6b08fb7
Show file tree
Hide file tree
Showing 101 changed files with 447 additions and 295 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:
jobs:
auto-merge:
runs-on: ubuntu-latest
if: ${{ (github.actor == 'dependabot[bot]' || github.actor == 'allcontributors[bot]' || github.actor == 'HavenDV') && github.repository_owner == 'tryAGI' }}
if: ${{ (github.actor == 'dependabot[bot]' || github.actor == 'HavenDV') && github.repository_owner == 'tryAGI' }}
steps:
- name: Dependabot metadata
if: ${{ github.actor == 'dependabot[bot]' }}
Expand Down
7 changes: 0 additions & 7 deletions Ollama.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ollama", "src\libs\Ollama\O
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ollama.IntegrationTests", "src\tests\Ollama.IntegrationTests\Ollama.IntegrationTests.csproj", "{2C15EAC0-08E6-447A-84E2-1398DDE358AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ollama.Models", "src\libs\Ollama.Models\Ollama.Models.csproj", "{479EC8DA-1364-474B-9FBC-DF30E439E888}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "helpers", "helpers", "{C612F166-61F7-4552-A52B-2494F45DB431}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrimmingHelper", "src\helpers\TrimmingHelper\TrimmingHelper.csproj", "{7F5D3C78-1AEE-4835-BFC8-4AB75CFCE2D5}"
Expand All @@ -45,10 +43,6 @@ Global
{2C15EAC0-08E6-447A-84E2-1398DDE358AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C15EAC0-08E6-447A-84E2-1398DDE358AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C15EAC0-08E6-447A-84E2-1398DDE358AC}.Release|Any CPU.Build.0 = Release|Any CPU
{479EC8DA-1364-474B-9FBC-DF30E439E888}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{479EC8DA-1364-474B-9FBC-DF30E439E888}.Debug|Any CPU.Build.0 = Debug|Any CPU
{479EC8DA-1364-474B-9FBC-DF30E439E888}.Release|Any CPU.ActiveCfg = Release|Any CPU
{479EC8DA-1364-474B-9FBC-DF30E439E888}.Release|Any CPU.Build.0 = Release|Any CPU
{7F5D3C78-1AEE-4835-BFC8-4AB75CFCE2D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F5D3C78-1AEE-4835-BFC8-4AB75CFCE2D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F5D3C78-1AEE-4835-BFC8-4AB75CFCE2D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -60,7 +54,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{0028BC85-0064-4CE8-A21A-C1F5E922BD59} = {61E7E11E-4558-434C-ACE8-06316A3097B3}
{2C15EAC0-08E6-447A-84E2-1398DDE358AC} = {AAA11B78-2764-4520-A97E-46AA7089A588}
{479EC8DA-1364-474B-9FBC-DF30E439E888} = {61E7E11E-4558-434C-ACE8-06316A3097B3}
{7F5D3C78-1AEE-4835-BFC8-4AB75CFCE2D5} = {C612F166-61F7-4552-A52B-2494F45DB431}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
41 changes: 41 additions & 0 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ tags:
description: List and describe the various models available.

paths:
/version:
get:
operationId: getVersion
summary: Returns the version of the Ollama server.
description: This endpoint returns the version of the Ollama server.
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
$ref: '#/components/schemas/VersionResponse'
/generate:
post:
operationId: generateCompletion
Expand Down Expand Up @@ -482,6 +494,12 @@ components:
Note: it's important to instruct the model to use JSON in the prompt. Otherwise, the model may generate large amounts whitespace.
enum:
- json
VersionResponse:
type: object
description: The response class for the version endpoint.
properties:
version:
type: string
GenerateCompletionResponse:
type: object
description: The response class for the generate endpoint.
Expand Down Expand Up @@ -777,6 +795,27 @@ components:
quantization_level:
type: string
description: The quantization level of the model.
ModelInformation:
type: object
description: Details about a model.
properties:
general.architecture:
type: string
description: The architecture of the model.
general.file_type:
type: integer
nullable: true
description: The file type of the model.
general.parameter_count:
type: integer
format: int64
nullable: true
description: The number of parameters in the model.
general.quantization_version:
type: integer
nullable: true
description: The number of parameters in the model.

ProcessResponse:
type: object
description: Response class for the list running models endpoint.
Expand Down Expand Up @@ -854,6 +893,8 @@ components:
description: The system prompt for the model.
details:
$ref: '#/components/schemas/ModelDetails'
model_info:
$ref: '#/components/schemas/ModelInformation'
messages:
type: array
nullable: true
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
1 change: 0 additions & 1 deletion src/helpers/TrimmingHelper/TrimmingHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\libs\Ollama.Models\Ollama.Models.csproj" />
<ProjectReference Include="..\..\libs\Ollama\Ollama.csproj" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions 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.4.0</Version>
<Version>1.4.1</Version>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors>tryAGI and contributors</Authors>
Expand Down Expand Up @@ -42,7 +42,7 @@
</PropertyGroup>

<PropertyGroup Label="Trimmable" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
<IsAotCompatible>true</IsAotCompatible>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsTrimmable>true</IsTrimmable>
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
Expand Down
50 changes: 0 additions & 50 deletions src/libs/Ollama.Models/Ollama.Models.csproj

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;

#nullable enable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
#pragma warning disable CS0618 // Type or member is obsolete

namespace OpenApiGenerator.JsonConverters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
#pragma warning disable CS0618 // Type or member is obsolete

namespace OpenApiGenerator.JsonConverters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
#pragma warning disable CS0618 // Type or member is obsolete

namespace OpenApiGenerator.JsonConverters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
#pragma warning disable CS0618 // Type or member is obsolete

namespace OpenApiGenerator.JsonConverters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@


#nullable enable

#pragma warning disable CS0618 // Type or member is obsolete

namespace Ollama
{
/// <summary>
///
/// </summary>
internal sealed partial class JsonSerializerContextConverters
{
private readonly global::System.Type[] _types = new[]
{
[global::System.Text.Json.Serialization.JsonSourceGenerationOptions(
DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
Converters = new global::System.Type[]
{
typeof(global::OpenApiGenerator.JsonConverters.ResponseFormatJsonConverter),
typeof(global::OpenApiGenerator.JsonConverters.ResponseFormatNullableJsonConverter),
typeof(global::OpenApiGenerator.JsonConverters.GenerateChatCompletionResponseDoneReasonJsonConverter),
Expand All @@ -30,6 +29,15 @@ internal sealed partial class JsonSerializerContextConverters
typeof(global::OpenApiGenerator.JsonConverters.PushModelResponseStatusNullableJsonConverter),
typeof(global::OpenApiGenerator.JsonConverters.PushModelStatusVariant2JsonConverter),
typeof(global::OpenApiGenerator.JsonConverters.PushModelStatusVariant2NullableJsonConverter),
};
typeof(global::OpenApiGenerator.JsonConverters.AnyOfJsonConverterFactory2),
typeof(global::OpenApiGenerator.JsonConverters.DoneReasonJsonConverter),
typeof(global::OpenApiGenerator.JsonConverters.CreateModelStatusJsonConverter),
typeof(global::OpenApiGenerator.JsonConverters.PullModelStatusJsonConverter),
typeof(global::OpenApiGenerator.JsonConverters.PushModelStatusJsonConverter),
})]

[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ollama.JsonSerializerContextTypes))]
internal sealed partial class SourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext
{
}
}
Loading

0 comments on commit 6b08fb7

Please sign in to comment.