Merge branch 'release' into dev

This commit is contained in:
Lucas Oliveira 2023-10-25 20:06:21 -03:00
commit dd3f3d4ca8
9 changed files with 430 additions and 425 deletions

View file

@ -35,6 +35,7 @@ format:
cd src/frontend && npm run format cd src/frontend && npm run format
lint: lint:
make install_backend
poetry run mypy src/backend/langflow poetry run mypy src/backend/langflow
poetry run black . --check poetry run black . --check
poetry run ruff . --fix poetry run ruff . --fix

810
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "langflow" name = "langflow"
version = "0.5.3" version = "0.5.4"
description = "A Python package with a built-in web application" description = "A Python package with a built-in web application"
authors = ["Logspace <contact@logspace.ai>"] authors = ["Logspace <contact@logspace.ai>"]
maintainers = [ maintainers = [
@ -33,7 +33,7 @@ google-search-results = "^2.4.1"
google-api-python-client = "^2.79.0" google-api-python-client = "^2.79.0"
typer = "^0.9.0" typer = "^0.9.0"
gunicorn = "^21.2.0" gunicorn = "^21.2.0"
langchain = "^0.0.312" langchain = "^0.0.320"
openai = "^0.27.8" openai = "^0.27.8"
pandas = "2.0.3" pandas = "2.0.3"
chromadb = "^0.3.21" chromadb = "^0.3.21"

View file

@ -54,9 +54,10 @@ def get_all(
logger.debug("Building langchain types dict") logger.debug("Building langchain types dict")
try: try:
return get_all_types_dict(settings_service) types_dict = get_all_types_dict(settings_service)
except Exception as exc: except Exception as exc:
raise HTTPException(status_code=500, detail=str(exc)) from exc raise HTTPException(status_code=500, detail=str(exc)) from exc
return types_dict
# For backwards compatibility we will keep the old endpoint # For backwards compatibility we will keep the old endpoint

View file

@ -5,6 +5,7 @@ from langchain.agents.load_tools import (
_EXTRA_OPTIONAL_TOOLS, _EXTRA_OPTIONAL_TOOLS,
_LLM_TOOLS, _LLM_TOOLS,
) )
from langchain.tools.python.tool import PythonInputs
from langflow.custom import customs from langflow.custom import customs
from langflow.interface.base import LangChainTypeCreator from langflow.interface.base import LangChainTypeCreator
@ -161,8 +162,14 @@ class ToolCreator(LangChainTypeCreator):
template = Template(fields=fields, type_name=tool_type) template = Template(fields=fields, type_name=tool_type)
tool_params = {**tool_params, **self.type_to_loader_dict[name]["params"]} tool_params = {**tool_params, **self.type_to_loader_dict[name]["params"]}
template_dict = template.to_dict()
if (
"args_schema" in template_dict
and template_dict.get("args_schema").get("value") == PythonInputs
):
template_dict["args_schema"]["value"] = ""
return { return {
"template": util.format_dict(template.to_dict()), "template": util.format_dict(template_dict),
**tool_params, **tool_params,
"base_classes": base_classes, "base_classes": base_classes,
} }

View file

@ -28,10 +28,14 @@ class UtilityCreator(LangChainTypeCreator):
""" """
if self.type_dict is None: if self.type_dict is None:
settings_service = get_settings_service() settings_service = get_settings_service()
self.type_dict = { self.type_dict = {}
utility_name: import_class(f"langchain.utilities.{utility_name}") for utility_name in utilities.__all__:
for utility_name in utilities.__all__ try:
} imported = import_class(f"langchain.utilities.{utility_name}")
self.type_dict[utility_name] = imported
except Exception:
pass
self.type_dict["SQLDatabase"] = utilities.SQLDatabase self.type_dict["SQLDatabase"] = utilities.SQLDatabase
# Filter according to settings.utilities # Filter according to settings.utilities
self.type_dict = { self.type_dict = {

View file

@ -1,18 +1,28 @@
import { useContext, useEffect, useState } from "react"; import { useContext, useEffect, useState } from "react";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { darkContext } from "../../contexts/darkContext";
import { TabsContext } from "../../contexts/tabsContext"; import { TabsContext } from "../../contexts/tabsContext";
import { getVersion } from "../../controllers/API"; import { getVersion } from "../../controllers/API";
import Page from "../FlowPage/components/PageComponent"; import Page from "../FlowPage/components/PageComponent";
export default function ViewPage() { export default function ViewPage() {
const { flows, tabId, setTabId } = useContext(TabsContext); const { flows, tabId, setTabId } = useContext(TabsContext);
const { id } = useParams(); const { setDark } = useContext(darkContext);
const { id, theme } = useParams();
// Set flow tab id // Set flow tab id
useEffect(() => { useEffect(() => {
setTabId(id!); setTabId(id!);
}, [id]); }, [id]);
useEffect(() => {
if (theme) {
setDark(theme === "dark");
} else {
setDark(false);
}
}, [theme]);
// Initialize state variable for the version // Initialize state variable for the version
const [version, setVersion] = useState(""); const [version, setVersion] = useState("");
useEffect(() => { useEffect(() => {

View file

@ -44,7 +44,7 @@ const Router = () => {
} }
/> />
<Route <Route
path="view" path="view/:theme?"
element={ element={
<ProtectedRoute> <ProtectedRoute>
<ViewPage /> <ViewPage />

View file

@ -96,7 +96,7 @@ def test_prompt_template(client: TestClient, logged_in_headers):
"placeholder": "", "placeholder": "",
"show": False, "show": False,
"multiline": False, "multiline": False,
"value": True, "value": False,
"password": False, "password": False,
"name": "validate_template", "name": "validate_template",
"type": "bool", "type": "bool",