Refactor constants.py to add Message type alias
This commit is contained in:
parent
e08db72e21
commit
67764c0182
1 changed files with 5 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Callable, Dict, Text, TypeAlias, TypeVar, Union
|
||||
from typing import Callable, Dict, TypeAlias, TypeVar, Union
|
||||
|
||||
from langchain.agents.agent import AgentExecutor
|
||||
from langchain.chains.base import Chain
|
||||
|
|
@ -16,6 +16,8 @@ from langchain_core.tools import Tool
|
|||
from langchain_core.vectorstores import VectorStore, VectorStoreRetriever
|
||||
from langchain_text_splitters import TextSplitter
|
||||
|
||||
from langflow.schema.message import Message
|
||||
|
||||
NestedDict: TypeAlias = Dict[str, Union[str, Dict]]
|
||||
LanguageModel = TypeVar("LanguageModel", BaseLanguageModel, BaseLLM, BaseChatModel)
|
||||
Retriever = TypeVar(
|
||||
|
|
@ -23,6 +25,7 @@ Retriever = TypeVar(
|
|||
BaseRetriever,
|
||||
VectorStoreRetriever,
|
||||
)
|
||||
Text: TypeAlias = Message
|
||||
|
||||
|
||||
class Object:
|
||||
|
|
@ -62,6 +65,7 @@ CUSTOM_COMPONENT_SUPPORTED_TYPES = {
|
|||
**LANGCHAIN_BASE_TYPES,
|
||||
"NestedDict": NestedDict,
|
||||
"Data": Data,
|
||||
"Message": Message,
|
||||
"Text": Text,
|
||||
"Object": Object,
|
||||
"Callable": Callable,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue