support for type descriptors $type #5420
Replies: 3 comments
-
|
Not as a general function-tool argument feature. The repo does use For function tools, I would model the discriminator explicitly in the tool schema, for example |
Beta Was this translation helpful? Give feedback.
-
|
Can you explain a bit more on the exact use-case and why you need to ser-deser ? |
Beta Was this translation helpful? Give feedback.
-
|
For example, I have the following classes: [JsonPolymorphic(TypeDiscriminatorPropertyName = "$type", IgnoreUnrecognizedTypeDiscriminators = false)] public class GeometryCircle : GeometryBase public class GeometryRectangle : GeometryBase public class GeometrySquare : GeometryBase I also have the following function exposed as a tool: List < GeometryBase > GetGeomDetailsById(List ids) The returned list actually contains instances of GeometryCircle, GeometryRectangle, and GeometrySquare. However, when serializing List < GeometryBase > to JSON, the result contains only empty GeometryBase objects, without any of the derived type properties. As a workaround, I changed the return type from List to List and performed the serialization manually before returning the result. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Does the Agent Framework support type descriptors during deserialization within the function tools mechanism (e.g., preserving polymorphic types or using metadata such as $type for correct object reconstruction)?
Beta Was this translation helpful? Give feedback.
All reactions