chore: remove unused files and update imports (#1967)
* chore(pyproject.toml): update vulture dependency to version 2.11 * chore: Remove unused files and imports * Refactor legacy_custom/customs.py by removing unused nodes and chains * Refactor langflow.interface.custom.base.py by removing unused code * Refactor test_custom_component.py to import CustomComponent from langflow.custom * refactor(agents): remove AgentInitializer and OpenAIConversationalAgent components as they are no longer needed refactor(embeddings): remove client parameter from OpenAIEmbeddingsComponent as it is not used refactor(memories): change search_scope and search_type parameters in ZepMessageReaderComponent to be of type str refactor(model_specs): remove examples parameter from ChatVertexAIComponent as it is not used refactor(models): change metadata parameter type in OllamaModel to Dict for consistency refactor(VertexAiModel.py): remove examples parameter from ChatVertexAIComponent constructor to simplify the class structure refactor(MultiQueryRetriever.py): change prompt parameter type to Text for better consistency and readability refactor(JsonToolkit.py): update build method to handle both json and yaml file types for JsonToolkit creation refactor(OpenAPIToolkit.py): update build method to handle both json and yaml file types for JsonSpec creation and improve parameter naming for clarity * Format json * refactor(langflow.custom): update imports in code files to use the new langflow.custom module * chore(settings.py): remove unused settings file and related imports and classes from the project. * refactor(langflow): optimize imports in graph/__init__.py and graph/graph/base.py refactor(langflow): remove unused code and simplify logic in vertex/base.py refactor(types.py): remove unused imports and classes, clean up commented out code, and improve code readability by removing unnecessary methods and attributes refactor(utils.py): remove unused functions is_basic_type, invoke_lc_runnable, generate_result feat(load): add new functionality to load flow from JSON file or object and run flow from JSON file or object feat(load): add new modules load.py and __init__.py for loading and running flow from JSON feat(processing): remove unused functions get_result_and_steps, flush_langfuse_callback_if_present refactor(process.py): remove unused functions and imports to clean up the codebase feat(utils.py): remove unused file utils.py to declutter the project and improve maintainability test(test_loading.py): update import paths after restructuring the project folders
This commit is contained in:
parent
8230434e19
commit
4ebfd59b1b
206 changed files with 6311 additions and 11113 deletions
16
poetry.lock
generated
16
poetry.lock
generated
|
|
@ -9295,6 +9295,20 @@ platformdirs = ">=3.9.1,<5"
|
||||||
docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"]
|
docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"]
|
||||||
test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"]
|
test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vulture"
|
||||||
|
version = "2.11"
|
||||||
|
description = "Find dead code"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.8"
|
||||||
|
files = [
|
||||||
|
{file = "vulture-2.11-py2.py3-none-any.whl", hash = "sha256:12d745f7710ffbf6aeb8279ba9068a24d4e52e8ed333b8b044035c9d6b823aba"},
|
||||||
|
{file = "vulture-2.11.tar.gz", hash = "sha256:f0fbb60bce6511aad87ee0736c502456737490a82d919a44e6d92262cb35f1c2"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "watchfiles"
|
name = "watchfiles"
|
||||||
version = "0.21.0"
|
version = "0.21.0"
|
||||||
|
|
@ -9991,4 +10005,4 @@ local = ["ctransformers", "llama-cpp-python", "sentence-transformers"]
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = ">=3.10,<3.13"
|
python-versions = ">=3.10,<3.13"
|
||||||
content-hash = "33629727ceeb0aa86064658e89349c24fd786bb1bd3833f093651b70b264edb7"
|
content-hash = "90454066807e8ae6341a0b4e9569bfabb027b005081e94bbfb763ce8c72de10f"
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ pytest-instafail = "^0.5.0"
|
||||||
pytest-asyncio = "^0.23.0"
|
pytest-asyncio = "^0.23.0"
|
||||||
pytest-profiling = "^1.7.0"
|
pytest-profiling = "^1.7.0"
|
||||||
pre-commit = "^3.7.0"
|
pre-commit = "^3.7.0"
|
||||||
|
vulture = "^2.11"
|
||||||
|
|
||||||
[tool.poetry.extras]
|
[tool.poetry.extras]
|
||||||
deploy = ["celery", "redis", "flower"]
|
deploy = ["celery", "redis", "flower"]
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ from langflow.api.v1.schemas import (
|
||||||
UpdateCustomComponentRequest,
|
UpdateCustomComponentRequest,
|
||||||
UploadFileResponse,
|
UploadFileResponse,
|
||||||
)
|
)
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.custom.utils import build_custom_component_template
|
||||||
from langflow.graph.graph.base import Graph
|
from langflow.graph.graph.base import Graph
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.interface.custom.utils import build_custom_component_template
|
|
||||||
from langflow.processing.process import process_tweaks, run_graph_internal
|
from langflow.processing.process import process_tweaks, run_graph_internal
|
||||||
from langflow.schema.graph import Tweaks
|
from langflow.schema.graph import Tweaks
|
||||||
from langflow.services.auth.utils import api_key_security, get_current_active_user
|
from langflow.services.auth.utils import api_key_security, get_current_active_user
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
from langflow.helpers.record import records_to_text
|
from langflow.helpers.record import records_to_text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.memory import store_message
|
from langflow.memory import store_message
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
from langflow.helpers.record import records_to_text
|
from langflow.helpers.record import records_to_text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema.schema import Record
|
from langflow.schema.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema.schema import Record
|
from langflow.schema.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
from typing import Callable, List, Optional, Union
|
|
||||||
|
|
||||||
from langchain.agents import AgentExecutor, AgentType, initialize_agent, types
|
|
||||||
|
|
||||||
from langflow.field_typing import BaseChatMemory, BaseLanguageModel, Tool
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class AgentInitializerComponent(CustomComponent):
|
|
||||||
display_name: str = "Agent Initializer"
|
|
||||||
description: str = "Initialize a Langchain Agent."
|
|
||||||
documentation: str = "https://python.langchain.com/docs/modules/agents/agent_types/"
|
|
||||||
|
|
||||||
def build_config(self):
|
|
||||||
agents = list(types.AGENT_TO_CLASS.keys())
|
|
||||||
# field_type and required are optional
|
|
||||||
return {
|
|
||||||
"agent": {"options": agents, "value": agents[0], "display_name": "Agent Type"},
|
|
||||||
"max_iterations": {"display_name": "Max Iterations", "value": 10},
|
|
||||||
"memory": {"display_name": "Memory"},
|
|
||||||
"tools": {"display_name": "Tools"},
|
|
||||||
"llm": {"display_name": "Language Model"},
|
|
||||||
"code": {"advanced": True},
|
|
||||||
}
|
|
||||||
|
|
||||||
def build(
|
|
||||||
self,
|
|
||||||
agent: str,
|
|
||||||
llm: BaseLanguageModel,
|
|
||||||
tools: List[Tool],
|
|
||||||
max_iterations: int,
|
|
||||||
memory: Optional[BaseChatMemory] = None,
|
|
||||||
) -> Union[AgentExecutor, Callable]:
|
|
||||||
agent = AgentType(agent)
|
|
||||||
if memory:
|
|
||||||
return initialize_agent(
|
|
||||||
tools=tools,
|
|
||||||
llm=llm,
|
|
||||||
agent=agent,
|
|
||||||
memory=memory,
|
|
||||||
return_intermediate_steps=True,
|
|
||||||
handle_parsing_errors=True,
|
|
||||||
max_iterations=max_iterations,
|
|
||||||
)
|
|
||||||
return initialize_agent(
|
|
||||||
tools=tools,
|
|
||||||
llm=llm,
|
|
||||||
agent=agent,
|
|
||||||
return_intermediate_steps=True,
|
|
||||||
handle_parsing_errors=True,
|
|
||||||
max_iterations=max_iterations,
|
|
||||||
)
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
from langchain.agents import AgentExecutor
|
from langchain.agents import AgentExecutor
|
||||||
|
from langchain_community.agent_toolkits import create_json_agent
|
||||||
from langchain_community.agent_toolkits.json.toolkit import JsonToolkit
|
from langchain_community.agent_toolkits.json.toolkit import JsonToolkit
|
||||||
|
|
||||||
from langflow.field_typing import (
|
from langflow.custom import CustomComponent
|
||||||
BaseLanguageModel,
|
from langflow.field_typing import BaseLanguageModel
|
||||||
)
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langchain_community.agent_toolkits import create_json_agent
|
|
||||||
|
|
||||||
|
|
||||||
class JsonAgentComponent(CustomComponent):
|
class JsonAgentComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from langchain.agents.agent import AgentExecutor
|
|
||||||
from langchain.agents.agent_toolkits.conversational_retrieval.openai_functions import _get_default_system_message
|
|
||||||
from langchain.agents.openai_functions_agent.base import OpenAIFunctionsAgent
|
|
||||||
from langchain.memory.token_buffer import ConversationTokenBufferMemory
|
|
||||||
from langchain_openai import ChatOpenAI
|
|
||||||
|
|
||||||
from langflow.field_typing.range_spec import RangeSpec
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from pydantic.v1 import SecretStr
|
|
||||||
from langchain_core.memory import BaseMemory
|
|
||||||
from langchain_core.prompts import MessagesPlaceholder, SystemMessagePromptTemplate
|
|
||||||
from langchain_core.tools import Tool
|
|
||||||
|
|
||||||
|
|
||||||
class ConversationalAgent(CustomComponent):
|
|
||||||
display_name: str = "OpenAI Conversational Agent"
|
|
||||||
description: str = "Conversational Agent that can use OpenAI's function calling API"
|
|
||||||
icon = "OpenAI"
|
|
||||||
|
|
||||||
def build_config(self):
|
|
||||||
openai_function_models = [
|
|
||||||
"gpt-4-turbo-preview",
|
|
||||||
"gpt-4-0125-preview",
|
|
||||||
"gpt-4-1106-preview",
|
|
||||||
"gpt-4-vision-preview",
|
|
||||||
"gpt-3.5-turbo-0125",
|
|
||||||
"gpt-3.5-turbo-1106",
|
|
||||||
]
|
|
||||||
return {
|
|
||||||
"tools": {"display_name": "Tools"},
|
|
||||||
"memory": {"display_name": "Memory"},
|
|
||||||
"system_message": {"display_name": "System Message"},
|
|
||||||
"max_token_limit": {"display_name": "Max Token Limit"},
|
|
||||||
"model_name": {
|
|
||||||
"display_name": "Model Name",
|
|
||||||
"options": openai_function_models,
|
|
||||||
"value": openai_function_models[0],
|
|
||||||
},
|
|
||||||
"code": {"show": False},
|
|
||||||
"temperature": {
|
|
||||||
"display_name": "Temperature",
|
|
||||||
"value": 0.2,
|
|
||||||
"rangeSpec": RangeSpec(min=0, max=2, step=0.1),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def build(
|
|
||||||
self,
|
|
||||||
model_name: str,
|
|
||||||
openai_api_key: str,
|
|
||||||
tools: List[Tool],
|
|
||||||
openai_api_base: Optional[str] = None,
|
|
||||||
memory: Optional[BaseMemory] = None,
|
|
||||||
system_message: Optional[SystemMessagePromptTemplate] = None,
|
|
||||||
max_token_limit: int = 2000,
|
|
||||||
temperature: float = 0.9,
|
|
||||||
) -> AgentExecutor:
|
|
||||||
if openai_api_key:
|
|
||||||
api_key = SecretStr(openai_api_key)
|
|
||||||
else:
|
|
||||||
api_key = None
|
|
||||||
|
|
||||||
llm = ChatOpenAI(
|
|
||||||
model=model_name,
|
|
||||||
api_key=api_key,
|
|
||||||
base_url=openai_api_base,
|
|
||||||
max_tokens=max_token_limit,
|
|
||||||
temperature=temperature,
|
|
||||||
)
|
|
||||||
if not memory:
|
|
||||||
memory_key = "chat_history"
|
|
||||||
memory = ConversationTokenBufferMemory(
|
|
||||||
memory_key=memory_key,
|
|
||||||
return_messages=True,
|
|
||||||
output_key="output",
|
|
||||||
llm=llm,
|
|
||||||
max_token_limit=max_token_limit,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
memory_key = memory.memory_key # type: ignore
|
|
||||||
|
|
||||||
_system_message = system_message or _get_default_system_message()
|
|
||||||
prompt = OpenAIFunctionsAgent.create_prompt(
|
|
||||||
system_message=_system_message, # type: ignore
|
|
||||||
extra_prompt_messages=[MessagesPlaceholder(variable_name=memory_key)],
|
|
||||||
)
|
|
||||||
agent = OpenAIFunctionsAgent(
|
|
||||||
llm=llm,
|
|
||||||
tools=tools,
|
|
||||||
prompt=prompt, # type: ignore
|
|
||||||
)
|
|
||||||
return AgentExecutor(
|
|
||||||
agent=agent,
|
|
||||||
tools=tools, # type: ignore
|
|
||||||
memory=memory,
|
|
||||||
verbose=True,
|
|
||||||
return_intermediate_steps=True,
|
|
||||||
handle_parsing_errors=True,
|
|
||||||
)
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
from typing import Callable, Union
|
from typing import Callable, Union
|
||||||
|
|
||||||
from langchain.agents import AgentExecutor
|
from langchain.agents import AgentExecutor
|
||||||
from langchain_community.utilities import SQLDatabase
|
|
||||||
from langchain_community.agent_toolkits import SQLDatabaseToolkit
|
from langchain_community.agent_toolkits import SQLDatabaseToolkit
|
||||||
from langchain_community.agent_toolkits.sql.base import create_sql_agent
|
from langchain_community.agent_toolkits.sql.base import create_sql_agent
|
||||||
|
from langchain_community.utilities import SQLDatabase
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel
|
from langflow.field_typing import BaseLanguageModel
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class SQLAgentComponent(CustomComponent):
|
class SQLAgentComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ from typing import Callable, Union
|
||||||
from langchain.agents import AgentExecutor, create_vectorstore_agent
|
from langchain.agents import AgentExecutor, create_vectorstore_agent
|
||||||
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreToolkit
|
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreToolkit
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel
|
from langflow.field_typing import BaseLanguageModel
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class VectorStoreAgentComponent(CustomComponent):
|
class VectorStoreAgentComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from langchain.agents import create_vectorstore_router_agent
|
||||||
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreRouterToolkit
|
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreRouterToolkit
|
||||||
from langchain_core.language_models.base import BaseLanguageModel
|
from langchain_core.language_models.base import BaseLanguageModel
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class VectorStoreRouterAgentComponent(CustomComponent):
|
class VectorStoreRouterAgentComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
from .AgentInitializer import AgentInitializerComponent
|
|
||||||
from .CSVAgent import CSVAgentComponent
|
from .CSVAgent import CSVAgentComponent
|
||||||
from .JsonAgent import JsonAgentComponent
|
from .JsonAgent import JsonAgentComponent
|
||||||
from .OpenAIConversationalAgent import ConversationalAgent
|
|
||||||
from .SQLAgent import SQLAgentComponent
|
from .SQLAgent import SQLAgentComponent
|
||||||
from .VectorStoreAgent import VectorStoreAgentComponent
|
from .VectorStoreAgent import VectorStoreAgentComponent
|
||||||
from .VectorStoreRouterAgent import VectorStoreRouterAgentComponent
|
from .VectorStoreRouterAgent import VectorStoreRouterAgentComponent
|
||||||
from .XMLAgent import XMLAgentComponent
|
from .XMLAgent import XMLAgentComponent
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"AgentInitializerComponent",
|
|
||||||
"CSVAgentComponent",
|
"CSVAgentComponent",
|
||||||
"JsonAgentComponent",
|
"JsonAgentComponent",
|
||||||
"ConversationalAgent",
|
|
||||||
"SQLAgentComponent",
|
"SQLAgentComponent",
|
||||||
"VectorStoreAgentComponent",
|
"VectorStoreAgentComponent",
|
||||||
"VectorStoreRouterAgentComponent",
|
"VectorStoreRouterAgentComponent",
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ from typing import Optional
|
||||||
|
|
||||||
from langchain.chains import ConversationChain
|
from langchain.chains import ConversationChain
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, BaseMemory, Text
|
from langflow.field_typing import BaseLanguageModel, BaseMemory, Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class ConversationChainComponent(CustomComponent):
|
class ConversationChainComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langchain.chains.llm import LLMChain
|
from langchain.chains.llm import LLMChain
|
||||||
|
|
||||||
from langflow.field_typing import BaseLanguageModel, BaseMemory, Text
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langchain_core.prompts import PromptTemplate
|
from langchain_core.prompts import PromptTemplate
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.field_typing import BaseLanguageModel, BaseMemory, Text
|
||||||
|
|
||||||
|
|
||||||
class LLMChainComponent(CustomComponent):
|
class LLMChainComponent(CustomComponent):
|
||||||
display_name = "LLMChain"
|
display_name = "LLMChain"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from langchain.chains import LLMCheckerChain
|
from langchain.chains import LLMCheckerChain
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, Text
|
from langflow.field_typing import BaseLanguageModel, Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class LLMCheckerChainComponent(CustomComponent):
|
class LLMCheckerChainComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ from typing import Optional
|
||||||
|
|
||||||
from langchain.chains import LLMChain, LLMMathChain
|
from langchain.chains import LLMChain, LLMMathChain
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, BaseMemory, Text
|
from langflow.field_typing import BaseLanguageModel, BaseMemory, Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class LLMMathChainComponent(CustomComponent):
|
class LLMMathChainComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ from typing import Optional
|
||||||
from langchain.chains.retrieval_qa.base import RetrievalQA
|
from langchain.chains.retrieval_qa.base import RetrievalQA
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, BaseMemory, BaseRetriever, Text
|
from langflow.field_typing import BaseLanguageModel, BaseMemory, BaseRetriever, Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema.schema import Record
|
from langflow.schema.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ from typing import Optional
|
||||||
from langchain.chains import RetrievalQAWithSourcesChain
|
from langchain.chains import RetrievalQAWithSourcesChain
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, BaseMemory, BaseRetriever, Text
|
from langflow.field_typing import BaseLanguageModel, BaseMemory, BaseRetriever, Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class RetrievalQAWithSourcesChainComponent(CustomComponent):
|
class RetrievalQAWithSourcesChainComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ from langchain_community.utilities.sql_database import SQLDatabase
|
||||||
from langchain_core.prompts import PromptTemplate
|
from langchain_core.prompts import PromptTemplate
|
||||||
from langchain_core.runnables import Runnable
|
from langchain_core.runnables import Runnable
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, Text
|
from langflow.field_typing import BaseLanguageModel, Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class SQLGeneratorComponent(CustomComponent):
|
class SQLGeneratorComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ import json
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from langflow.base.data.utils import parallel_load_records, parse_text_file_to_record, retrieve_file_paths
|
from langflow.base.data.utils import parallel_load_records, parse_text_file_to_record, retrieve_file_paths
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from pathlib import Path
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from langflow.base.data.utils import TEXT_FILE_TYPES, parse_text_file_to_record
|
from langflow.base.data.utils import TEXT_FILE_TYPES, parse_text_file_to_record
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from langchain_community.document_loaders.web_base import WebBaseLoader
|
from langchain_community.document_loaders.web_base import WebBaseLoader
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from langchain_community.embeddings import BedrockEmbeddings
|
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langchain_community.embeddings import BedrockEmbeddings
|
||||||
from langchain_core.embeddings import Embeddings
|
from langchain_core.embeddings import Embeddings
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class AmazonBedrockEmeddingsComponent(CustomComponent):
|
class AmazonBedrockEmeddingsComponent(CustomComponent):
|
||||||
display_name: str = "Amazon Bedrock Embeddings"
|
display_name: str = "Amazon Bedrock Embeddings"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langchain_core.embeddings import Embeddings
|
from langchain_core.embeddings import Embeddings
|
||||||
from langchain_openai import AzureOpenAIEmbeddings
|
from langchain_openai import AzureOpenAIEmbeddings
|
||||||
from pydantic.v1 import SecretStr
|
from pydantic.v1 import SecretStr
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class AzureOpenAIEmbeddingsComponent(CustomComponent):
|
class AzureOpenAIEmbeddingsComponent(CustomComponent):
|
||||||
display_name: str = "Azure OpenAI Embeddings"
|
display_name: str = "Azure OpenAI Embeddings"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import Dict, Optional
|
||||||
|
|
||||||
from langchain_community.embeddings.huggingface import HuggingFaceEmbeddings
|
from langchain_community.embeddings.huggingface import HuggingFaceEmbeddings
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class HuggingFaceEmbeddingsComponent(CustomComponent):
|
class HuggingFaceEmbeddingsComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from typing import Dict, Optional
|
||||||
from langchain_community.embeddings.huggingface import HuggingFaceInferenceAPIEmbeddings
|
from langchain_community.embeddings.huggingface import HuggingFaceInferenceAPIEmbeddings
|
||||||
from pydantic.v1.types import SecretStr
|
from pydantic.v1.types import SecretStr
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class HuggingFaceInferenceAPIEmbeddingsComponent(CustomComponent):
|
class HuggingFaceInferenceAPIEmbeddingsComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
from langchain_mistralai.embeddings import MistralAIEmbeddings
|
||||||
from pydantic.v1 import SecretStr
|
from pydantic.v1 import SecretStr
|
||||||
|
|
||||||
from langchain_mistralai.embeddings import MistralAIEmbeddings
|
from langflow.custom import CustomComponent
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.field_typing import Embeddings
|
from langflow.field_typing import Embeddings
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from langchain_community.embeddings import OllamaEmbeddings
|
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langchain_community.embeddings import OllamaEmbeddings
|
||||||
from langchain_core.embeddings import Embeddings
|
from langchain_core.embeddings import Embeddings
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class OllamaEmbeddingsComponent(CustomComponent):
|
class OllamaEmbeddingsComponent(CustomComponent):
|
||||||
display_name: str = "Ollama Embeddings"
|
display_name: str = "Ollama Embeddings"
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
from langchain_openai.embeddings.base import OpenAIEmbeddings
|
from langchain_openai.embeddings.base import OpenAIEmbeddings
|
||||||
from pydantic.v1 import SecretStr
|
from pydantic.v1 import SecretStr
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Embeddings, NestedDict
|
from langflow.field_typing import Embeddings, NestedDict
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class OpenAIEmbeddingsComponent(CustomComponent):
|
class OpenAIEmbeddingsComponent(CustomComponent):
|
||||||
|
|
@ -94,7 +94,6 @@ class OpenAIEmbeddingsComponent(CustomComponent):
|
||||||
allowed_special: List[str] = [],
|
allowed_special: List[str] = [],
|
||||||
disallowed_special: List[str] = ["all"],
|
disallowed_special: List[str] = ["all"],
|
||||||
chunk_size: int = 1000,
|
chunk_size: int = 1000,
|
||||||
client: Optional[Any] = None,
|
|
||||||
deployment: str = "text-embedding-ada-002",
|
deployment: str = "text-embedding-ada-002",
|
||||||
embedding_ctx_length: int = 8191,
|
embedding_ctx_length: int = 8191,
|
||||||
max_retries: int = 6,
|
max_retries: int = 6,
|
||||||
|
|
@ -126,7 +125,6 @@ class OpenAIEmbeddingsComponent(CustomComponent):
|
||||||
allowed_special=set(allowed_special),
|
allowed_special=set(allowed_special),
|
||||||
disallowed_special="all",
|
disallowed_special="all",
|
||||||
chunk_size=chunk_size,
|
chunk_size=chunk_size,
|
||||||
client=client,
|
|
||||||
deployment=deployment,
|
deployment=deployment,
|
||||||
embedding_ctx_length=embedding_ctx_length,
|
embedding_ctx_length=embedding_ctx_length,
|
||||||
max_retries=max_retries,
|
max_retries=max_retries,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import List, Optional
|
||||||
|
|
||||||
from langchain_google_vertexai import VertexAIEmbeddings
|
from langchain_google_vertexai import VertexAIEmbeddings
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class VertexAIEmbeddingsComponent(CustomComponent):
|
class VertexAIEmbeddingsComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.memory import delete_messages, get_messages
|
from langflow.memory import delete_messages, get_messages
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema import Record
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
class PassComponent(CustomComponent):
|
class PassComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.custom.utils import get_function
|
||||||
from langflow.field_typing import Code
|
from langflow.field_typing import Code
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.interface.custom.utils import get_function
|
|
||||||
|
|
||||||
|
|
||||||
class PythonFunctionComponent(CustomComponent):
|
class PythonFunctionComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from langchain_core.runnables import Runnable
|
from langchain_core.runnables import Runnable
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class RunnableExecComponent(CustomComponent):
|
class RunnableExecComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from langchain_community.tools.sql_database.tool import QuerySQLDataBaseTool
|
from langchain_community.tools.sql_database.tool import QuerySQLDataBaseTool
|
||||||
from langchain_community.utilities import SQLDatabase
|
from langchain_community.utilities import SQLDatabase
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class SQLExecutorComponent(CustomComponent):
|
class SQLExecutorComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
from langflow.utils.util import unescape_string
|
from langflow.utils.util import unescape_string
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.memory import get_messages, store_message
|
from langflow.memory import get_messages, store_message
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
class TextOperatorComponent(CustomComponent):
|
class TextOperatorComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# from langflow.field_typing import Data
|
# from langflow.field_typing import Data
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class Component(CustomComponent):
|
class Component(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import List
|
||||||
|
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import uuid
|
import uuid
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class UUIDGeneratorComponent(CustomComponent):
|
class UUIDGeneratorComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.memory import get_messages
|
from langflow.memory import get_messages
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
from langflow.helpers.record import records_to_text
|
from langflow.helpers.record import records_to_text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from langchain_core.prompts import PromptTemplate
|
from langchain_core.prompts import PromptTemplate
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Prompt, TemplateField, Text
|
from langflow.field_typing import Prompt, TemplateField, Text
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class PromptComponent(CustomComponent):
|
class PromptComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# We need to make sure this class is importable from the context where this code will be running.
|
# We need to make sure this class is importable from the context where this code will be running.
|
||||||
from langchain_community.utilities.bing_search import BingSearchAPIWrapper
|
from langchain_community.utilities.bing_search import BingSearchAPIWrapper
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class BingSearchAPIWrapperComponent(CustomComponent):
|
class BingSearchAPIWrapperComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import Callable, Union
|
||||||
|
|
||||||
from langchain_community.utilities.google_search import GoogleSearchAPIWrapper
|
from langchain_community.utilities.google_search import GoogleSearchAPIWrapper
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class GoogleSearchAPIWrapperComponent(CustomComponent):
|
class GoogleSearchAPIWrapperComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import Dict
|
||||||
# If this class does not exist, you would need to create it or import the appropriate class from another module
|
# If this class does not exist, you would need to create it or import the appropriate class from another module
|
||||||
from langchain_community.utilities.google_serper import GoogleSerperAPIWrapper
|
from langchain_community.utilities.google_serper import GoogleSerperAPIWrapper
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class GoogleSerperAPIWrapperComponent(CustomComponent):
|
class GoogleSerperAPIWrapperComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.services.database.models.base import orjson_dumps
|
from langflow.services.database.models.base import orjson_dumps
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from langchain_experimental.sql.base import SQLDatabase
|
from langchain_experimental.sql.base import SQLDatabase
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class SQLDatabaseComponent(CustomComponent):
|
class SQLDatabaseComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import Dict, Optional
|
||||||
|
|
||||||
from langchain_community.utilities.searx_search import SearxSearchWrapper
|
from langchain_community.utilities.searx_search import SearxSearchWrapper
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class SearxSearchWrapperComponent(CustomComponent):
|
class SearxSearchWrapperComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import Callable, Union
|
||||||
|
|
||||||
from langchain_community.utilities.serpapi import SerpAPIWrapper
|
from langchain_community.utilities.serpapi import SerpAPIWrapper
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class SerpAPIWrapperComponent(CustomComponent):
|
class SerpAPIWrapperComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import Callable, Union
|
||||||
|
|
||||||
from langchain_community.utilities.wikipedia import WikipediaAPIWrapper
|
from langchain_community.utilities.wikipedia import WikipediaAPIWrapper
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
# Assuming WikipediaAPIWrapper is a class that needs to be imported.
|
# Assuming WikipediaAPIWrapper is a class that needs to be imported.
|
||||||
# The import statement is not included as it is not provided in the JSON
|
# The import statement is not included as it is not provided in the JSON
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import Callable, Union
|
||||||
|
|
||||||
from langchain_community.utilities.wolfram_alpha import WolframAlphaAPIWrapper
|
from langchain_community.utilities.wolfram_alpha import WolframAlphaAPIWrapper
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
# Since all the fields in the JSON have show=False, we will only create a basic component
|
# Since all the fields in the JSON have show=False, we will only create a basic component
|
||||||
# without any configurable fields.
|
# without any configurable fields.
|
||||||
|
|
|
||||||
|
|
@ -116,19 +116,18 @@ class ZepMessageReaderComponent(BaseMemoryComponent):
|
||||||
url: Optional[Text] = None,
|
url: Optional[Text] = None,
|
||||||
api_key: Optional[Text] = None,
|
api_key: Optional[Text] = None,
|
||||||
query: Optional[Text] = None,
|
query: Optional[Text] = None,
|
||||||
search_scope: SearchScope = SearchScope.messages,
|
search_scope: str = SearchScope.messages,
|
||||||
search_type: SearchType = SearchType.similarity,
|
search_type: str = SearchType.similarity,
|
||||||
limit: Optional[int] = None,
|
limit: Optional[int] = None,
|
||||||
) -> list[Record]:
|
) -> list[Record]:
|
||||||
try:
|
try:
|
||||||
from zep_python import ZepClient
|
|
||||||
from zep_python.langchain import ZepChatMessageHistory
|
|
||||||
|
|
||||||
# Monkeypatch API_BASE_PATH to
|
# Monkeypatch API_BASE_PATH to
|
||||||
# avoid 404
|
# avoid 404
|
||||||
# This is a workaround for the local Zep instance
|
# This is a workaround for the local Zep instance
|
||||||
# cloud Zep works with v2
|
# cloud Zep works with v2
|
||||||
import zep_python.zep_client
|
import zep_python.zep_client
|
||||||
|
from zep_python import ZepClient
|
||||||
|
from zep_python.langchain import ZepChatMessageHistory
|
||||||
|
|
||||||
zep_python.zep_client.API_BASE_PATH = api_base_path
|
zep_python.zep_client.API_BASE_PATH = api_base_path
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from langflow.field_typing import BaseLanguageModel
|
|
||||||
from langchain_community.llms.bedrock import Bedrock
|
from langchain_community.llms.bedrock import Bedrock
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.field_typing import BaseLanguageModel
|
||||||
|
|
||||||
|
|
||||||
class AmazonBedrockComponent(CustomComponent):
|
class AmazonBedrockComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langchain_anthropic import ChatAnthropic
|
from langchain_anthropic import ChatAnthropic
|
||||||
|
from langchain_core.language_models import BaseLanguageModel
|
||||||
from pydantic.v1 import SecretStr
|
from pydantic.v1 import SecretStr
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langchain_core.language_models import BaseLanguageModel
|
|
||||||
|
|
||||||
|
|
||||||
class ChatAntropicSpecsComponent(CustomComponent):
|
class ChatAntropicSpecsComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langchain_core.language_models import BaseLanguageModel
|
from langchain_core.language_models import BaseLanguageModel
|
||||||
from langchain_openai import AzureChatOpenAI
|
from langchain_openai import AzureChatOpenAI
|
||||||
from pydantic.v1 import SecretStr
|
from pydantic.v1 import SecretStr
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class AzureChatOpenAISpecsComponent(CustomComponent):
|
class AzureChatOpenAISpecsComponent(CustomComponent):
|
||||||
display_name: str = "AzureChatOpenAI"
|
display_name: str = "AzureChatOpenAI"
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langchain_community.chat_models.baidu_qianfan_endpoint import QianfanChatEndpoint
|
from langchain_community.chat_models.baidu_qianfan_endpoint import QianfanChatEndpoint
|
||||||
|
|
||||||
from pydantic.v1 import SecretStr
|
from pydantic.v1 import SecretStr
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel
|
from langflow.field_typing import BaseLanguageModel
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class QianfanChatEndpointComponent(CustomComponent):
|
class QianfanChatEndpointComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import Optional
|
||||||
|
|
||||||
from langchain_community.llms.baidu_qianfan_endpoint import QianfanLLMEndpoint
|
from langchain_community.llms.baidu_qianfan_endpoint import QianfanLLMEndpoint
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel
|
from langflow.field_typing import BaseLanguageModel
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from langchain_community.chat_models.litellm import ChatLiteLLM, ChatLiteLLMException
|
from langchain_community.chat_models.litellm import ChatLiteLLM, ChatLiteLLMException
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel
|
from langflow.field_typing import BaseLanguageModel
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class ChatLiteLLMComponent(CustomComponent):
|
class ChatLiteLLMComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
# from langchain_community.chat_models import ChatOllama
|
# from langchain_community.chat_models import ChatOllama
|
||||||
from langchain_community.chat_models import ChatOllama
|
from langchain_community.chat_models import ChatOllama
|
||||||
from langchain_core.language_models.chat_models import BaseChatModel
|
from langchain_core.language_models.chat_models import BaseChatModel
|
||||||
|
|
||||||
# from langchain.chat_models import ChatOllama
|
# from langchain.chat_models import ChatOllama
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
# from langchain.callbacks.manager import CallbackManager
|
# from langchain.callbacks.manager import CallbackManager
|
||||||
|
|
||||||
|
|
@ -182,7 +182,7 @@ class ChatOllamaComponent(CustomComponent):
|
||||||
num_ctx: Optional[int] = None,
|
num_ctx: Optional[int] = None,
|
||||||
num_gpu: Optional[int] = None,
|
num_gpu: Optional[int] = None,
|
||||||
format: Optional[str] = None,
|
format: Optional[str] = None,
|
||||||
metadata: Optional[Dict[str, Any]] = None,
|
metadata: Optional[Dict] = None,
|
||||||
num_thread: Optional[int] = None,
|
num_thread: Optional[int] = None,
|
||||||
repeat_penalty: Optional[float] = None,
|
repeat_penalty: Optional[float] = None,
|
||||||
stop: Optional[List[str]] = None,
|
stop: Optional[List[str]] = None,
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,9 @@ from typing import Optional
|
||||||
from langchain_openai import ChatOpenAI
|
from langchain_openai import ChatOpenAI
|
||||||
from pydantic.v1 import SecretStr
|
from pydantic.v1 import SecretStr
|
||||||
|
|
||||||
|
|
||||||
from langflow.base.models.openai_constants import MODEL_NAMES
|
from langflow.base.models.openai_constants import MODEL_NAMES
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, NestedDict
|
from langflow.field_typing import BaseLanguageModel, NestedDict
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class ChatOpenAIComponent(CustomComponent):
|
class ChatOpenAIComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
from typing import List, Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langchain_community.chat_models.vertexai import ChatVertexAI
|
from langchain_community.chat_models.vertexai import ChatVertexAI
|
||||||
from langchain_core.messages.base import BaseMessage
|
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel
|
from langflow.field_typing import BaseLanguageModel
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class ChatVertexAIComponent(CustomComponent):
|
class ChatVertexAIComponent(CustomComponent):
|
||||||
|
|
@ -65,7 +64,6 @@ class ChatVertexAIComponent(CustomComponent):
|
||||||
self,
|
self,
|
||||||
credentials: Optional[str],
|
credentials: Optional[str],
|
||||||
project: str,
|
project: str,
|
||||||
examples: Optional[List[BaseMessage]] = [],
|
|
||||||
location: str = "us-central1",
|
location: str = "us-central1",
|
||||||
max_output_tokens: int = 128,
|
max_output_tokens: int = 128,
|
||||||
model_name: str = "chat-bison",
|
model_name: str = "chat-bison",
|
||||||
|
|
@ -76,7 +74,6 @@ class ChatVertexAIComponent(CustomComponent):
|
||||||
) -> BaseLanguageModel:
|
) -> BaseLanguageModel:
|
||||||
return ChatVertexAI(
|
return ChatVertexAI(
|
||||||
credentials=credentials,
|
credentials=credentials,
|
||||||
examples=examples,
|
|
||||||
location=location,
|
location=location,
|
||||||
max_output_tokens=max_output_tokens,
|
max_output_tokens=max_output_tokens,
|
||||||
model_name=model_name,
|
model_name=model_name,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from langchain_community.llms.cohere import Cohere
|
from langchain_community.llms.cohere import Cohere
|
||||||
from langchain_core.language_models.base import BaseLanguageModel
|
from langchain_core.language_models.base import BaseLanguageModel
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class CohereComponent(CustomComponent):
|
class CohereComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ from typing import Optional
|
||||||
from langchain_google_genai import ChatGoogleGenerativeAI # type: ignore
|
from langchain_google_genai import ChatGoogleGenerativeAI # type: ignore
|
||||||
from pydantic.v1.types import SecretStr
|
from pydantic.v1.types import SecretStr
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, RangeSpec
|
from langflow.field_typing import BaseLanguageModel, RangeSpec
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class GoogleGenerativeAIComponent(CustomComponent):
|
class GoogleGenerativeAIComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langflow.field_typing import BaseLanguageModel
|
|
||||||
from langchain_community.llms.huggingface_endpoint import HuggingFaceEndpoint
|
from langchain_community.llms.huggingface_endpoint import HuggingFaceEndpoint
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.field_typing import BaseLanguageModel
|
||||||
|
|
||||||
|
|
||||||
class HuggingFaceEndpointsComponent(CustomComponent):
|
class HuggingFaceEndpointsComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from langflow.field_typing import BaseLanguageModel
|
|
||||||
from langchain_community.llms.ollama import Ollama
|
from langchain_community.llms.ollama import Ollama
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.field_typing import BaseLanguageModel
|
||||||
|
|
||||||
|
|
||||||
class OllamaLLM(CustomComponent):
|
class OllamaLLM(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
from langflow.field_typing import BaseLanguageModel
|
|
||||||
from langchain_community.llms.vertexai import VertexAI
|
from langchain_community.llms.vertexai import VertexAI
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.field_typing import BaseLanguageModel
|
||||||
|
|
||||||
|
|
||||||
class VertexAIComponent(CustomComponent):
|
class VertexAIComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
# from langchain_community.chat_models import ChatOllama
|
# from langchain_community.chat_models import ChatOllama
|
||||||
from langchain_community.chat_models import ChatOllama
|
from langchain_community.chat_models import ChatOllama
|
||||||
|
|
@ -229,7 +229,7 @@ class ChatOllamaComponent(LCModelComponent):
|
||||||
num_ctx: Optional[int] = None,
|
num_ctx: Optional[int] = None,
|
||||||
num_gpu: Optional[int] = None,
|
num_gpu: Optional[int] = None,
|
||||||
format: Optional[str] = None,
|
format: Optional[str] = None,
|
||||||
metadata: Optional[Dict[str, Any]] = None,
|
metadata: Optional[Dict] = None,
|
||||||
num_thread: Optional[int] = None,
|
num_thread: Optional[int] = None,
|
||||||
repeat_penalty: Optional[float] = None,
|
repeat_penalty: Optional[float] = None,
|
||||||
stop: Optional[List[str]] = None,
|
stop: Optional[List[str]] = None,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
from typing import List, Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langchain_core.messages.base import BaseMessage
|
|
||||||
|
|
||||||
from langflow.base.constants import STREAM_INFO_TEXT
|
from langflow.base.constants import STREAM_INFO_TEXT
|
||||||
from langflow.base.models.model import LCModelComponent
|
from langflow.base.models.model import LCModelComponent
|
||||||
|
|
@ -93,7 +92,6 @@ class ChatVertexAIComponent(LCModelComponent):
|
||||||
input_value: Text,
|
input_value: Text,
|
||||||
credentials: Optional[str],
|
credentials: Optional[str],
|
||||||
project: str,
|
project: str,
|
||||||
examples: Optional[List[BaseMessage]] = [],
|
|
||||||
location: str = "us-central1",
|
location: str = "us-central1",
|
||||||
max_output_tokens: int = 128,
|
max_output_tokens: int = 128,
|
||||||
model_name: str = "chat-bison",
|
model_name: str = "chat-bison",
|
||||||
|
|
@ -112,7 +110,6 @@ class ChatVertexAIComponent(LCModelComponent):
|
||||||
)
|
)
|
||||||
output = ChatVertexAI(
|
output = ChatVertexAI(
|
||||||
credentials=credentials,
|
credentials=credentials,
|
||||||
examples=examples,
|
|
||||||
location=location,
|
location=location,
|
||||||
max_output_tokens=max_output_tokens,
|
max_output_tokens=max_output_tokens,
|
||||||
model_name=model_name,
|
model_name=model_name,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from langchain_community.retrievers import AmazonKendraRetriever
|
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langchain_community.retrievers import AmazonKendraRetriever
|
||||||
from langchain_core.retrievers import BaseRetriever
|
from langchain_core.retrievers import BaseRetriever
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class AmazonKendraRetrieverComponent(CustomComponent):
|
class AmazonKendraRetrieverComponent(CustomComponent):
|
||||||
display_name: str = "Amazon Kendra Retriever"
|
display_name: str = "Amazon Kendra Retriever"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from langchain_community.retrievers import MetalRetriever
|
from langchain_community.retrievers import MetalRetriever
|
||||||
|
from langchain_core.retrievers import BaseRetriever
|
||||||
from metal_sdk.metal import Metal # type: ignore
|
from metal_sdk.metal import Metal # type: ignore
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langchain_core.retrievers import BaseRetriever
|
|
||||||
|
|
||||||
|
|
||||||
class MetalRetrieverComponent(CustomComponent):
|
class MetalRetrieverComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ from typing import Optional
|
||||||
|
|
||||||
from langchain.retrievers import MultiQueryRetriever
|
from langchain.retrievers import MultiQueryRetriever
|
||||||
|
|
||||||
from langflow.field_typing import BaseRetriever, PromptTemplate, BaseLanguageModel
|
from langflow.custom import CustomComponent
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.field_typing import BaseLanguageModel, BaseRetriever, PromptTemplate, Text
|
||||||
|
|
||||||
|
|
||||||
class MultiQueryRetrieverComponent(CustomComponent):
|
class MultiQueryRetrieverComponent(CustomComponent):
|
||||||
|
|
@ -41,10 +41,13 @@ class MultiQueryRetrieverComponent(CustomComponent):
|
||||||
self,
|
self,
|
||||||
llm: BaseLanguageModel,
|
llm: BaseLanguageModel,
|
||||||
retriever: BaseRetriever,
|
retriever: BaseRetriever,
|
||||||
prompt: Optional[PromptTemplate] = None,
|
prompt: Optional[Text] = None,
|
||||||
parser_key: str = "lines",
|
parser_key: str = "lines",
|
||||||
) -> MultiQueryRetriever:
|
) -> MultiQueryRetriever:
|
||||||
if not prompt:
|
if not prompt:
|
||||||
return MultiQueryRetriever.from_llm(llm=llm, retriever=retriever, parser_key=parser_key)
|
return MultiQueryRetriever.from_llm(llm=llm, retriever=retriever, parser_key=parser_key)
|
||||||
else:
|
else:
|
||||||
return MultiQueryRetriever.from_llm(llm=llm, retriever=retriever, prompt=prompt, parser_key=parser_key)
|
prompt_template = PromptTemplate.from_template(prompt)
|
||||||
|
return MultiQueryRetriever.from_llm(
|
||||||
|
llm=llm, retriever=retriever, prompt=prompt_template, parser_key=parser_key
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
import json
|
import json
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from langchain.chains.query_constructor.base import AttributeInfo
|
from langchain.chains.query_constructor.base import AttributeInfo
|
||||||
from langchain.retrievers.self_query.base import SelfQueryRetriever
|
from langchain.retrievers.self_query.base import SelfQueryRetriever
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langchain_core.language_models import BaseLanguageModel
|
from langchain_core.language_models import BaseLanguageModel
|
||||||
from langchain_core.retrievers import BaseRetriever
|
from langchain_core.retrievers import BaseRetriever
|
||||||
from langchain_core.vectorstores import VectorStore
|
from langchain_core.vectorstores import VectorStore
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class VectaraSelfQueryRetriverComponent(CustomComponent):
|
class VectaraSelfQueryRetriverComponent(CustomComponent):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from langchain_core.vectorstores import VectorStoreRetriever
|
from langchain_core.vectorstores import VectorStoreRetriever
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import VectorStore
|
from langflow.field_typing import VectorStore
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class VectoStoreRetrieverComponent(CustomComponent):
|
class VectoStoreRetrieverComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langchain_text_splitters import CharacterTextSplitter
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema.schema import Record
|
from langflow.schema.schema import Record
|
||||||
from langflow.utils.util import unescape_string
|
from langflow.utils.util import unescape_string
|
||||||
from langchain_text_splitters import CharacterTextSplitter
|
|
||||||
|
|
||||||
|
|
||||||
class CharacterTextSplitterComponent(CustomComponent):
|
class CharacterTextSplitterComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema.schema import Record
|
|
||||||
from langchain_text_splitters import Language, RecursiveCharacterTextSplitter
|
from langchain_text_splitters import Language, RecursiveCharacterTextSplitter
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.schema.schema import Record
|
||||||
|
|
||||||
|
|
||||||
class LanguageRecursiveTextSplitterComponent(CustomComponent):
|
class LanguageRecursiveTextSplitterComponent(CustomComponent):
|
||||||
display_name: str = "Language Recursive Text Splitter"
|
display_name: str = "Language Recursive Text Splitter"
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from langchain_core.documents import Document
|
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langchain_core.documents import Document
|
||||||
|
from langchain_text_splitters import RecursiveCharacterTextSplitter
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
from langflow.utils.util import build_loader_repr_from_records, unescape_string
|
from langflow.utils.util import build_loader_repr_from_records, unescape_string
|
||||||
from langchain_text_splitters import RecursiveCharacterTextSplitter
|
|
||||||
|
|
||||||
|
|
||||||
class RecursiveCharacterTextSplitterComponent(CustomComponent):
|
class RecursiveCharacterTextSplitterComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import yaml
|
||||||
from langchain_community.agent_toolkits.json.toolkit import JsonToolkit
|
from langchain_community.agent_toolkits.json.toolkit import JsonToolkit
|
||||||
from langchain_community.tools.json.tool import JsonSpec
|
from langchain_community.tools.json.tool import JsonSpec
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class JsonToolkitComponent(CustomComponent):
|
class JsonToolkitComponent(CustomComponent):
|
||||||
|
|
@ -10,8 +13,17 @@ class JsonToolkitComponent(CustomComponent):
|
||||||
|
|
||||||
def build_config(self):
|
def build_config(self):
|
||||||
return {
|
return {
|
||||||
"spec": {"display_name": "Spec", "type": JsonSpec},
|
"path": {
|
||||||
|
"display_name": "Path",
|
||||||
|
"field_type": "file",
|
||||||
|
"file_types": ["json", "yaml", "yml"],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def build(self, spec: JsonSpec) -> JsonToolkit:
|
def build(self, path: str) -> JsonToolkit:
|
||||||
|
if path.endswith("yaml") or path.endswith("yml"):
|
||||||
|
yaml_dict = yaml.load(open(path, "r"), Loader=yaml.FullLoader)
|
||||||
|
spec = JsonSpec(dict_=yaml_dict)
|
||||||
|
else:
|
||||||
|
spec = JsonSpec.from_file(Path(path))
|
||||||
return JsonToolkit(spec=spec)
|
return JsonToolkit(spec=spec)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
from metaphor_python import Metaphor # type: ignore
|
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langchain_community.agent_toolkits.base import BaseToolkit
|
from langchain_community.agent_toolkits.base import BaseToolkit
|
||||||
from langchain_core.tools import Tool, tool
|
from langchain_core.tools import Tool, tool
|
||||||
|
from metaphor_python import Metaphor # type: ignore
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class MetaphorToolkit(CustomComponent):
|
class MetaphorToolkit(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import yaml
|
||||||
from langchain_community.agent_toolkits.openapi.toolkit import BaseToolkit, OpenAPIToolkit
|
from langchain_community.agent_toolkits.openapi.toolkit import BaseToolkit, OpenAPIToolkit
|
||||||
|
from langchain_community.tools.json.tool import JsonSpec
|
||||||
from langchain_community.utilities.requests import TextRequestsWrapper
|
from langchain_community.utilities.requests import TextRequestsWrapper
|
||||||
|
|
||||||
from langflow.field_typing import AgentExecutor
|
from langflow.custom import CustomComponent
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.field_typing import BaseLanguageModel
|
||||||
|
|
||||||
|
|
||||||
class OpenAPIToolkitComponent(CustomComponent):
|
class OpenAPIToolkitComponent(CustomComponent):
|
||||||
|
|
@ -15,9 +19,16 @@ class OpenAPIToolkitComponent(CustomComponent):
|
||||||
"requests_wrapper": {"display_name": "Text Requests Wrapper"},
|
"requests_wrapper": {"display_name": "Text Requests Wrapper"},
|
||||||
}
|
}
|
||||||
|
|
||||||
def build(
|
def build(self, llm: BaseLanguageModel, path: str, allow_dangerous_requests: bool = False) -> BaseToolkit:
|
||||||
self,
|
if path.endswith("yaml") or path.endswith("yml"):
|
||||||
json_agent: AgentExecutor,
|
yaml_dict = yaml.load(open(path, "r"), Loader=yaml.FullLoader)
|
||||||
requests_wrapper: TextRequestsWrapper,
|
spec = JsonSpec(dict_=yaml_dict)
|
||||||
) -> BaseToolkit:
|
else:
|
||||||
return OpenAPIToolkit(json_agent=json_agent, requests_wrapper=requests_wrapper)
|
spec = JsonSpec.from_file(Path(path))
|
||||||
|
requests_wrapper = TextRequestsWrapper()
|
||||||
|
return OpenAPIToolkit.from_llm(
|
||||||
|
llm=llm,
|
||||||
|
json_spec=spec,
|
||||||
|
requests_wrapper=requests_wrapper,
|
||||||
|
allow_dangerous_requests=allow_dangerous_requests,
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreInfo
|
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreInfo
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langchain_core.vectorstores import VectorStore
|
from langchain_core.vectorstores import VectorStore
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
class VectorStoreInfoComponent(CustomComponent):
|
class VectorStoreInfoComponent(CustomComponent):
|
||||||
display_name = "VectorStoreInfo"
|
display_name = "VectorStoreInfo"
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ from typing import List, Union
|
||||||
|
|
||||||
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreInfo, VectorStoreRouterToolkit
|
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreInfo, VectorStoreRouterToolkit
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, Tool
|
from langflow.field_typing import BaseLanguageModel, Tool
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class VectorStoreRouterToolkitComponent(CustomComponent):
|
class VectorStoreRouterToolkitComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ from typing import Union
|
||||||
|
|
||||||
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreInfo, VectorStoreToolkit
|
from langchain.agents.agent_toolkits.vectorstore.toolkit import VectorStoreInfo, VectorStoreToolkit
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, Tool
|
from langflow.field_typing import BaseLanguageModel, Tool
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class VectorStoreToolkitComponent(CustomComponent):
|
class VectorStoreToolkitComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from langchain.tools.retriever import create_retriever_tool
|
from langchain.tools.retriever import create_retriever_tool
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import BaseRetriever, Tool
|
from langflow.field_typing import BaseRetriever, Tool
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
|
|
||||||
|
|
||||||
class RetrieverToolComponent(CustomComponent):
|
class RetrieverToolComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@ from typing import List, Optional, Union
|
||||||
|
|
||||||
import chromadb # type: ignore
|
import chromadb # type: ignore
|
||||||
from langchain_community.vectorstores.chroma import Chroma
|
from langchain_community.vectorstores.chroma import Chroma
|
||||||
|
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema.schema import Record
|
|
||||||
from langchain_core.embeddings import Embeddings
|
from langchain_core.embeddings import Embeddings
|
||||||
from langchain_core.retrievers import BaseRetriever
|
from langchain_core.retrievers import BaseRetriever
|
||||||
from langchain_core.vectorstores import VectorStore
|
from langchain_core.vectorstores import VectorStore
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.schema.schema import Record
|
||||||
|
|
||||||
|
|
||||||
class ChromaComponent(CustomComponent):
|
class ChromaComponent(CustomComponent):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
from typing import List, Text, Union
|
from typing import List, Text, Union
|
||||||
from langchain_community.vectorstores.faiss import FAISS
|
|
||||||
|
|
||||||
from langflow.field_typing import Embeddings
|
from langchain_community.vectorstores.faiss import FAISS
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema.schema import Record
|
|
||||||
from langchain_core.retrievers import BaseRetriever
|
from langchain_core.retrievers import BaseRetriever
|
||||||
from langchain_core.vectorstores import VectorStore
|
from langchain_core.vectorstores import VectorStore
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.field_typing import Embeddings
|
||||||
|
from langflow.schema.schema import Record
|
||||||
|
|
||||||
|
|
||||||
class FAISSComponent(CustomComponent):
|
class FAISSComponent(CustomComponent):
|
||||||
display_name = "FAISS"
|
display_name = "FAISS"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from langchain_community.vectorstores.mongodb_atlas import MongoDBAtlasVectorSearch
|
from langchain_community.vectorstores.mongodb_atlas import MongoDBAtlasVectorSearch
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Embeddings
|
from langflow.field_typing import Embeddings
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema.schema import Record
|
from langflow.schema.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
from typing import List, Optional, Union
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
|
from langchain_core.retrievers import BaseRetriever
|
||||||
|
from langchain_core.vectorstores import VectorStore
|
||||||
from langchain_pinecone._utilities import DistanceStrategy
|
from langchain_pinecone._utilities import DistanceStrategy
|
||||||
from langchain_pinecone.vectorstores import PineconeVectorStore
|
from langchain_pinecone.vectorstores import PineconeVectorStore
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
from langflow.field_typing import Embeddings
|
from langflow.field_typing import Embeddings
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema.schema import Record
|
from langflow.schema.schema import Record
|
||||||
from langchain_core.retrievers import BaseRetriever
|
|
||||||
from langchain_core.vectorstores import VectorStore
|
|
||||||
|
|
||||||
|
|
||||||
class PineconeComponent(CustomComponent):
|
class PineconeComponent(CustomComponent):
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
from langchain_community.vectorstores.qdrant import Qdrant
|
|
||||||
|
|
||||||
from langflow.field_typing import Embeddings
|
from langchain_community.vectorstores.qdrant import Qdrant
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
|
||||||
from langflow.schema.schema import Record
|
|
||||||
from langchain_core.retrievers import BaseRetriever
|
from langchain_core.retrievers import BaseRetriever
|
||||||
from langchain_core.vectorstores import VectorStore
|
from langchain_core.vectorstores import VectorStore
|
||||||
|
|
||||||
|
from langflow.custom import CustomComponent
|
||||||
|
from langflow.field_typing import Embeddings
|
||||||
|
from langflow.schema.schema import Record
|
||||||
|
|
||||||
|
|
||||||
class QdrantComponent(CustomComponent):
|
class QdrantComponent(CustomComponent):
|
||||||
display_name = "Qdrant"
|
display_name = "Qdrant"
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue