mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET Workflows - Update State Serialization for JSON Checkpointing (#1388)
* Checkpoint * Checkpoint * Namespace * All ready * Namespace * Clean * Fix
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using Microsoft.PowerFx.Types;
|
||||
|
||||
namespace Microsoft.Agents.AI.Workflows.Declarative.Extensions;
|
||||
|
||||
internal static class ExpandoObjectExtensions
|
||||
{
|
||||
public static RecordType ToRecordType(this ExpandoObject value)
|
||||
{
|
||||
RecordType recordType = RecordType.Empty();
|
||||
|
||||
foreach (KeyValuePair<string, object?> property in value)
|
||||
{
|
||||
recordType.Add(property.Key, property.Value.GetFormulaType());
|
||||
}
|
||||
|
||||
return recordType;
|
||||
}
|
||||
|
||||
public static RecordValue ToRecord(this ExpandoObject value) =>
|
||||
FormulaValue.NewRecordFromFields(
|
||||
value.Select(
|
||||
property => new NamedValue(property.Key, property.Value.ToFormula())));
|
||||
}
|
||||
Reference in New Issue
Block a user