parent
91e5ae797d
commit
a3a950c290
18 changed files with 51 additions and 48 deletions
0
src/backend/base/langflow/__init__.py
Normal file
0
src/backend/base/langflow/__init__.py
Normal file
|
|
@ -521,7 +521,7 @@ async def process(
|
|||
"""
|
||||
# Raise a depreciation warning
|
||||
logger.warning(
|
||||
"The /process endpoint is deprecated and will be removed in a future version. " "Please use /run instead."
|
||||
"The /process endpoint is deprecated and will be removed in a future version. Please use /run instead."
|
||||
)
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
|
|
|
|||
|
|
@ -15,30 +15,37 @@ followed by a newline with a space.
|
|||
|
||||
import re
|
||||
import shlex
|
||||
from collections import OrderedDict, namedtuple
|
||||
from collections import OrderedDict
|
||||
from http.cookies import SimpleCookie
|
||||
from typing import NamedTuple
|
||||
|
||||
ParsedArgs = namedtuple(
|
||||
"ParsedArgs",
|
||||
[
|
||||
"command",
|
||||
"url",
|
||||
"data",
|
||||
"data_binary",
|
||||
"method",
|
||||
"headers",
|
||||
"compressed",
|
||||
"insecure",
|
||||
"user",
|
||||
"include",
|
||||
"silent",
|
||||
"proxy",
|
||||
"proxy_user",
|
||||
"cookies",
|
||||
],
|
||||
)
|
||||
|
||||
ParsedContext = namedtuple("ParsedContext", ["method", "url", "data", "headers", "cookies", "verify", "auth", "proxy"])
|
||||
class ParsedArgs(NamedTuple):
|
||||
command: str | None
|
||||
url: str | None
|
||||
data: str | None
|
||||
data_binary: str | None
|
||||
method: str
|
||||
headers: list[str]
|
||||
compressed: bool
|
||||
insecure: bool
|
||||
user: tuple[str, str]
|
||||
include: bool
|
||||
silent: bool
|
||||
proxy: str | None
|
||||
proxy_user: str | None
|
||||
cookies: dict[str, str]
|
||||
|
||||
|
||||
class ParsedContext(NamedTuple):
|
||||
method: str
|
||||
url: str
|
||||
data: str | None
|
||||
headers: dict[str, str]
|
||||
cookies: dict[str, str]
|
||||
verify: bool
|
||||
auth: tuple[str, str] | None
|
||||
proxy: dict[str, str] | None
|
||||
|
||||
|
||||
def normalize_newlines(multiline_text):
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class ChatLiteLLMModelComponent(LCModelComponent):
|
|||
litellm.drop_params = True
|
||||
litellm.set_verbose = self.verbose
|
||||
except ImportError as e:
|
||||
msg = "Could not import litellm python package. " "Please install it with `pip install litellm`"
|
||||
msg = "Could not import litellm python package. Please install it with `pip install litellm`"
|
||||
raise ChatLiteLLMException(msg) from e
|
||||
# Remove empty keys
|
||||
if "" in self.kwargs:
|
||||
|
|
|
|||
|
|
@ -57,9 +57,7 @@ class FirecrawlCrawlApi(CustomComponent):
|
|||
try:
|
||||
from firecrawl.firecrawl import FirecrawlApp # type: ignore
|
||||
except ImportError as e:
|
||||
msg = (
|
||||
"Could not import firecrawl integration package. " "Please install it with `pip install firecrawl-py`."
|
||||
)
|
||||
msg = "Could not import firecrawl integration package. Please install it with `pip install firecrawl-py`."
|
||||
raise ImportError(msg) from e
|
||||
crawler_options_dict = crawlerOptions.__dict__["data"]["text"] if crawlerOptions else {}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,7 @@ class FirecrawlScrapeApi(CustomComponent):
|
|||
try:
|
||||
from firecrawl.firecrawl import FirecrawlApp # type: ignore
|
||||
except ImportError as e:
|
||||
msg = (
|
||||
"Could not import firecrawl integration package. " "Please install it with `pip install firecrawl-py`."
|
||||
)
|
||||
msg = "Could not import firecrawl integration package. Please install it with `pip install firecrawl-py`."
|
||||
raise ImportError(msg) from e
|
||||
extractor_options_dict = extractorOptions.__dict__["data"]["text"] if extractorOptions else {}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class CassandraChatMemory(LCChatMemoryComponent):
|
|||
try:
|
||||
import cassio
|
||||
except ImportError as e:
|
||||
msg = "Could not import cassio integration package. " "Please install it with `pip install cassio`."
|
||||
msg = "Could not import cassio integration package. Please install it with `pip install cassio`."
|
||||
raise ImportError(msg) from e
|
||||
|
||||
from uuid import UUID
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class ZepChatMemory(LCChatMemoryComponent):
|
|||
|
||||
zep_python.zep_client.API_BASE_PATH = self.api_base_path
|
||||
except ImportError as e:
|
||||
msg = "Could not import zep-python package. " "Please install it with `pip install zep-python`."
|
||||
msg = "Could not import zep-python package. Please install it with `pip install zep-python`."
|
||||
raise ImportError(msg) from e
|
||||
|
||||
zep_client = ZepClient(api_url=self.url, api_key=self.api_key)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class JSONCleaner(Component):
|
|||
try:
|
||||
from json_repair import repair_json # type: ignore
|
||||
except ImportError as e:
|
||||
msg = "Could not import the json_repair package." "Please install it with `pip install json_repair`."
|
||||
msg = "Could not import the json_repair package. Please install it with `pip install json_repair`."
|
||||
raise ImportError(msg) from e
|
||||
|
||||
"""Clean the input JSON string based on provided options and return the cleaned JSON string."""
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ class CassandraVectorStoreComponent(LCVectorStoreComponent):
|
|||
import cassio
|
||||
from langchain_community.utilities.cassandra import SetupMode
|
||||
except ImportError as e:
|
||||
msg = "Could not import cassio integration package. " "Please install it with `pip install cassio`."
|
||||
msg = "Could not import cassio integration package. Please install it with `pip install cassio`."
|
||||
raise ImportError(msg) from e
|
||||
|
||||
from uuid import UUID
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class CassandraGraphVectorStoreComponent(LCVectorStoreComponent):
|
|||
import cassio
|
||||
from langchain_community.utilities.cassandra import SetupMode
|
||||
except ImportError as e:
|
||||
msg = "Could not import cassio integration package. " "Please install it with `pip install cassio`."
|
||||
msg = "Could not import cassio integration package. Please install it with `pip install cassio`."
|
||||
raise ImportError(msg) from e
|
||||
|
||||
database_ref = self.database_ref
|
||||
|
|
|
|||
|
|
@ -107,9 +107,7 @@ class ChromaVectorStoreComponent(LCVectorStoreComponent):
|
|||
from chromadb import Client
|
||||
from langchain_chroma import Chroma
|
||||
except ImportError as e:
|
||||
msg = (
|
||||
"Could not import Chroma integration package. " "Please install it with `pip install langchain-chroma`."
|
||||
)
|
||||
msg = "Could not import Chroma integration package. Please install it with `pip install langchain-chroma`."
|
||||
raise ImportError(msg) from e
|
||||
# Chroma settings
|
||||
chroma_settings = None
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ class HCDVectorStoreComponent(LCVectorStoreComponent):
|
|||
from astrapy.authentication import UsernamePasswordTokenProvider
|
||||
from astrapy.constants import Environment
|
||||
except ImportError as e:
|
||||
msg = "Could not import astrapy integration package. " "Please install it with `pip install astrapy`."
|
||||
msg = "Could not import astrapy integration package. Please install it with `pip install astrapy`."
|
||||
raise ImportError(msg) from e
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -74,9 +74,7 @@ class MilvusVectorStoreComponent(LCVectorStoreComponent):
|
|||
try:
|
||||
from langchain_milvus.vectorstores import Milvus as LangchainMilvus
|
||||
except ImportError as e:
|
||||
msg = (
|
||||
"Could not import Milvus integration package. " "Please install it with `pip install langchain-milvus`."
|
||||
)
|
||||
msg = "Could not import Milvus integration package. Please install it with `pip install langchain-milvus`."
|
||||
raise ImportError(msg) from e
|
||||
self.connection_args.update(uri=self.uri, token=self.password)
|
||||
milvus_store = LangchainMilvus(
|
||||
|
|
|
|||
|
|
@ -572,9 +572,7 @@ class Component(CustomComponent):
|
|||
except KeyError as e:
|
||||
close_match = find_closest_match(name, list(template.keys()))
|
||||
if close_match:
|
||||
msg = (
|
||||
f"Parameter '{name}' not found in {self.__class__.__name__}. " f"Did you mean '{close_match}'?"
|
||||
)
|
||||
msg = f"Parameter '{name}' not found in {self.__class__.__name__}. Did you mean '{close_match}'?"
|
||||
raise ValueError(msg) from e
|
||||
msg = f"Parameter {name} not found in {self.__class__.__name__}. "
|
||||
raise ValueError(msg) from e
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class Edge:
|
|||
if not self.valid_handles:
|
||||
logger.debug(self.source_handle)
|
||||
logger.debug(self.target_handle)
|
||||
msg = f"Edge between {source.display_name} and {target.display_name} " f"has invalid handles"
|
||||
msg = f"Edge between {source.display_name} and {target.display_name} has invalid handles"
|
||||
raise ValueError(msg)
|
||||
|
||||
def _legacy_validate_handles(self, source, target) -> None:
|
||||
|
|
@ -103,7 +103,7 @@ class Edge:
|
|||
if not self.valid_handles:
|
||||
logger.debug(self.source_handle)
|
||||
logger.debug(self.target_handle)
|
||||
msg = f"Edge between {source.vertex_type} and {target.vertex_type} " f"has invalid handles"
|
||||
msg = f"Edge between {source.vertex_type} and {target.vertex_type} has invalid handles"
|
||||
raise ValueError(msg)
|
||||
|
||||
def __setstate__(self, state):
|
||||
|
|
@ -160,7 +160,7 @@ class Edge:
|
|||
if no_matched_type:
|
||||
logger.debug(self.source_types)
|
||||
logger.debug(self.target_reqs)
|
||||
msg = f"Edge between {source.vertex_type} and {target.vertex_type} " f"has no matched type. "
|
||||
msg = f"Edge between {source.vertex_type} and {target.vertex_type} has no matched type."
|
||||
raise ValueError(msg)
|
||||
|
||||
def _legacy_validate_edge(self, source, target) -> None:
|
||||
|
|
@ -182,7 +182,7 @@ class Edge:
|
|||
if no_matched_type:
|
||||
logger.debug(self.source_types)
|
||||
logger.debug(self.target_reqs)
|
||||
msg = f"Edge between {source.vertex_type} and {target.vertex_type} " f"has no matched type"
|
||||
msg = f"Edge between {source.vertex_type} and {target.vertex_type} has no matched type"
|
||||
raise ValueError(msg)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
|
|
|||
|
|
@ -168,13 +168,18 @@ select = [
|
|||
"FA",
|
||||
"FLY",
|
||||
"FURB",
|
||||
"G",
|
||||
"I",
|
||||
"ICN",
|
||||
"INT",
|
||||
"INP",
|
||||
"ISC",
|
||||
"LOG",
|
||||
"NPY",
|
||||
"PD",
|
||||
"PIE",
|
||||
"PT",
|
||||
"PYI",
|
||||
"Q",
|
||||
"RET",
|
||||
"RSE",
|
||||
|
|
@ -188,6 +193,7 @@ select = [
|
|||
]
|
||||
ignore = [
|
||||
"COM812", # Messes with the formatter
|
||||
"ISC001", # Messes with the formatter
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue