check_schema#
- scikitplot.agent.check_schema(schema, *, what='parameters')[source]#
Check that a tool’s argument schema is in the supported subset.
- Parameters:
- schemamapping
The schema of a tool’s arguments:
{"type": "object", "properties": {...}, "required": [...], "additionalProperties": False}.- whatstr, default=”parameters”
Names the schema in an error message.
- Returns:
- dict
A plain copy of
schema.
- Raises:
- SchemaError
If the schema uses a keyword outside the subset, gives a keyword a value of the wrong kind, is unsatisfiable by construction (
minLengthabovemaxLength, a required property it does not declare while refusing others), or its root is not a closed object.
- Parameters:
- Return type:
Examples
>>> from scikitplot.agent._schema import check_schema >>> schema = check_schema( ... { ... "type": "object", ... "properties": {"query": {"type": "string", "minLength": 1}}, ... "required": ["query"], ... "additionalProperties": False, ... } ... ) >>> sorted(schema) ['additionalProperties', 'properties', 'required', 'type']