mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-01 04:29:09 +00:00
Fixed DeprecationWarning
for PromptTemplate.from_file
module-level calls (#14468)
Resolves https://github.com/langchain-ai/langchain/issues/14467
This commit is contained in:
parent
df95abb7e7
commit
b9ef92f2f4
@ -17,18 +17,10 @@ from langchain.chains.sequential import SequentialChain
|
||||
|
||||
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(
|
||||
|
@ -14,6 +14,13 @@ from langchain.chains.llm_summarization_checker.base import (
|
||||
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."""
|
||||
|
Loading…
Reference in New Issue
Block a user