mirror of
https://github.com/microsoft/autogen.git
synced 2025-07-19 23:11:22 +00:00

When the tool expects complex inputs that require nested models, pydantic will generate a JSON Schema that will include references to other schemas using the `$ref` keyword (cf https://json-schema.org/understanding-json-schema/structuring#dollarref). But the `$ref` keyword is not supported by OpenAI. This fix: 1. Resolves the references and inlines the corresponding schemas. 2. Removes the then useless root `$defs` field of the JSON schema to save tokens. Co-authored-by: Jean-Marc Le Roux <contact@jmlx.io> Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>