mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-28 06:48:50 +00:00
core[patch]: Support .yml extension for YAML (#16783)
- **Description:** [AS-IS] When dealing with a yaml file, the extension must be .yaml. [TO-BE] In the absence of extension length constraints in the OS, the extension of the YAML file is yaml, but control over the yml extension must still be made. It's as if it's an error because it's a .jpg extension in jpeg support. - **Issue:** - - **Dependencies:** no dependencies required for this change,
This commit is contained in:
committed by
GitHub
parent
cd00a87db7
commit
1987f905ed
@@ -30,7 +30,7 @@ def _load_prompt_from_file(file: Union[str, Path]) -> BasePromptTemplate:
|
||||
if file_path.suffix == ".json":
|
||||
with open(file_path) as f:
|
||||
config = json.load(f)
|
||||
elif file_path.suffix == ".yaml":
|
||||
elif file_path.suffix.endswith((".yaml", ".yml")):
|
||||
with open(file_path, "r") as f:
|
||||
config = yaml.safe_load(f)
|
||||
elif file_path.suffix == ".py":
|
||||
|
Reference in New Issue
Block a user