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 (
|
from .constants import (AgentExecutor, BaseChatMemory, BaseLanguageModel,
|
||||||
AgentExecutor,
|
BaseLLM, BaseLoader, BaseMemory, BaseOutputParser,
|
||||||
BaseChatMemory,
|
BasePromptTemplate, BaseRetriever, Callable, Chain,
|
||||||
BaseLanguageModel,
|
ChatPromptTemplate, Data, Document, Embeddings,
|
||||||
BaseLLM,
|
NestedDict, Object, Prompt, PromptTemplate,
|
||||||
BaseLoader,
|
TextSplitter, Tool, VectorStore)
|
||||||
BaseMemory,
|
|
||||||
BaseOutputParser,
|
|
||||||
BasePromptTemplate,
|
|
||||||
BaseRetriever,
|
|
||||||
Callable,
|
|
||||||
Chain,
|
|
||||||
ChatPromptTemplate,
|
|
||||||
Data,
|
|
||||||
Document,
|
|
||||||
Embeddings,
|
|
||||||
NestedDict,
|
|
||||||
Object,
|
|
||||||
Prompt,
|
|
||||||
PromptTemplate,
|
|
||||||
TextSplitter,
|
|
||||||
Tool,
|
|
||||||
VectorStore,
|
|
||||||
)
|
|
||||||
from .range_spec import RangeSpec
|
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__ = [
|
__all__ = [
|
||||||
"NestedDict",
|
"NestedDict",
|
||||||
"Data",
|
"Data",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue