Skip to content

The agent engineering platform.

community: Update `file_path` type in `JSONLoader.__init__()` signature (#27535)

orkhank9a277cbe0077
diff --git a/libs/community/langchain_community/document_loaders/json_loader.py b/libs/community/langchain_community/document_loaders/json_loader.py
index 839fe482f6..d255523e7f 100644
--- a/libs/community/langchain_community/document_loaders/json_loader.py
+++ b/libs/community/langchain_community/document_loaders/json_loader.py
@@ -1,4 +1,5 @@
import json
+from os import PathLike
from pathlib import Path
from typing import Any, Callable, Dict, Iterator, Optional, Union
@@ -82,7 +83,7 @@ class JSONLoader(BaseLoader):
def __init__(
self,
- file_path: Union[str, Path],
+ file_path: Union[str, PathLike],
jq_schema: str,
content_key: Optional[str] = None,
is_content_key_jq_parsable: Optional[bool] = False,
@@ -93,7 +94,7 @@ class JSONLoader(BaseLoader):
"""Initialize the JSONLoader.
Args:
- file_path (Union[str, Path]): The path to the JSON or JSON Lines file.
+ file_path (Union[str, PathLike]): The path to the JSON or JSON Lines file.
jq_schema (str): The jq schema to use to extract the data or text from
the JSON.
content_key (str): The key to use to extract the content from