Refactor import statements in __init__.py
This commit is contained in:
parent
2703dd06d3
commit
3d4820144c
1 changed files with 26 additions and 25 deletions
|
|
@ -1,31 +1,32 @@
|
|||
from langflow.template.field.base import TemplateField
|
||||
from typing import Any
|
||||
|
||||
from .constants import (
|
||||
AgentExecutor,
|
||||
BaseChatMemory,
|
||||
BaseLanguageModel,
|
||||
BaseLLM,
|
||||
BaseLoader,
|
||||
BaseMemory,
|
||||
BaseOutputParser,
|
||||
BasePromptTemplate,
|
||||
BaseRetriever,
|
||||
Callable,
|
||||
Chain,
|
||||
ChatPromptTemplate,
|
||||
Data,
|
||||
Document,
|
||||
Embeddings,
|
||||
NestedDict,
|
||||
Object,
|
||||
Prompt,
|
||||
PromptTemplate,
|
||||
TextSplitter,
|
||||
Tool,
|
||||
VectorStore,
|
||||
)
|
||||
from .constants import (AgentExecutor, BaseChatMemory, BaseLanguageModel,
|
||||
BaseLLM, BaseLoader, BaseMemory, BaseOutputParser,
|
||||
BasePromptTemplate, BaseRetriever, Callable, Chain,
|
||||
ChatPromptTemplate, Data, Document, Embeddings,
|
||||
NestedDict, Object, Prompt, PromptTemplate,
|
||||
TextSplitter, Tool, VectorStore)
|
||||
from .range_spec import RangeSpec
|
||||
|
||||
|
||||
def import_template_field():
|
||||
from langflow.template.field.base import TemplateField
|
||||
return TemplateField
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
# This is to avoid circular imports
|
||||
if name == "TemplateField":
|
||||
return import_template_field()
|
||||
elif name == "RangeSpec":
|
||||
return RangeSpec
|
||||
# The other names should work as if they were imported from constants
|
||||
return getattr(constants, name)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
__all__ = [
|
||||
"NestedDict",
|
||||
"Data",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue