-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added CSharpToJsonSchema projects.
- Loading branch information
Showing
63 changed files
with
542 additions
and
607 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/libs/CSharpToJsonSchema.Generators/CSharpToJsonSchema.Generators.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
<GenerateDocumentationFile>false</GenerateDocumentationFile> | ||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> | ||
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> | ||
<NoWarn>$(NoWarn);CA1014;CA1031;CA1308</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Label="Global Usings"> | ||
<Using Include="System.Net.Http"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="PolySharp" Version="1.14.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="IsExternalInit" Version="1.0.3"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" PrivateAssets="all"/> | ||
<PackageReference Include="H.Generators.Extensions" Version="1.22.0" PrivateAssets="all"/> | ||
</ItemGroup> | ||
|
||
</Project> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 3 additions & 6 deletions
9
src/libs/OpenAI.Generators/Sources.Calls.cs → ...pToJsonSchema.Generators/Sources.Calls.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/libs/OpenAI.Generators/Steps.cs → ...bs/CSharpToJsonSchema.Generators/Steps.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net4.6.2;net6.0;net8.0</TargetFrameworks> | ||
<NoWarn>$(NoWarn);CA1724;CA2227;CA1819</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="System.Text.Json" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Label="Nuget"> | ||
<Description> | ||
Generated C# SDK based on official OpenAI OpenAPI specification. | ||
Includes C# Source Generator which allows you to define functions natively through a C# interface, and also provides extensions that make it easier to call this interface later</Description> | ||
<PackageTags>api;client;sdk;dotnet;swagger;openapi;specification;openai;generated;nswag;functions;gpt-3.5;gpt-4;chatgpt;generator;source generator;constants;prices;pricing;vision;audio;embedding;moderation;image;chat</PackageTags> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="System.Text.Json" Version="9.0.0-rc.1.24431.7" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\CSharpToJsonSchema.Generators\CSharpToJsonSchema.Generators.csproj" ReferenceOutputAssembly="false" PackAsAnalyzer="true" /> | ||
<None Include="..\CSharpToJsonSchema.Generators\bin\$(Configuration)\netstandard2.0\H.Generators.Extensions.dll" Pack="true" PackagePath="analyzers/dotnet" Visible="false" /> | ||
<None Include="..\CSharpToJsonSchema.Generators\bin\$(Configuration)\netstandard2.0\System.Collections.Immutable.dll" Pack="true" PackagePath="analyzers/dotnet" Visible="false" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Label="CLSCompliant"> | ||
<AssemblyAttribute Include="System.CLSCompliantAttribute"> | ||
<_Parameter1>true</_Parameter1> | ||
</AssemblyAttribute> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Label="Trimmable" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))"> | ||
<IsAotCompatible>true</IsAotCompatible> | ||
<EnableTrimAnalyzer>true</EnableTrimAnalyzer> | ||
<IsTrimmable>true</IsTrimmable> | ||
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings> | ||
<TrimmerSingleWarn>false</TrimmerSingleWarn> | ||
</PropertyGroup> | ||
|
||
</Project> |
15 changes: 15 additions & 0 deletions
15
src/libs/CSharpToJsonSchema/GenerateJsonSchemaAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// ReSharper disable once CheckNamespace | ||
namespace CSharpToJsonSchema; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Interface)] | ||
[System.Diagnostics.Conditional("GENERATE_JSON_SCHEMA_ATTRIBUTES")] | ||
public sealed class GenerateJsonSchemaAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public bool Strict { get; set; } | ||
} |
2 changes: 1 addition & 1 deletion
2
src/libs/OpenAI/Attributes/OpenApiSchema.cs → src/libs/CSharpToJsonSchema/OpenApiSchema.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// ReSharper disable once CheckNamespace | ||
namespace OpenAI; | ||
namespace CSharpToJsonSchema; | ||
|
||
/// <summary> | ||
/// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#nullable enable | ||
|
||
namespace CSharpToJsonSchema; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public sealed partial class Tool | ||
{ | ||
/// <summary> | ||
/// The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("name")] | ||
[global::System.Text.Json.Serialization.JsonRequired] | ||
public string? Name { get; set; } | ||
|
||
/// <summary> | ||
/// A description of what the function does, used by the model to choose when and how to call the function. | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("description")] | ||
public string? Description { get; set; } | ||
|
||
/// <summary> | ||
/// The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. <br/> | ||
/// Omitting `parameters` defines a function with an empty parameter list. | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("parameters")] | ||
public object? Parameters { get; set; } | ||
|
||
/// <summary> | ||
/// Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).<br/> | ||
/// Default Value: false | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("strict")] | ||
public bool? Strict { get; set; } = false; | ||
|
||
/// <summary> | ||
/// Additional properties that are not explicitly defined in the schema | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonExtensionData] | ||
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>(); | ||
} |
Oops, something went wrong.