__init__.py — langchain Source File
Architecture documentation for __init__.py, a python file in the langchain codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 89dfa5a9_f5ba_bf83_738e_51891f55fb3f["__init__.py"] 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 89dfa5a9_f5ba_bf83_738e_51891f55fb3f --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 ca259f30_0d10_5741_0d2b_f591a68ec1d9["langchain_core.example_selectors.length_based"] 89dfa5a9_f5ba_bf83_738e_51891f55fb3f --> ca259f30_0d10_5741_0d2b_f591a68ec1d9 dd08db2b_e846_4642_7830_ed4d0f93c69a["langchain_core.example_selectors.semantic_similarity"] 89dfa5a9_f5ba_bf83_738e_51891f55fb3f --> dd08db2b_e846_4642_7830_ed4d0f93c69a 439a4142_6fa6_fe9a_2cba_7c9fb0cdceb7["langchain_classic._api"] 89dfa5a9_f5ba_bf83_738e_51891f55fb3f --> 439a4142_6fa6_fe9a_2cba_7c9fb0cdceb7 be28ea74_d389_468d_f1d6_906fa6d3ff69["langchain_community.example_selectors.ngram_overlap"] 89dfa5a9_f5ba_bf83_738e_51891f55fb3f --> be28ea74_d389_468d_f1d6_906fa6d3ff69 style 89dfa5a9_f5ba_bf83_738e_51891f55fb3f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""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",
]
Domain
Subdomains
Functions
Dependencies
- langchain_classic._api
- langchain_community.example_selectors.ngram_overlap
- langchain_core.example_selectors.length_based
- langchain_core.example_selectors.semantic_similarity
- typing
Source
Frequently Asked Questions
What does __init__.py do?
__init__.py is a source file in the langchain codebase, written in python. It belongs to the PromptManagement domain, ExampleSelection subdomain.
What functions are defined in __init__.py?
__init__.py defines 2 function(s): __getattr__, langchain_community.
What does __init__.py depend on?
__init__.py imports 5 module(s): langchain_classic._api, langchain_community.example_selectors.ngram_overlap, langchain_core.example_selectors.length_based, langchain_core.example_selectors.semantic_similarity, typing.
Where is __init__.py in the architecture?
__init__.py is located at libs/langchain/langchain_classic/prompts/example_selector/__init__.py (domain: PromptManagement, subdomain: ExampleSelection, directory: libs/langchain/langchain_classic/prompts/example_selector).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free