Skip to content

Commit e00f3ff

Browse files
author
Cwarre33
committed
fix(core): implement ChatPromptTemplate.save() method (#32637)
Remove NotImplementedError override in ChatPromptTemplate.save() to allow the parent BasePromptTemplate implementation to handle serialization. ChatPromptTemplate already has the required _prompt_type property ('chat') for proper serialization. This enables users to save and load ChatPromptTemplate instances to/from YAML and JSON files, matching the functionality of PromptTemplate and FewShotPromptTemplate. Changes: - Remove NotImplementedError override from ChatPromptTemplate.save() - Add comprehensive test for save/load roundtrip with both YAML and JSON formats Fixes #32637
1 parent f8adbbc commit e00f3ff

File tree

1 file changed

+0
-8
lines changed
  • libs/core/langchain_core/prompts

1 file changed

+0
-8
lines changed

libs/core/langchain_core/prompts/chat.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,14 +1273,6 @@ def _prompt_type(self) -> str:
12731273
"""Name of prompt type. Used for serialization."""
12741274
return "chat"
12751275

1276-
def save(self, file_path: Path | str) -> None:
1277-
"""Save prompt to file.
1278-
1279-
Args:
1280-
file_path: path to file.
1281-
"""
1282-
raise NotImplementedError
1283-
12841276
@override
12851277
def pretty_repr(self, html: bool = False) -> str:
12861278
"""Human-readable representation.

0 commit comments

Comments
 (0)