Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not request the LLM to provide a $defs field #1136

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

nlenepveu
Copy link
Contributor

Issue

When using output_model with nested objects, an extra $defs field is listed in the json fields requested in the output. This field contains the definitions of nested objects, but it should not be included as a top-level field in the output JSON structure.

Provide your output as a JSON containing the following fields:
<json_fields>
["entities", "$defs"] // HERE
</json_fields>
Here are the properties for each field:
<json_field_properties>
{
  "entities": {
    "description": "The list of entities.",
    "items": {
      "$ref": "#/$defs/EntityOutput"
    },
    "type": "array"
  },
  "$defs": {
    "EntityOutput": {
      "name": {
        "description": "The name of the category as output by the category lookup
tool.",
        "type": "string"
      }
    }
  }
}
</json_field_properties>

Expected behavior

Even if the $defs field must be present in the json field properties description, it should not be listed in the json fields requested in the output.

Provide your output as a JSON containing the following fields:
<json_fields>
["entities"]
</json_fields>
Here are the properties for each field:
<json_field_properties>
{
  "entities": {
    "description": "The list of entities.",
    "items": {
      "$ref": "#/$defs/EntityOutput"
    },
    "type": "array"
  },
  "$defs": {
    "EntityOutput": {
      "name": {
        "description": "The name of the category as output by the category lookup tool.",
        "type": "string"
      }
    }
  }
}
</json_field_properties>

@ashpreetbedi
Copy link
Contributor

@nlenepveu quick check if this breaks nested output models?

@ashpreetbedi
Copy link
Contributor

will approve and merge so can test this locally

@ashpreetbedi ashpreetbedi merged commit 7c1d6a1 into phidatahq:main Sep 23, 2024
1 check passed
@nlenepveu nlenepveu deleted the output_model_fields branch September 23, 2024 11:05
AbhishekRP2002 pushed a commit to AbhishekRP2002/phidata that referenced this pull request Oct 28, 2024
…l_fields

fix: do not request the LLM to provide a $defs field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants