langchain.tools.json.tool.JsonSpec

class langchain.tools.json.tool.JsonSpec(*, dict_: Dict, max_value_length: int = 200)[source]

Bases: BaseModel

Base class for JSON spec.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param dict_: Dict [Required]
param max_value_length: int = 200
classmethod from_file(path: Path) JsonSpec[source]

Create a JsonSpec from a file.

keys(text: str) str[source]

Return the keys of the dict at the given path.

Parameters

text – Python representation of the path to the dict (e.g. data[“key1”][0][“key2”]).

value(text: str) str[source]

Return the value of the dict at the given path.

Parameters

text – Python representation of the path to the dict (e.g. data[“key1”][0][“key2”]).

Examples using JsonSpec