Skip to content

Commit

Permalink
fix: Fixed parameter default values.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed May 22, 2024
1 parent 8d7c30a commit 797cd08
Show file tree
Hide file tree
Showing 59 changed files with 10,830 additions and 5,476 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public static string GenerateExtensionMethod(
{endPoint.Properties.Where(static x => x.IsRequired).Select(x => $@"
{x.Type.CSharpType} {x.ParameterName},").Inject()}
{endPoint.Properties.Where(static x => !x.IsRequired).Select(x => $@"
{x.Type.CSharpType} {x.ParameterName} = default,").Inject()}
{x.Type.CSharpType} {x.ParameterName} = {x.ParameterDefaultValue},").Inject()}
{cancellationTokenAttribute}global::System.Threading.CancellationToken cancellationToken = default)
{{
var request = new {endPoint.RequestType}
Expand Down
4 changes: 4 additions & 0 deletions src/libs/OpenApiGenerator.Core/Models/PropertyData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,8 @@ public string ArgumentName
return ParameterName;
}
}

public string ParameterDefaultValue => DefaultValue == null || string.IsNullOrWhiteSpace(DefaultValue)
? "default"
: DefaultValue;
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ components:
type: boolean
description: &stream |
If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
default: false
default: true
keep_alive:
type: integer
description: &keep_alive |
Expand Down Expand Up @@ -486,7 +486,7 @@ components:
stream:
type: boolean
description: *stream
default: false
default: true
keep_alive:
type: integer
description: *keep_alive
Expand Down Expand Up @@ -601,7 +601,7 @@ components:
stream:
type: boolean
description: *stream
default: false
default: true
required:
- name
- modelfile
Expand Down Expand Up @@ -717,7 +717,7 @@ components:
stream:
type: boolean
description: *stream
default: false
default: true
required:
- name
PullModelResponse:
Expand Down Expand Up @@ -772,7 +772,7 @@ components:
stream:
type: boolean
description: *stream
default: false
default: true
required:
- name
PushModelResponse:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public partial class Api
global::System.DateTime endTime = default,
object? extra = default,
string? error = default,
int executionOrder = default,
int executionOrder = 1,
object? serialized = default,
object? outputs = default,
string? parentRunId = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public partial class Api
global::System.DateTime endTime = default,
object? extra = default,
string? error = default,
int executionOrder = default,
int executionOrder = 1,
object? serialized = default,
object? outputs = default,
string? parentRunId = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public partial class Api
public async global::System.Collections.Generic.IAsyncEnumerable<CreateModelResponse> CreateModelAsync(
string name,
string modelfile,
bool stream = default,
bool stream = true,
[global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new CreateModelRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public partial class Api
global::System.Collections.Generic.IList<Message> messages,
GenerateChatCompletionRequestFormat? format = default,
RequestOptions? options = default,
bool stream = default,
bool stream = true,
int keepAlive = default,
[global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public partial class Api
RequestOptions? options = default,
GenerateCompletionRequestFormat? format = default,
bool raw = default,
bool stream = default,
bool stream = true,
int keepAlive = default,
[global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public partial class Api
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<PullModelResponse> PullModelAsync(
string name,
bool insecure = default,
bool stream = default,
bool insecure = false,
bool stream = true,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new PullModelRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public partial class Api
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<PushModelResponse> PushModelAsync(
string name,
bool insecure = default,
bool stream = default,
bool insecure = false,
bool stream = true,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new PushModelRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public sealed partial class CreateModelRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::Newtonsoft.Json.JsonProperty("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// Additional properties that are not explicitly defined in the schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public sealed partial class GenerateChatCompletionRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::Newtonsoft.Json.JsonProperty("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// How long (in minutes) to keep the model loaded in memory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public sealed partial class GenerateCompletionRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::Newtonsoft.Json.JsonProperty("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// How long (in minutes) to keep the model loaded in memory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public sealed partial class PullModelRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::Newtonsoft.Json.JsonProperty("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// Additional properties that are not explicitly defined in the schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public sealed partial class PushModelRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::Newtonsoft.Json.JsonProperty("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// Additional properties that are not explicitly defined in the schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public partial class Api
public async global::System.Collections.Generic.IAsyncEnumerable<CreateModelResponse> CreateModelAsync(
string name,
string modelfile,
bool stream = default,
bool stream = true,
[global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new CreateModelRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public partial class Api
global::System.Collections.Generic.IList<Message> messages,
string? format = default,
RequestOptions? options = default,
bool stream = default,
bool stream = true,
int keepAlive = default,
[global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public partial class Api
RequestOptions? options = default,
string? format = default,
bool raw = default,
bool stream = default,
bool stream = true,
int keepAlive = default,
[global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public partial class Api
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<PullModelResponse> PullModelAsync(
string name,
bool insecure = default,
bool stream = default,
bool insecure = false,
bool stream = true,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new PullModelRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public partial class Api
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<PushModelResponse> PushModelAsync(
string name,
bool insecure = default,
bool stream = default,
bool insecure = false,
bool stream = true,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new PushModelRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public sealed partial class CreateModelRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// Additional properties that are not explicitly defined in the schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public sealed partial class GenerateChatCompletionRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// How long (in minutes) to keep the model loaded in memory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public sealed partial class GenerateCompletionRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// How long (in minutes) to keep the model loaded in memory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public sealed partial class PullModelRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// Additional properties that are not explicitly defined in the schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public sealed partial class PushModelRequest

/// <summary>
/// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
/// <br/>Default Value: false
/// <br/>Default Value: true
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("stream")]
public bool Stream { get; set; } = false;
public bool Stream { get; set; } = true;

/// <summary>
/// Additional properties that are not explicitly defined in the schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public partial class Api
global::System.Collections.Generic.IList<object?>? tools = default,
CreateAssistantRequestToolResources? toolResources = default,
object? metadata = default,
double? temperature = default,
double? topP = default,
double? temperature = 1,
double? topP = 1,
AssistantsApiResponseFormatOption? responseFormat = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ public partial class Api
public async global::System.Threading.Tasks.Task<CreateChatCompletionResponse> CreateChatCompletionAsync(
global::System.Collections.Generic.IList<ChatCompletionRequestMessage> messages,
object model,
double? frequencyPenalty = default,
double? frequencyPenalty = 0,
object? logitBias = default,
bool? logprobs = default,
bool? logprobs = false,
int? topLogprobs = default,
int? maxTokens = default,
int? n = default,
double? presencePenalty = default,
int? n = 1,
double? presencePenalty = 0,
CreateChatCompletionRequestResponseFormat? responseFormat = default,
int? seed = default,
object? stop = default,
bool? stream = default,
bool? stream = false,
ChatCompletionStreamOptions? streamOptions = default,
double? temperature = default,
double? topP = default,
double? temperature = 1,
double? topP = 1,
global::System.Collections.Generic.IList<ChatCompletionTool>? tools = default,
ChatCompletionToolChoiceOption? toolChoice = default,
string? user = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ public partial class Api
public async global::System.Threading.Tasks.Task<CreateCompletionResponse> CreateCompletionAsync(
object model,
object? prompt,
int? bestOf = default,
bool? echo = default,
double? frequencyPenalty = default,
int? bestOf = 1,
bool? echo = false,
double? frequencyPenalty = 0,
object? logitBias = default,
int? logprobs = default,
int? maxTokens = default,
int? n = default,
double? presencePenalty = default,
int? maxTokens = 16,
int? n = 1,
double? presencePenalty = 0,
int? seed = default,
object? stop = default,
bool? stream = default,
bool? stream = false,
ChatCompletionStreamOptions? streamOptions = default,
string? suffix = default,
double? temperature = default,
double? topP = default,
double? temperature = 1,
double? topP = 1,
string? user = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public partial class Api
public async global::System.Threading.Tasks.Task<CreateEmbeddingResponse> CreateEmbeddingAsync(
object input,
object model,
CreateEmbeddingRequestEncodingFormat? encodingFormat = default,
CreateEmbeddingRequestEncodingFormat? encodingFormat = CreateEmbeddingRequestEncodingFormat.Float,
int dimensions = default,
string? user = default,
global::System.Threading.CancellationToken cancellationToken = default)
Expand Down
Loading

0 comments on commit 797cd08

Please sign in to comment.