Json schema
convert_json_schema_to_str(json_schema)
Convert a JSON schema to a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
json_schema
|
Union[dict, str, Type[BaseModel]]
|
The JSON schema. |
required |
Returns:
Type | Description |
---|---|
str
|
The JSON schema converted to a string. |
Raises:
Type | Description |
---|---|
ValueError
|
If the schema is not a dictionary, a string or a Pydantic class. |
Source code in outlines/fsm/json_schema.py
get_schema_from_signature(fn)
Turn a function signature into a JSON schema.
Every JSON object valid to the output JSON Schema can be passed
to fn
using the ** unpacking syntax.