-
Notifications
You must be signed in to change notification settings - Fork 15.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUGFIX: add prompt imports for backwards compat (#13702)
- Loading branch information
Showing
21 changed files
with
186 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
from langchain_core.prompts.few_shot import ( | ||
FewShotChatMessagePromptTemplate, | ||
FewShotPromptTemplate, | ||
_FewShotPromptTemplateMixin, | ||
) | ||
|
||
__all__ = ["FewShotPromptTemplate", "FewShotChatMessagePromptTemplate"] | ||
__all__ = [ | ||
"FewShotPromptTemplate", | ||
"FewShotChatMessagePromptTemplate", | ||
"_FewShotPromptTemplateMixin", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
from langchain_core.prompts.loading import load_prompt, load_prompt_from_config | ||
from langchain_core.prompts.loading import ( | ||
_load_examples, | ||
_load_few_shot_prompt, | ||
_load_output_parser, | ||
_load_prompt, | ||
_load_prompt_from_file, | ||
_load_template, | ||
load_prompt, | ||
load_prompt_from_config, | ||
) | ||
from langchain_core.utils.loading import try_load_from_hub | ||
|
||
__all__ = ["load_prompt_from_config", "load_prompt", "try_load_from_hub"] | ||
__all__ = [ | ||
"load_prompt_from_config", | ||
"load_prompt", | ||
"try_load_from_hub", | ||
"_load_examples", | ||
"_load_few_shot_prompt", | ||
"_load_output_parser", | ||
"_load_prompt", | ||
"_load_prompt_from_file", | ||
"_load_template", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from langchain_core.prompts.pipeline import PipelinePromptTemplate | ||
from langchain_core.prompts.pipeline import PipelinePromptTemplate, _get_inputs | ||
|
||
__all__ = ["PipelinePromptTemplate"] | ||
__all__ = ["PipelinePromptTemplate", "_get_inputs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
from langchain_core.prompts.prompt import PromptTemplate | ||
|
||
__all__ = ["PromptTemplate"] | ||
# For backwards compatibility. | ||
Prompt = PromptTemplate | ||
|
||
__all__ = ["PromptTemplate", "Prompt"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Test prompt functionality.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from langchain.prompts.base import __all__ | ||
|
||
EXPECTED_ALL = [ | ||
"BasePromptTemplate", | ||
"StringPromptTemplate", | ||
"StringPromptValue", | ||
"_get_jinja2_variables_from_template", | ||
"check_valid_template", | ||
"get_template_variables", | ||
"jinja2_formatter", | ||
"validate_jinja2", | ||
] | ||
|
||
|
||
def test_all_imports() -> None: | ||
assert set(__all__) == set(EXPECTED_ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from langchain.prompts.chat import __all__ | ||
|
||
EXPECTED_ALL = [ | ||
"AIMessagePromptTemplate", | ||
"BaseChatPromptTemplate", | ||
"BaseMessagePromptTemplate", | ||
"BaseStringMessagePromptTemplate", | ||
"ChatMessagePromptTemplate", | ||
"ChatPromptTemplate", | ||
"ChatPromptValue", | ||
"ChatPromptValueConcrete", | ||
"HumanMessagePromptTemplate", | ||
"MessagesPlaceholder", | ||
"SystemMessagePromptTemplate", | ||
"_convert_to_message", | ||
"_create_template_from_message_type", | ||
] | ||
|
||
|
||
def test_all_imports() -> None: | ||
assert set(__all__) == set(EXPECTED_ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from langchain.prompts.few_shot import __all__ | ||
|
||
EXPECTED_ALL = [ | ||
"FewShotChatMessagePromptTemplate", | ||
"FewShotPromptTemplate", | ||
"_FewShotPromptTemplateMixin", | ||
] | ||
|
||
|
||
def test_all_imports() -> None: | ||
assert set(__all__) == set(EXPECTED_ALL) |
7 changes: 7 additions & 0 deletions
7
libs/langchain/tests/unit_tests/prompts/test_few_shot_with_templates.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from langchain.prompts.few_shot_with_templates import __all__ | ||
|
||
EXPECTED_ALL = ["FewShotPromptWithTemplates"] | ||
|
||
|
||
def test_all_imports() -> None: | ||
assert set(__all__) == set(EXPECTED_ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from langchain.prompts import __all__ | ||
|
||
EXPECTED_ALL = [ | ||
"AIMessagePromptTemplate", | ||
"BaseChatPromptTemplate", | ||
"BasePromptTemplate", | ||
"ChatMessagePromptTemplate", | ||
"ChatPromptTemplate", | ||
"FewShotPromptTemplate", | ||
"FewShotPromptWithTemplates", | ||
"HumanMessagePromptTemplate", | ||
"LengthBasedExampleSelector", | ||
"MaxMarginalRelevanceExampleSelector", | ||
"MessagesPlaceholder", | ||
"NGramOverlapExampleSelector", | ||
"PipelinePromptTemplate", | ||
"Prompt", | ||
"PromptTemplate", | ||
"SemanticSimilarityExampleSelector", | ||
"StringPromptTemplate", | ||
"SystemMessagePromptTemplate", | ||
"load_prompt", | ||
"FewShotChatMessagePromptTemplate", | ||
] | ||
|
||
|
||
def test_all_imports() -> None: | ||
assert set(__all__) == set(EXPECTED_ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from langchain.prompts.loading import __all__ | ||
|
||
EXPECTED_ALL = [ | ||
"_load_examples", | ||
"_load_few_shot_prompt", | ||
"_load_output_parser", | ||
"_load_prompt", | ||
"_load_prompt_from_file", | ||
"_load_template", | ||
"load_prompt", | ||
"load_prompt_from_config", | ||
"try_load_from_hub", | ||
] | ||
|
||
|
||
def test_all_imports() -> None: | ||
assert set(__all__) == set(EXPECTED_ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from langchain.prompts.pipeline import __all__ | ||
|
||
EXPECTED_ALL = ["PipelinePromptTemplate", "_get_inputs"] | ||
|
||
|
||
def test_all_imports() -> None: | ||
assert set(__all__) == set(EXPECTED_ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from langchain.prompts.prompt import __all__ | ||
|
||
EXPECTED_ALL = ["Prompt", "PromptTemplate"] | ||
|
||
|
||
def test_all_imports() -> None: | ||
assert set(__all__) == set(EXPECTED_ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from langchain.tools.base import __all__ | ||
|
||
EXPECTED_ALL = [ | ||
"BaseTool", | ||
"SchemaAnnotationError", | ||
"StructuredTool", | ||
"Tool", | ||
"ToolException", | ||
"_SchemaConfig", | ||
"_create_subset_model", | ||
"_get_filtered_args", | ||
"create_schema_from_function", | ||
"tool", | ||
] | ||
|
||
|
||
def test_all_imports() -> None: | ||
assert set(__all__) == set(EXPECTED_ALL) |