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.agents.agent import AgentExecutor
|
||||||
from langchain.chains.base import Chain
|
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_core.vectorstores import VectorStore, VectorStoreRetriever
|
||||||
from langchain_text_splitters import TextSplitter
|
from langchain_text_splitters import TextSplitter
|
||||||
|
|
||||||
|
from langflow.schema.message import Message
|
||||||
|
|
||||||
NestedDict: TypeAlias = Dict[str, Union[str, Dict]]
|
NestedDict: TypeAlias = Dict[str, Union[str, Dict]]
|
||||||
LanguageModel = TypeVar("LanguageModel", BaseLanguageModel, BaseLLM, BaseChatModel)
|
LanguageModel = TypeVar("LanguageModel", BaseLanguageModel, BaseLLM, BaseChatModel)
|
||||||
Retriever = TypeVar(
|
Retriever = TypeVar(
|
||||||
|
|
@ -23,6 +25,7 @@ Retriever = TypeVar(
|
||||||
BaseRetriever,
|
BaseRetriever,
|
||||||
VectorStoreRetriever,
|
VectorStoreRetriever,
|
||||||
)
|
)
|
||||||
|
Text: TypeAlias = Message
|
||||||
|
|
||||||
|
|
||||||
class Object:
|
class Object:
|
||||||
|
|
@ -62,6 +65,7 @@ CUSTOM_COMPONENT_SUPPORTED_TYPES = {
|
||||||
**LANGCHAIN_BASE_TYPES,
|
**LANGCHAIN_BASE_TYPES,
|
||||||
"NestedDict": NestedDict,
|
"NestedDict": NestedDict,
|
||||||
"Data": Data,
|
"Data": Data,
|
||||||
|
"Message": Message,
|
||||||
"Text": Text,
|
"Text": Text,
|
||||||
"Object": Object,
|
"Object": Object,
|
||||||
"Callable": Callable,
|
"Callable": Callable,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue