InferenceAI

Enter at least two characters to search.

Start free

Validate Structured Output

mediumLLM Engineering20 min25 XP

Given a dictionary and schema mapping keys to type names (str, int, list, bool), return missing or invalid keys in schema order.

Examples

EXAMPLE WALKTHROUGHvalid

A guided view of the published example, not a trace of your code.

INPUT[{"name":"x","score":2},{"name":"str","score":"int"}]
TASKvalidate_output()
EXPECTED OUTPUT[]

Start with the input values shown in this example.

Example 1 of 2

Input: data = {"name":"x","score":2}, schema = {"name":"str","score":"int"}

Output: []

Explanation: valid

Input: data = {"name":3}, schema = {"name":"str","tags":"list"}

Output: ["name","tags"]

Explanation: invalid

Hint 1

Map schema type names to Python types; remember bool is a subclass of int.

Topics

PythonLLM Engineering