JsonSpec#

class langchain_community.tools.json.tool.JsonSpec[source]#

Bases: BaseModel

Base class for JSON spec.

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

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

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

Create a JsonSpec from a file.

Parameters:

path (Path)

Return type:

JsonSpec

keys(text: str) str[source]#

Return the keys of the dict at the given path.

Parameters:

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

Return type:

str

value(text: str) str[source]#

Return the value of the dict at the given path.

Parameters:

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

Return type:

str

Examples using JsonSpec