Skip to content

Commit bdf14f2

Browse files
MarcusKohnertMarcus Kohnert
andauthored
.Net: Enable clients to remove safe_prompt attribute from json (#12631)
### Motivation and Context Solves: #12629 ### Description See linked issue ### Contribution Checklist - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [😓] I didn't break anyone 😄 Co-authored-by: Marcus Kohnert <[email protected]>
1 parent b2d5179 commit bdf14f2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

dotnet/src/Connectors/Connectors.MistralAI/Client/ChatCompletionRequest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ internal sealed class ChatCompletionRequest
3030
public bool Stream { get; set; } = false;
3131

3232
[JsonPropertyName("safe_prompt")]
33-
public bool SafePrompt { get; set; } = false;
33+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
34+
public bool? SafePrompt { get; set; } = false;
3435

3536
[JsonPropertyName("tools")]
3637
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]

dotnet/src/Connectors/Connectors.MistralAI/MistralAIPromptExecutionSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public int? MaxTokens
7878
/// </summary>
7979
[JsonPropertyName("safe_prompt")]
8080
[JsonConverter(typeof(BoolJsonConverter))]
81-
public bool SafePrompt
81+
public bool? SafePrompt
8282
{
8383
get => this._safePrompt;
8484

@@ -338,7 +338,7 @@ public static MistralAIPromptExecutionSettings FromExecutionSettings(PromptExecu
338338
private double _temperature = 0.7;
339339
private double _topP = 1;
340340
private int? _maxTokens;
341-
private bool _safePrompt = false;
341+
private bool? _safePrompt = false;
342342
private int? _randomSeed;
343343
private string _apiVersion = "v1";
344344
private MistralAIToolCallBehavior? _toolCallBehavior;

0 commit comments

Comments
 (0)