langchain_text_splitters.json.RecursiveJsonSplitter¶

class langchain_text_splitters.json.RecursiveJsonSplitter(max_chunk_size: int = 2000, min_chunk_size: Optional[int] = None)[source]¶

Methods

__init__([max_chunk_size, min_chunk_size])

create_documents(texts[, convert_lists, ...])

Create documents from a list of json objects (Dict).

split_json(json_data[, convert_lists])

Splits JSON into a list of JSON chunks

split_text(json_data[, convert_lists])

Splits JSON into a list of JSON formatted strings

Parameters
  • max_chunk_size (int) –

  • min_chunk_size (Optional[int]) –

__init__(max_chunk_size: int = 2000, min_chunk_size: Optional[int] = None)[source]¶
Parameters
  • max_chunk_size (int) –

  • min_chunk_size (Optional[int]) –

create_documents(texts: List[Dict], convert_lists: bool = False, metadatas: Optional[List[dict]] = None) List[Document][source]¶

Create documents from a list of json objects (Dict).

Parameters
  • texts (List[Dict]) –

  • convert_lists (bool) –

  • metadatas (Optional[List[dict]]) –

Return type

List[Document]

split_json(json_data: Dict[str, Any], convert_lists: bool = False) List[Dict][source]¶

Splits JSON into a list of JSON chunks

Parameters
  • json_data (Dict[str, Any]) –

  • convert_lists (bool) –

Return type

List[Dict]

split_text(json_data: Dict[str, Any], convert_lists: bool = False) List[str][source]¶

Splits JSON into a list of JSON formatted strings

Parameters
  • json_data (Dict[str, Any]) –

  • convert_lists (bool) –

Return type

List[str]