🔀 chore(field_typing): reorganize imports and update __all__ list for better readability and maintainability
🔥 chore(field_typing): remove unused base.py file as it is no longer needed 🔀 chore(constants): update import statements and add type aliases for better readability and maintainability
This commit is contained in:
parent
dad8480ce3
commit
4366b02c4f
3 changed files with 60 additions and 13 deletions
|
|
@ -1,8 +1,53 @@
|
||||||
from .base import NestedDict, Data
|
# LANGCHAIN_BASE_TYPES = {
|
||||||
from .constants import *
|
# "Chain": Chain,
|
||||||
|
# "AgentExecutor": AgentExecutor,
|
||||||
__all__ = (
|
# "Tool": Tool,
|
||||||
["NestedDict", "Data"]
|
# "BaseLLM": BaseLLM,
|
||||||
+ list(LANGCHAIN_BASE_TYPES.keys())
|
# "PromptTemplate": PromptTemplate,
|
||||||
+ list(CUSTOM_COMPONENT_SUPPORTED_TYPES.keys())
|
# "BaseLoader": BaseLoader,
|
||||||
|
# "Document": Document,
|
||||||
|
# "TextSplitter": TextSplitter,
|
||||||
|
# "VectorStore": VectorStore,
|
||||||
|
# "Embeddings": Embeddings,
|
||||||
|
# "BaseRetriever": BaseRetriever,
|
||||||
|
# "BaseOutputParser": BaseOutputParser,
|
||||||
|
# "BaseMemory": BaseMemory,
|
||||||
|
# "BaseChatMemory": BaseChatMemory,
|
||||||
|
# }
|
||||||
|
from .constants import (
|
||||||
|
Tool,
|
||||||
|
PromptTemplate,
|
||||||
|
Chain,
|
||||||
|
BaseChatMemory,
|
||||||
|
BaseLLM,
|
||||||
|
BaseLoader,
|
||||||
|
BaseMemory,
|
||||||
|
BaseOutputParser,
|
||||||
|
BaseRetriever,
|
||||||
|
VectorStore,
|
||||||
|
Embeddings,
|
||||||
|
TextSplitter,
|
||||||
|
Document,
|
||||||
|
AgentExecutor,
|
||||||
|
NestedDict,
|
||||||
|
Data,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"NestedDict",
|
||||||
|
"Data",
|
||||||
|
"Tool",
|
||||||
|
"PromptTemplate",
|
||||||
|
"Chain",
|
||||||
|
"BaseChatMemory",
|
||||||
|
"BaseLLM",
|
||||||
|
"BaseLoader",
|
||||||
|
"BaseMemory",
|
||||||
|
"BaseOutputParser",
|
||||||
|
"BaseRetriever",
|
||||||
|
"VectorStore",
|
||||||
|
"Embeddings",
|
||||||
|
"TextSplitter",
|
||||||
|
"Document",
|
||||||
|
"AgentExecutor",
|
||||||
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
from typing import Union, Dict, Any
|
|
||||||
|
|
||||||
# Type alias for more complex dicts
|
|
||||||
NestedDict = Dict[str, Union[str, Dict]]
|
|
||||||
Data = Any
|
|
||||||
|
|
@ -10,7 +10,14 @@ from langchain.schema.memory import BaseMemory
|
||||||
from langchain.text_splitter import TextSplitter
|
from langchain.text_splitter import TextSplitter
|
||||||
from langchain.tools import Tool
|
from langchain.tools import Tool
|
||||||
from langchain.vectorstores.base import VectorStore
|
from langchain.vectorstores.base import VectorStore
|
||||||
from langflow.field_typing import Data, NestedDict
|
from typing import Union, Dict
|
||||||
|
|
||||||
|
# Type alias for more complex dicts
|
||||||
|
NestedDict = Dict[str, Union[str, Dict]]
|
||||||
|
|
||||||
|
|
||||||
|
class Data:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
LANGCHAIN_BASE_TYPES = {
|
LANGCHAIN_BASE_TYPES = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue