Skip to content

Commit

Permalink
Fixed DeprecationWarning for PromptTemplate.from_file module-leve…
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbraza committed Dec 13, 2023
1 parent df95abb commit b9ef92f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
16 changes: 4 additions & 12 deletions libs/langchain/langchain/chains/llm_summarization_checker/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,10 @@

PROMPTS_DIR = Path(__file__).parent / "prompts"

CREATE_ASSERTIONS_PROMPT = PromptTemplate.from_file(
PROMPTS_DIR / "create_facts.txt", ["summary"]
)
CHECK_ASSERTIONS_PROMPT = PromptTemplate.from_file(
PROMPTS_DIR / "check_facts.txt", ["assertions"]
)
REVISED_SUMMARY_PROMPT = PromptTemplate.from_file(
PROMPTS_DIR / "revise_summary.txt", ["checked_assertions", "summary"]
)
ARE_ALL_TRUE_PROMPT = PromptTemplate.from_file(
PROMPTS_DIR / "are_all_true_prompt.txt", ["checked_assertions"]
)
CREATE_ASSERTIONS_PROMPT = PromptTemplate.from_file(PROMPTS_DIR / "create_facts.txt")
CHECK_ASSERTIONS_PROMPT = PromptTemplate.from_file(PROMPTS_DIR / "check_facts.txt")
REVISED_SUMMARY_PROMPT = PromptTemplate.from_file(PROMPTS_DIR / "revise_summary.txt")
ARE_ALL_TRUE_PROMPT = PromptTemplate.from_file(PROMPTS_DIR / "are_all_true_prompt.txt")


def _load_sequential_chain(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
from tests.unit_tests.llms.fake_llm import FakeLLM


def test_input_variables() -> None:
assert CREATE_ASSERTIONS_PROMPT.input_variables == ["summary"]
assert CHECK_ASSERTIONS_PROMPT.input_variables == ["assertions"]
assert REVISED_SUMMARY_PROMPT.input_variables == ["checked_assertions", "summary"]
assert ARE_ALL_TRUE_PROMPT.input_variables == ["checked_assertions"]


@pytest.fixture
def fake_llm_summarization_checker_chain() -> LLMSummarizationCheckerChain:
"""Fake LLMCheckerChain for testing."""
Expand Down

0 comments on commit b9ef92f

Please sign in to comment.