Skip to content

Commit 06512da

Browse files
committed
.NET: style: revert format
1 parent 003baa8 commit 06512da

File tree

1 file changed

+35
-38
lines changed

1 file changed

+35
-38
lines changed

dotnet/src/Connectors/Connectors.OpenAI/Settings/OpenAIPromptExecutionSettings.cs

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public object? ReasoningEffort
5151
public double? Temperature
5252
{
5353
get => this._temperature;
54+
5455
set
5556
{
5657
this.ThrowIfFrozen();
@@ -68,6 +69,7 @@ public double? Temperature
6869
public double? TopP
6970
{
7071
get => this._topP;
72+
7173
set
7274
{
7375
this.ThrowIfFrozen();
@@ -85,6 +87,7 @@ public double? TopP
8587
public double? PresencePenalty
8688
{
8789
get => this._presencePenalty;
90+
8891
set
8992
{
9093
this.ThrowIfFrozen();
@@ -102,6 +105,7 @@ public double? PresencePenalty
102105
public double? FrequencyPenalty
103106
{
104107
get => this._frequencyPenalty;
108+
105109
set
106110
{
107111
this.ThrowIfFrozen();
@@ -117,6 +121,7 @@ public double? FrequencyPenalty
117121
public int? MaxTokens
118122
{
119123
get => this._maxTokens;
124+
120125
set
121126
{
122127
this.ThrowIfFrozen();
@@ -132,6 +137,7 @@ public int? MaxTokens
132137
public IList<string>? StopSequences
133138
{
134139
get => this._stopSequences;
140+
135141
set
136142
{
137143
this.ThrowIfFrozen();
@@ -148,6 +154,7 @@ public IList<string>? StopSequences
148154
public long? Seed
149155
{
150156
get => this._seed;
157+
151158
set
152159
{
153160
this.ThrowIfFrozen();
@@ -173,6 +180,7 @@ public long? Seed
173180
public object? ResponseFormat
174181
{
175182
get => this._responseFormat;
183+
176184
set
177185
{
178186
this.ThrowIfFrozen();
@@ -189,6 +197,7 @@ public object? ResponseFormat
189197
public string? ChatSystemPrompt
190198
{
191199
get => this._chatSystemPrompt;
200+
192201
set
193202
{
194203
this.ThrowIfFrozen();
@@ -206,6 +215,7 @@ public string? ChatSystemPrompt
206215
public string? ChatDeveloperPrompt
207216
{
208217
get => this._chatDeveloperPrompt;
218+
209219
set
210220
{
211221
this.ThrowIfFrozen();
@@ -221,6 +231,7 @@ public string? ChatDeveloperPrompt
221231
public IDictionary<int, int>? TokenSelectionBiases
222232
{
223233
get => this._tokenSelectionBiases;
234+
224235
set
225236
{
226237
this.ThrowIfFrozen();
@@ -261,6 +272,7 @@ public IDictionary<int, int>? TokenSelectionBiases
261272
public ToolCallBehavior? ToolCallBehavior
262273
{
263274
get => this._toolCallBehavior;
275+
264276
set
265277
{
266278
this.ThrowIfFrozen();
@@ -276,6 +288,7 @@ public ToolCallBehavior? ToolCallBehavior
276288
public string? User
277289
{
278290
get => this._user;
291+
279292
set
280293
{
281294
this.ThrowIfFrozen();
@@ -293,6 +306,7 @@ public string? User
293306
public bool? Logprobs
294307
{
295308
get => this._logprobs;
309+
296310
set
297311
{
298312
this.ThrowIfFrozen();
@@ -308,6 +322,7 @@ public bool? Logprobs
308322
public int? TopLogprobs
309323
{
310324
get => this._topLogprobs;
325+
311326
set
312327
{
313328
this.ThrowIfFrozen();
@@ -323,6 +338,7 @@ public int? TopLogprobs
323338
public IDictionary<string, string>? Metadata
324339
{
325340
get => this._metadata;
341+
326342
set
327343
{
328344
this.ThrowIfFrozen();
@@ -339,6 +355,7 @@ public IDictionary<string, string>? Metadata
339355
public bool? Store
340356
{
341357
get => this._store;
358+
342359
set
343360
{
344361
this.ThrowIfFrozen();
@@ -368,6 +385,7 @@ public bool? Store
368385
public object? WebSearchOptions
369386
{
370387
get => this._webSearchOptions;
388+
371389
set
372390
{
373391
this.ThrowIfFrozen();
@@ -395,6 +413,7 @@ public object? WebSearchOptions
395413
public object? Modalities
396414
{
397415
get => this._responseModalities;
416+
398417
set
399418
{
400419
this.ThrowIfFrozen();
@@ -420,6 +439,7 @@ public object? Modalities
420439
public object? Audio
421440
{
422441
get => this._audioOptions;
442+
423443
set
424444
{
425445
this.ThrowIfFrozen();
@@ -444,9 +464,7 @@ public override void Freeze()
444464

445465
if (this._tokenSelectionBiases is not null)
446466
{
447-
this._tokenSelectionBiases = new ReadOnlyDictionary<int, int>(
448-
this._tokenSelectionBiases
449-
);
467+
this._tokenSelectionBiases = new ReadOnlyDictionary<int, int>(this._tokenSelectionBiases);
450468
}
451469

452470
if (this._metadata is not null)
@@ -467,14 +485,14 @@ public override PromptExecutionSettings Clone()
467485
/// <param name="executionSettings">Template configuration</param>
468486
/// <param name="defaultMaxTokens">Default max tokens</param>
469487
/// <returns>An instance of OpenAIPromptExecutionSettings</returns>
470-
public static OpenAIPromptExecutionSettings FromExecutionSettings(
471-
PromptExecutionSettings? executionSettings,
472-
int? defaultMaxTokens = null
473-
)
488+
public static OpenAIPromptExecutionSettings FromExecutionSettings(PromptExecutionSettings? executionSettings, int? defaultMaxTokens = null)
474489
{
475490
if (executionSettings is null)
476491
{
477-
return new OpenAIPromptExecutionSettings() { MaxTokens = defaultMaxTokens };
492+
return new OpenAIPromptExecutionSettings()
493+
{
494+
MaxTokens = defaultMaxTokens
495+
};
478496
}
479497

480498
if (executionSettings is OpenAIPromptExecutionSettings settings)
@@ -484,10 +502,7 @@ public static OpenAIPromptExecutionSettings FromExecutionSettings(
484502

485503
var json = JsonSerializer.Serialize(executionSettings);
486504

487-
var openAIExecutionSettings = JsonSerializer.Deserialize<OpenAIPromptExecutionSettings>(
488-
json,
489-
JsonOptionsCache.ReadPermissive
490-
);
505+
var openAIExecutionSettings = JsonSerializer.Deserialize<OpenAIPromptExecutionSettings>(json, JsonOptionsCache.ReadPermissive);
491506

492507
// Restore the function choice behavior that lost internal state(list of function instances) during serialization/deserialization process.
493508
openAIExecutionSettings!.FunctionChoiceBehavior = executionSettings.FunctionChoiceBehavior;
@@ -500,28 +515,21 @@ public static OpenAIPromptExecutionSettings FromExecutionSettings(
500515
/// </summary>
501516
/// <typeparam name="T">The type of the settings object to clone.</typeparam>
502517
/// <returns>A new instance of the settings object.</returns>
503-
protected internal T Clone<T>()
504-
where T : OpenAIPromptExecutionSettings, new()
518+
protected internal T Clone<T>() where T : OpenAIPromptExecutionSettings, new()
505519
{
506520
return new T()
507521
{
508522
ModelId = this.ModelId,
509-
ExtensionData = this.ExtensionData is not null
510-
? new Dictionary<string, object>(this.ExtensionData)
511-
: null,
523+
ExtensionData = this.ExtensionData is not null ? new Dictionary<string, object>(this.ExtensionData) : null,
512524
Temperature = this.Temperature,
513525
TopP = this.TopP,
514526
PresencePenalty = this.PresencePenalty,
515527
FrequencyPenalty = this.FrequencyPenalty,
516528
MaxTokens = this.MaxTokens,
517-
StopSequences = this.StopSequences is not null
518-
? new List<string>(this.StopSequences)
519-
: null,
529+
StopSequences = this.StopSequences is not null ? new List<string>(this.StopSequences) : null,
520530
Seed = this.Seed,
521531
ResponseFormat = this.ResponseFormat,
522-
TokenSelectionBiases = this.TokenSelectionBiases is not null
523-
? new Dictionary<int, int>(this.TokenSelectionBiases)
524-
: null,
532+
TokenSelectionBiases = this.TokenSelectionBiases is not null ? new Dictionary<int, int>(this.TokenSelectionBiases) : null,
525533
ToolCallBehavior = this.ToolCallBehavior,
526534
FunctionChoiceBehavior = this.FunctionChoiceBehavior,
527535
User = this.User,
@@ -530,9 +538,7 @@ protected internal T Clone<T>()
530538
Logprobs = this.Logprobs,
531539
TopLogprobs = this.TopLogprobs,
532540
Store = this.Store,
533-
Metadata = this.Metadata is not null
534-
? new Dictionary<string, string>(this.Metadata)
535-
: null,
541+
Metadata = this.Metadata is not null ? new Dictionary<string, string>(this.Metadata) : null,
536542
ReasoningEffort = this.ReasoningEffort,
537543
WebSearchOptions = this.WebSearchOptions,
538544
Modalities = this.Modalities,
@@ -544,21 +550,12 @@ protected internal T Clone<T>()
544550
protected override ChatHistory PrepareChatHistoryForRequest(ChatHistory chatHistory)
545551
{
546552
// Inserts system and developer prompts at the beginning of the chat history if they are not already present.
547-
if (
548-
!string.IsNullOrWhiteSpace(this.ChatDeveloperPrompt)
549-
&& !chatHistory.Any(m => m.Role == AuthorRole.Developer)
550-
)
553+
if (!string.IsNullOrWhiteSpace(this.ChatDeveloperPrompt) && !chatHistory.Any(m => m.Role == AuthorRole.Developer))
551554
{
552-
chatHistory.Insert(
553-
0,
554-
new ChatMessageContent(AuthorRole.Developer, this.ChatDeveloperPrompt)
555-
);
555+
chatHistory.Insert(0, new ChatMessageContent(AuthorRole.Developer, this.ChatDeveloperPrompt));
556556
}
557557

558-
if (
559-
!string.IsNullOrWhiteSpace(this.ChatSystemPrompt)
560-
&& !chatHistory.Any(m => m.Role == AuthorRole.System)
561-
)
558+
if (!string.IsNullOrWhiteSpace(this.ChatSystemPrompt) && !chatHistory.Any(m => m.Role == AuthorRole.System))
562559
{
563560
chatHistory.Insert(0, new ChatMessageContent(AuthorRole.System, this.ChatSystemPrompt));
564561
}

0 commit comments

Comments
 (0)