initial commit
This commit is contained in:
77
venv/Lib/site-packages/langchain_classic/prompts/__init__.py
Normal file
77
venv/Lib/site-packages/langchain_classic/prompts/__init__.py
Normal file
@@ -0,0 +1,77 @@
|
||||
"""**Prompt** is the input to the model.
|
||||
|
||||
Prompt is often constructed
|
||||
from multiple components. Prompt classes and functions make constructing and working
|
||||
with prompts easy.
|
||||
"""
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_core.example_selectors import (
|
||||
LengthBasedExampleSelector,
|
||||
MaxMarginalRelevanceExampleSelector,
|
||||
SemanticSimilarityExampleSelector,
|
||||
)
|
||||
from langchain_core.prompts import (
|
||||
AIMessagePromptTemplate,
|
||||
BaseChatPromptTemplate,
|
||||
BasePromptTemplate,
|
||||
ChatMessagePromptTemplate,
|
||||
ChatPromptTemplate,
|
||||
FewShotChatMessagePromptTemplate,
|
||||
FewShotPromptTemplate,
|
||||
FewShotPromptWithTemplates,
|
||||
HumanMessagePromptTemplate,
|
||||
MessagesPlaceholder,
|
||||
PromptTemplate,
|
||||
StringPromptTemplate,
|
||||
SystemMessagePromptTemplate,
|
||||
load_prompt,
|
||||
)
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
from langchain_classic.prompts.prompt import Prompt
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.example_selectors.ngram_overlap import (
|
||||
NGramOverlapExampleSelector,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
MODULE_LOOKUP = {
|
||||
"NGramOverlapExampleSelector": (
|
||||
"langchain_community.example_selectors.ngram_overlap"
|
||||
),
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__file__, module_lookup=MODULE_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"AIMessagePromptTemplate",
|
||||
"BaseChatPromptTemplate",
|
||||
"BasePromptTemplate",
|
||||
"ChatMessagePromptTemplate",
|
||||
"ChatPromptTemplate",
|
||||
"FewShotChatMessagePromptTemplate",
|
||||
"FewShotPromptTemplate",
|
||||
"FewShotPromptWithTemplates",
|
||||
"HumanMessagePromptTemplate",
|
||||
"LengthBasedExampleSelector",
|
||||
"MaxMarginalRelevanceExampleSelector",
|
||||
"MessagesPlaceholder",
|
||||
"NGramOverlapExampleSelector",
|
||||
"Prompt",
|
||||
"PromptTemplate",
|
||||
"SemanticSimilarityExampleSelector",
|
||||
"StringPromptTemplate",
|
||||
"SystemMessagePromptTemplate",
|
||||
"load_prompt",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
21
venv/Lib/site-packages/langchain_classic/prompts/base.py
Normal file
21
venv/Lib/site-packages/langchain_classic/prompts/base.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from langchain_core.prompt_values import StringPromptValue
|
||||
from langchain_core.prompts import (
|
||||
BasePromptTemplate,
|
||||
StringPromptTemplate,
|
||||
check_valid_template,
|
||||
get_template_variables,
|
||||
jinja2_formatter,
|
||||
validate_jinja2,
|
||||
)
|
||||
from langchain_core.prompts.string import _get_jinja2_variables_from_template
|
||||
|
||||
__all__ = [
|
||||
"BasePromptTemplate",
|
||||
"StringPromptTemplate",
|
||||
"StringPromptValue",
|
||||
"_get_jinja2_variables_from_template",
|
||||
"check_valid_template",
|
||||
"get_template_variables",
|
||||
"jinja2_formatter",
|
||||
"validate_jinja2",
|
||||
]
|
||||
37
venv/Lib/site-packages/langchain_classic/prompts/chat.py
Normal file
37
venv/Lib/site-packages/langchain_classic/prompts/chat.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from langchain_core.prompt_values import ChatPromptValue, ChatPromptValueConcrete
|
||||
from langchain_core.prompts.chat import (
|
||||
AIMessagePromptTemplate,
|
||||
BaseChatPromptTemplate,
|
||||
BaseStringMessagePromptTemplate,
|
||||
ChatMessagePromptTemplate,
|
||||
ChatPromptTemplate,
|
||||
HumanMessagePromptTemplate,
|
||||
MessageLike,
|
||||
MessageLikeRepresentation,
|
||||
MessagePromptTemplateT,
|
||||
MessagesPlaceholder,
|
||||
SystemMessagePromptTemplate,
|
||||
_convert_to_message,
|
||||
_create_template_from_message_type,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"AIMessagePromptTemplate",
|
||||
"BaseChatPromptTemplate",
|
||||
"BaseMessagePromptTemplate",
|
||||
"BaseStringMessagePromptTemplate",
|
||||
"ChatMessagePromptTemplate",
|
||||
"ChatPromptTemplate",
|
||||
"ChatPromptValue",
|
||||
"ChatPromptValueConcrete",
|
||||
"HumanMessagePromptTemplate",
|
||||
"MessageLike",
|
||||
"MessageLikeRepresentation",
|
||||
"MessagePromptTemplateT",
|
||||
"MessagesPlaceholder",
|
||||
"SystemMessagePromptTemplate",
|
||||
"_convert_to_message",
|
||||
"_create_template_from_message_type",
|
||||
]
|
||||
|
||||
from langchain_core.prompts.message import BaseMessagePromptTemplate
|
||||
@@ -0,0 +1,42 @@
|
||||
"""Logic for selecting examples to include in prompts."""
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_core.example_selectors.length_based import (
|
||||
LengthBasedExampleSelector,
|
||||
)
|
||||
from langchain_core.example_selectors.semantic_similarity import (
|
||||
MaxMarginalRelevanceExampleSelector,
|
||||
SemanticSimilarityExampleSelector,
|
||||
)
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.example_selectors.ngram_overlap import (
|
||||
NGramOverlapExampleSelector,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUPS = {
|
||||
"NGramOverlapExampleSelector": (
|
||||
"langchain_community.example_selectors.ngram_overlap"
|
||||
),
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__file__, deprecated_lookups=DEPRECATED_LOOKUPS)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"LengthBasedExampleSelector",
|
||||
"MaxMarginalRelevanceExampleSelector",
|
||||
"NGramOverlapExampleSelector",
|
||||
"SemanticSimilarityExampleSelector",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
from langchain_core.example_selectors.base import BaseExampleSelector
|
||||
|
||||
__all__ = ["BaseExampleSelector"]
|
||||
@@ -0,0 +1,5 @@
|
||||
from langchain_core.example_selectors.length_based import (
|
||||
LengthBasedExampleSelector,
|
||||
)
|
||||
|
||||
__all__ = ["LengthBasedExampleSelector"]
|
||||
@@ -0,0 +1,32 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.example_selectors.ngram_overlap import (
|
||||
NGramOverlapExampleSelector,
|
||||
ngram_overlap_score,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
MODULE_LOOKUP = {
|
||||
"NGramOverlapExampleSelector": (
|
||||
"langchain_community.example_selectors.ngram_overlap"
|
||||
),
|
||||
"ngram_overlap_score": "langchain_community.example_selectors.ngram_overlap",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__file__, deprecated_lookups=MODULE_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"NGramOverlapExampleSelector",
|
||||
"ngram_overlap_score",
|
||||
]
|
||||
@@ -0,0 +1,11 @@
|
||||
from langchain_core.example_selectors.semantic_similarity import (
|
||||
MaxMarginalRelevanceExampleSelector,
|
||||
SemanticSimilarityExampleSelector,
|
||||
sorted_values,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"MaxMarginalRelevanceExampleSelector",
|
||||
"SemanticSimilarityExampleSelector",
|
||||
"sorted_values",
|
||||
]
|
||||
11
venv/Lib/site-packages/langchain_classic/prompts/few_shot.py
Normal file
11
venv/Lib/site-packages/langchain_classic/prompts/few_shot.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from langchain_core.prompts.few_shot import (
|
||||
FewShotChatMessagePromptTemplate,
|
||||
FewShotPromptTemplate,
|
||||
_FewShotPromptTemplateMixin,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"FewShotChatMessagePromptTemplate",
|
||||
"FewShotPromptTemplate",
|
||||
"_FewShotPromptTemplateMixin",
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
from langchain_core.prompts.few_shot_with_templates import FewShotPromptWithTemplates
|
||||
|
||||
__all__ = ["FewShotPromptWithTemplates"]
|
||||
21
venv/Lib/site-packages/langchain_classic/prompts/loading.py
Normal file
21
venv/Lib/site-packages/langchain_classic/prompts/loading.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"_load_examples",
|
||||
"_load_few_shot_prompt",
|
||||
"_load_output_parser",
|
||||
"_load_prompt",
|
||||
"_load_prompt_from_file",
|
||||
"_load_template",
|
||||
"load_prompt",
|
||||
"load_prompt_from_config",
|
||||
]
|
||||
@@ -0,0 +1,6 @@
|
||||
from langchain_core.prompts.prompt import PromptTemplate
|
||||
|
||||
# For backwards compatibility.
|
||||
Prompt = PromptTemplate
|
||||
|
||||
__all__ = ["Prompt", "PromptTemplate"]
|
||||
Reference in New Issue
Block a user