You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes you need to adapt a schema to a different target format. For example, you might convert a JSON Schema to the subset supported by OpenAI (https://platform.openai.com/docs/guides/structured-outputs/supported-schemas?type-restrictions=string-restrictions#supported-schemas).
4738
-
4739
-
Note: the more context that an LLM has, the more "correct" the structured output will be, so it's advised to pass the `generateDescriptions: true` option to `toJsonSchemaDocument` APIs.
4740
-
4741
-
**Example** (Convert to an OpenAI-compatible schema)
"description": "a value with a length of at least 1"
4794
-
}
4795
-
},
4796
-
"additionalProperties": false,
4797
-
"required": [
4798
-
"a"
4799
-
]
4800
-
}
4801
-
*/
4802
-
```
4803
-
4804
4735
### Generating an Arbitrary from a Schema
4805
4736
4806
4737
Property-based testing checks your code against many randomly generated inputs. An Arbitrary is a generator that produces random values matching your schema. Schema can derive an Arbitrary automatically, so you do not need to write generators by hand.
0 commit comments