Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
6fa5620
[Storage][DataMovement] Fix some failing live tests (#52551)
jalauzon-msft Sep 10, 2025
a662d3c
.NET SDK Network Release Version 2024-10-01
Sep 10, 2025
86d23e3
build: bump MTG version (#52562)
jorgerangel-msft Sep 10, 2025
3f8874c
Prepare HttpPipelineHelper to onbord customer sdk stats. (#52565)
rajkumar-rangaraj Sep 10, 2025
bbb5483
Initial release for Azure.ResourceManager.Resources.Bicep (#50751)
anthony-c-martin Sep 11, 2025
28634c9
Release ComputeSchedule .NET sdk for api-version 2025-05-01 (#52284)
NneOkeke Sep 11, 2025
17d0414
Remove internal setter from collection-type property (#52554)
live1206 Sep 11, 2025
a5c1d29
Update TypeSpec emitter version to prerelease 1.0.0-alpha.20250911.1 …
azure-sdk Sep 11, 2025
c888746
Increment package version after release of Azure.ResourceManager.Comp…
azure-sdk Sep 11, 2025
08e3d5e
Remove setter for safeflatten collection-type property and handle nul…
live1206 Sep 11, 2025
f6b4de8
add codeowner (#52570)
kevinzz6 Sep 11, 2025
cc9c182
Update UnbrandedGeneratorVersion to 1.0.0-alpha.20250911.1 (#52582)
azure-sdk Sep 11, 2025
6b200f6
[Storage] [DataMovement] Merge hotfix branch DMLib into main (#52586)
amnguye Sep 11, 2025
399089e
Add custom instructions to fetch TypeSpec docs (#52588)
azure-sdk Sep 11, 2025
8e1f393
Update UnbrandedGeneratorVersion to 1.0.0-alpha.20250911.3 (#52590)
azure-sdk Sep 11, 2025
5048599
Make Prepare-Release.ps1 executable (#52592)
azure-sdk Sep 12, 2025
cc25ac2
Synapse release Sep 2025 (#52389)
kevinzz6 Sep 12, 2025
47c3b0b
Add setter for collection-type property during safe flatten to avoid …
live1206 Sep 12, 2025
76feea1
Update TypeSpec emitter version to prerelease 1.0.0-alpha.20250911.3 …
azure-sdk Sep 12, 2025
f82e269
Increment package version after release of Azure.Analytics.Synapse.Ar…
azure-sdk Sep 12, 2025
f9ba85d
Release Azure.ResourceManager.ComputeSchedule 1.2.0-beta.1 (#52600)
ArthurMa1978 Sep 12, 2025
48b9ea2
Increment package version after release of Azure.ResourceManager.Comp…
azure-sdk Sep 12, 2025
c22f53c
Update documentation for AuthorizationCodeCredential (#52605)
austrheim Sep 12, 2025
ab0504a
scope resource support. (#52598)
haiyuazhang Sep 12, 2025
d0fab99
Regenerate repository SDK with TypeSpec build 20250911.2 (#52576)
azure-sdk Sep 12, 2025
7dc4bfc
Update UnbrandedGeneratorVersion to 1.0.0-alpha.20250912.1 (#52609)
azure-sdk Sep 12, 2025
6e2a7fc
[Microsoft.ClientModel.TestFramework] Update test-proxy tool logic (#…
m-redding Sep 12, 2025
7c4109e
feat: bump keyvault admin spec (#52581)
jorgerangel-msft Sep 12, 2025
ef1510a
Update UnbrandedGeneratorVersion to 1.0.0-alpha.20250912.2 (#52610)
azure-sdk Sep 12, 2025
588dd67
Fix tenantId selection in MSAL (#52613)
christothes Sep 12, 2025
7b95361
Add comprehensive samples for missing Azure.OpenAI APIs (#52137)
Copilot Sep 12, 2025
e2d0b20
Update TypeSpec emitter version to prerelease 1.0.0-alpha.20250912.2 …
azure-sdk Sep 13, 2025
d1d71e0
Optimize the Telemetry test for C# (#52615)
nick863 Sep 13, 2025
600a4c1
[Microsoft.ContainerInstance] Rectify latest preview API version (#52…
drishtipeshwani09 Sep 15, 2025
68265c7
Support "tuple resource" in new management generator (#52537)
haiyuazhang Sep 15, 2025
ca6e724
Specified build command in the configuration for .NET (#52546)
raych1 Sep 15, 2025
390a4c4
Add Debug to list of parameters copied for SearchOptions. (#52629)
davo7135 Sep 15, 2025
d0eb905
Sync eng/common directory with azure-sdk-tools for PR 11931 (#52630)
azure-sdk Sep 15, 2025
fd4b2d1
Revert "Specified build command in the configuration for .NET (#52546…
raych1 Sep 15, 2025
05a765c
Change LogProb data type (#52523)
rhurey Sep 15, 2025
c4c6acc
Regenerate repository SDK with TypeSpec build 20250915.1 (#52627)
azure-sdk Sep 16, 2025
42439ef
Autogenerate KeyVault API for 2025-05-01 (#52611)
ksemenov-gh Sep 16, 2025
b9c515e
[AutoPR Azure.ResourceManager.ComputeRecommender]-generated-from-SDK …
azure-sdk Sep 16, 2025
e521c48
[AutoPR Azure.ResourceManager.DisconnectedOperations]-generated-from-…
azure-sdk Sep 16, 2025
5859155
Update Generator Version 3.0.0-beta.20250916.1 (#52642)
ArcturusZhang Sep 16, 2025
499f744
WorkloadOrchestration Initial SDK Release (#50571)
atharvau Sep 16, 2025
f0dd807
[Storage] [DataMovement] Changelogs for 12.3.0-beta.1 Release (#52646)
nickliu-msft Sep 16, 2025
4067f86
Add support for @azure-typespec/http-client-csharp emitter in Generat…
Copilot Sep 16, 2025
af5cfc4
Include diagnostics when trace is enabled (#52647)
JoshLove-msft Sep 16, 2025
9d5f65d
[Microsoft.ClientModel.TestFramework] Add support for non-generic col…
m-redding Sep 16, 2025
300bd78
Increment version for storage releases (#52648)
azure-sdk Sep 16, 2025
dad4b3d
Update changelog (#52649)
rhurey Sep 16, 2025
39c5699
(playwrighttesting): Removed sorce code for both CP and DP sdk for pl…
kashish2508 Sep 16, 2025
147e903
Promote ACS Email SDK to stable version 2025-09-01 (#52654)
ddouglas-msft Sep 17, 2025
6436e9d
Fix Message blocks serialization. (#52653)
nick863 Sep 17, 2025
bc48cf5
Increment package version after release of Azure.ResourceManager.Work…
azure-sdk Sep 17, 2025
3ce678d
Increment package version after release of Azure.ResourceManager.Cont…
azure-sdk Sep 17, 2025
a8359d3
Prepare AOT-safe release for Azure.ResourceManager.SignalR (#52643)
ArthurMa1978 Sep 17, 2025
217a0b0
Update core JS dependencies for Azure Management Generator (#52639)
Copilot Sep 17, 2025
e330fff
[AutoPR Azure.ResourceManager.StorageMover]-generated-from-SDK Genera…
azure-sdk Sep 17, 2025
8e86f0b
fix ci in computerecommender (#52659)
ArcturusZhang Sep 17, 2025
022ae3c
Update commitId for flatten decorator legacy namespace move (#52640)
welovej Sep 17, 2025
bea740e
fix issue in populate rest operation arguments. (#52663)
haiyuazhang Sep 17, 2025
89ca810
Regenerate repository SDK with TypeSpec build 20250916.1 (#52662)
ArcturusZhang Sep 17, 2025
f1f4e11
update (#52665)
ArthurMa1978 Sep 17, 2025
cebf933
ci(mgmt): remove unused per-package path list from sdk/resourcemanage…
ArthurMa1978 Sep 17, 2025
f09e243
Roll back the release setup for Azure.ResourceManager.StorageMover. (…
ArthurMa1978 Sep 17, 2025
b49d59f
change request path ancestor relationship detection logic. (#52669)
haiyuazhang Sep 17, 2025
e322024
Increment package version after release of Azure.AI.VoiceLive (#52657)
azure-sdk Sep 17, 2025
86f8803
Increment package version after release of Azure.ResourceManager.IotF…
azure-sdk Sep 17, 2025
6e48c23
[Storage][DataMovement] Fix some more flakey Live tests (#52584)
nickliu-msft Sep 17, 2025
12e3f5b
Update UnbrandedGeneratorVersion to 1.0.0-alpha.20250917.1 (#52673)
azure-sdk Sep 17, 2025
f100474
Add link to customization docs (#52686)
JoshLove-msft Sep 17, 2025
6fe19ec
Add confirmation before sdk generation (#52685)
azure-sdk Sep 17, 2025
a6688f4
Update commit (#52690)
JoshLove-msft Sep 18, 2025
adcf2b0
update commit and directory (#52693)
ArcturusZhang Sep 18, 2025
dce958b
Regenerate repository SDK with TypeSpec build 20250917.2 (#52692)
ArcturusZhang Sep 18, 2025
deb2a0c
Fix namespace for `Azure.ResourceManager.Compute.Recommender` (#52696)
ArcturusZhang Sep 18, 2025
c2bf433
[Conv runtime] remove conersationai 20250515preview (#52651)
amber-Chen-86 Sep 18, 2025
ce32f4a
Remove Azure AD reference from Identity README (#52698)
scottaddie Sep 18, 2025
36d0a86
[Storage] Add system-assigned managed identity support to Blob perf t…
jalauzon-msft Sep 18, 2025
568c749
Sync eng/common directory with azure-sdk-tools repository (#52702)
azure-sdk Sep 18, 2025
c7ecdbb
Sync eng/common directory with azure-sdk-tools for PR 11968 (#52704)
azure-sdk Sep 18, 2025
74964ae
Update UnbrandedGeneratorVersion to 1.0.0-alpha.20250918.1 (#52708)
azure-sdk Sep 18, 2025
82bc1c4
[Microsoft.ClientModel.TestFramework] Remove some flaky tests that ar…
m-redding Sep 18, 2025
217b03b
Specified build command in the configuration for .NET again
raych1 Sep 18, 2025
b966cb0
Prepare for the release (#52715)
nick863 Sep 18, 2025
cb88a7d
Sync eng/common directory with azure-sdk-tools for PR 11868 (#52707)
azure-sdk Sep 18, 2025
c01c83d
Update commit IDs to reference specs with emitter-output-dir (#52699)
JoshLove-msft Sep 18, 2025
441584e
Increment package version after release of Azure.AI.Agents.Persistent…
azure-sdk Sep 18, 2025
2721849
Increment package version after release of Azure.AI.Language.Conversa…
azure-sdk Sep 18, 2025
4abc4c8
Sync eng/common directory with azure-sdk-tools for PR 12060 (#52711)
azure-sdk Sep 19, 2025
1c1194b
Merge branch 'main' into kamboj-prjwl/release-network-2024-10-01
ArthurMa1978 Sep 19, 2025
6c3b294
update
ArthurMa1978 Sep 19, 2025
b8f548a
update
ArthurMa1978 Sep 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change LogProb data type (#52523)
* Change LogProb data type

* Missed file

* API Updates

* File cleanup; remove public BinaryData from more places

* Latest updates

* n progress

* Add tests

* Latest updates

* Lots of test updates and API simplification

* Snippet and API updates

* Remove run settings

* Don't add a readme w/ the tests

* More tests and refactoring

* Generator updates

* Improve Error Handling
  • Loading branch information
rhurey authored Sep 15, 2025
commit 05a765ca3a326319e464fbbf6a88b4c62b6303ec
6 changes: 3 additions & 3 deletions sdk/ai/Azure.AI.VoiceLive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ var model = "gpt-4o-mini-realtime-preview"; // Specify the model to use
VoiceLiveSession session = await client.StartSessionAsync(model).ConfigureAwait(false);

// Configure session for voice conversation
SessionOptions sessionOptions = new SessionOptions()
VoiceLiveSessionOptions sessionOptions = new()
{
Model = model,
Instructions = "You are a helpful AI assistant. Respond naturally and conversationally.",
Expand Down Expand Up @@ -188,7 +188,7 @@ await foreach (SessionUpdate serverEvent in session.GetUpdatesAsync().ConfigureA
### Configuring custom voice and advanced features

```C# Snippet:AdvancedVoiceConfiguration
SessionOptions sessionOptions = new SessionOptions()
VoiceLiveSessionOptions sessionOptions = new()
{
Model = model,
Instructions = "You are a customer service representative. Be helpful and professional.",
Expand Down Expand Up @@ -235,7 +235,7 @@ var getCurrentWeatherFunction = new VoiceLiveFunctionDefinition("get_current_wea
""")
};

SessionOptions sessionOptions = new SessionOptions()
VoiceLiveSessionOptions sessionOptions = new()
{
Model = model,
Instructions = "You are a weather assistant. Use the get_current_weather function to help users with weather information.",
Expand Down
415 changes: 180 additions & 235 deletions sdk/ai/Azure.AI.VoiceLive/api/Azure.AI.VoiceLive.net8.0.cs

Large diffs are not rendered by default.

415 changes: 180 additions & 235 deletions sdk/ai/Azure.AI.VoiceLive/api/Azure.AI.VoiceLive.netstandard2.0.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ private async Task SetupSessionAsync(CancellationToken cancellationToken)
};

// Create conversation session options
var sessionOptions = new SessionOptions
var sessionOptions = new VoiceLiveSessionOptions
{
EchoCancellation = new AudioEchoCancellation(),
InputAudioEchoCancellation = new AudioEchoCancellation(),
Model = _model,
Instructions = _instructions,
Voice = azureVoice,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private async Task SetupSessionAsync(CancellationToken cancellationToken)
};

// Create conversation session options with function tools
var sessionOptions = new SessionOptions
var sessionOptions = new VoiceLiveSessionOptions
{
Model = _model,
Instructions = _instructions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task BasicVoiceAssistantExample()
VoiceLiveSession session = await client.StartSessionAsync(model).ConfigureAwait(false);

// Configure session for voice conversation
SessionOptions sessionOptions = new SessionOptions()
VoiceLiveSessionOptions sessionOptions = new()
{
Model = model,
Instructions = "You are a helpful AI assistant. Respond naturally and conversationally.",
Expand Down Expand Up @@ -84,7 +84,7 @@ public async Task AdvancedVoiceConfiguration()
VoiceLiveSession session = await client.StartSessionAsync(model).ConfigureAwait(false);

#region Snippet:AdvancedVoiceConfiguration
SessionOptions sessionOptions = new SessionOptions()
VoiceLiveSessionOptions sessionOptions = new()
{
Model = model,
Instructions = "You are a customer service representative. Be helpful and professional.",
Expand Down Expand Up @@ -143,7 +143,7 @@ public async Task FunctionCallingExample()
""")
};

SessionOptions sessionOptions = new SessionOptions()
VoiceLiveSessionOptions sessionOptions = new()
{
Model = model,
Instructions = "You are a weather assistant. Use the get_current_weather function to help users with weather information.",
Expand Down
2 changes: 1 addition & 1 deletion sdk/ai/Azure.AI.VoiceLive/src/Azure.AI.VoiceLive.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>
This is the Azure.AI.VoiceLive client library for working with the Azure VoiceLive service.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#nullable disable

using System;
using System.Collections.Generic;
using System.Linq;

namespace Azure.AI.VoiceLive
{
/// <summary> A single log probability entry for a token. </summary>
public partial class LogProbProperties
{
/// <summary> The bytes that were used to generate the log probability. </summary>
[CodeGenMember("Bytes")]
public BinaryData Bytes { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.ClientModel.Primitives;
using System.Text.Json;

namespace Azure.AI.VoiceLive
{
/// <summary>
///
/// </summary>
public partial class ResponseMaxOutputTokensOption : IJsonModel<ResponseMaxOutputTokensOption>
{
void IJsonModel<ResponseMaxOutputTokensOption>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
=> SerializeConversationMaxTokensChoice(this, writer, options);

ResponseMaxOutputTokensOption IJsonModel<ResponseMaxOutputTokensOption>.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
{
using JsonDocument document = JsonDocument.ParseValue(ref reader);
return DeserializeConversationMaxTokensChoice(document.RootElement, options);
}

BinaryData IPersistableModel<ResponseMaxOutputTokensOption>.Write(ModelReaderWriterOptions options)
{
return ModelReaderWriter.Write(this, options, null);
}

ResponseMaxOutputTokensOption IPersistableModel<ResponseMaxOutputTokensOption>.Create(BinaryData data, ModelReaderWriterOptions options)
=> FromBinaryData(data);

string IPersistableModel<ResponseMaxOutputTokensOption>.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";

internal static void SerializeConversationMaxTokensChoice(ResponseMaxOutputTokensOption instance, Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
if (instance._isDefaultNullValue == true)
{
writer.WriteNullValue();
}
else if (instance._stringValue is not null)
{
writer.WriteStringValue(instance._stringValue);
}
else if (instance.NumericValue.HasValue)
{
writer.WriteNumberValue(instance.NumericValue.Value);
}
}

internal static ResponseMaxOutputTokensOption DeserializeConversationMaxTokensChoice(JsonElement element, ModelReaderWriterOptions options = null)
{
if (element.ValueKind == JsonValueKind.Null)
{
return new ResponseMaxOutputTokensOption(isDefaultNullValue: true);
}
if (element.ValueKind == JsonValueKind.String)
{
return new ResponseMaxOutputTokensOption(stringValue: element.GetString());
}
if (element.ValueKind == JsonValueKind.Number)
{
return new ResponseMaxOutputTokensOption(numberValue: element.GetInt32());
}
return null;
}

internal static ResponseMaxOutputTokensOption FromBinaryData(BinaryData bytes)
{
if (bytes is null)
{
return new ResponseMaxOutputTokensOption(isDefaultNullValue: true);
}
using JsonDocument document = JsonDocument.Parse(bytes);
return DeserializeConversationMaxTokensChoice(document.RootElement);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.AI.VoiceLive
{
/// <summary>
/// Represents the maximum number of tokens that may be generated in a response.
/// </summary>
public partial class ResponseMaxOutputTokensOption
{
/// <summary>
/// The numeric equivlant for the number of tokens.
/// </summary>
public int? NumericValue { get; }
private readonly bool? _isDefaultNullValue;
private readonly string _stringValue;

/// <summary>
/// Creates an options class with infinite tokens possible.
/// </summary>
/// <returns></returns>
public static ResponseMaxOutputTokensOption CreateInfiniteMaxTokensOption()
=> new("inf");
/// <summary>
/// Creates an options class with the default number of possible tokens.
/// </summary>
/// <returns></returns>
public static ResponseMaxOutputTokensOption CreateDefaultMaxTokensOption()
=> new(isDefaultNullValue: true);
/// <summary>
/// Creates an options class with a fixed number of tokens.
/// </summary>
/// <param name="maxTokens"></param>
/// <returns></returns>
public static ResponseMaxOutputTokensOption CreateNumericMaxTokensOption(int maxTokens)
=> new(numberValue: maxTokens);
/// <summary>
/// Creates an options class with a fixed number of tokens.
/// </summary>
/// <param name="numberValue"></param>
public ResponseMaxOutputTokensOption(int numberValue)
{
NumericValue = numberValue;
}

internal ResponseMaxOutputTokensOption(string stringValue)
{
_stringValue = stringValue;
}

internal ResponseMaxOutputTokensOption(bool isDefaultNullValue)
{
_isDefaultNullValue = true;
}

internal ResponseMaxOutputTokensOption() { }

/// <summary>
/// Creates a ResponseMaxOutputTokensOptions class from an integer value.
/// </summary>
/// <param name="maxTokens"></param>
public static implicit operator ResponseMaxOutputTokensOption(int maxTokens)
=> CreateNumericMaxTokensOption(maxTokens);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#nullable disable

using System;
using System.Collections.Generic;

namespace Azure.AI.VoiceLive
{
/// <summary> The SessionUpdateInputAudioBufferSpeechStopped. </summary>
public partial class SessionUpdateInputAudioBufferSpeechStopped
{
/// <summary>
/// Time from the start of all audio written to the buffer during the
/// session when speech was first detected. This will correspond to the
/// beginning of audio sent to the model, and thus includes the
/// `prefix_padding_ms` configured in the Session.
/// </summary>
public TimeSpan AudioEnd { get => TimeSpan.FromMilliseconds(AudioEndMs); }

internal int AudioEndMsAs { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#nullable disable

using System;
using System.Collections.Generic;

namespace Azure.AI.VoiceLive
{
/// <summary> The SessionUpdateInputAudioBufferSpeechStarted. </summary>
public partial class SessionUpdateInputAudioBufferSpeechStarted
{
/// <summary>
/// Time from the start of all audio written to the buffer during the
/// session when speech was first detected. This will correspond to the
/// beginning of audio sent to the model, and thus includes the
/// `prefix_padding_ms` configured in the Session.
/// </summary>
public TimeSpan AudioStart { get => TimeSpan.FromMilliseconds(AudioStartMs); }

internal int AudioStartMs { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.ClientModel.Primitives;
using System.Text.Json;

namespace Azure.AI.VoiceLive
{
/// <summary>
///
/// </summary>
public partial class ToolChoiceOption : IJsonModel<ToolChoiceOption>
{
void IJsonModel<ToolChoiceOption>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
=> SerializeConversationToolChoiceOption(this, writer, options);

ToolChoiceOption IJsonModel<ToolChoiceOption>.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
{
using JsonDocument document = JsonDocument.ParseValue(ref reader);
return DeserializeConversationToolChoiceOption(document.RootElement, options);
}

BinaryData IPersistableModel<ToolChoiceOption>.Write(ModelReaderWriterOptions options)
{
return ModelReaderWriter.Write(this, options, null);
}

ToolChoiceOption IPersistableModel<ToolChoiceOption>.Create(BinaryData data, ModelReaderWriterOptions options)
=> FromBinaryData(data);

string IPersistableModel<ToolChoiceOption>.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";

internal static void SerializeConversationToolChoiceOption(ToolChoiceOption instance, Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
if (instance.ToolCallConstraint.HasValue)
{
writer.WriteStringValue(instance.ToolCallConstraint.Value.ToString());
}
else if (instance.FunctionName is not null)
{
var functionObject = new ToolChoiceFunctionObjectFunction(name: instance.FunctionName);
writer.WriteObjectValue(functionObject, options);
}
}

internal static ToolChoiceOption DeserializeConversationToolChoiceOption(JsonElement element, ModelReaderWriterOptions options = null)
{
if (element.ValueKind == JsonValueKind.Object)
{
var functionObject = ToolChoiceFunctionObjectFunction.DeserializeToolChoiceFunctionObjectFunction(element, options);
return new ToolChoiceOption(functionObject.Name);
}
if (element.ValueKind == JsonValueKind.String)
{
return new ToolChoiceOption(new ToolChoiceLiteral(element.GetString()));
}
return null;
}

internal static ToolChoiceOption FromBinaryData(BinaryData bytes)
{
if (bytes is null)
{
return new ToolChoiceOption();
}
using JsonDocument document = JsonDocument.Parse(bytes);
return DeserializeConversationToolChoiceOption(document.RootElement);
}
}
}
Loading