From bbe792b3e1fdb20b39ed7e89273ed090fac3e7c5 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 09:31:40 -0300 Subject: [PATCH 01/10] refactor: Update process_tweaks function to include stream parameter The process_tweaks function in endpoints.py has been updated to include a new stream parameter. This change allows for more flexibility in processing tweaks based on the stream value. The commit also includes necessary modifications to the simple_run_flow function to pass the stream parameter to the process_tweaks function. Note: The commit message has been generated based on the provided code changes and recent commits. --- src/backend/base/langflow/api/v1/endpoints.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/backend/base/langflow/api/v1/endpoints.py b/src/backend/base/langflow/api/v1/endpoints.py index df55e21d4..d7b52ed32 100644 --- a/src/backend/base/langflow/api/v1/endpoints.py +++ b/src/backend/base/langflow/api/v1/endpoints.py @@ -78,16 +78,11 @@ async def simple_run_flow( if flow.data is None: raise ValueError(f"Flow {flow_id_str} has no data") graph_data = flow.data - graph_data = process_tweaks(graph_data, input_request.tweaks or {}) + graph_data = process_tweaks(graph_data, input_request.tweaks or {}, stream=stream) graph = Graph.from_payload(graph_data, flow_id=flow_id_str, user_id=str(user_id)) inputs = [ InputValueRequest(components=[], input_value=input_request.input_value, type=input_request.input_type) ] - # outputs is a list of all components that should return output - # we need to get them by checking their type - # if the output type is debug, we return all outputs - # if the output type is any, we return all outputs that are either chat or text - # if the output type is chat or text, we return only the outputs that match the type if input_request.output_component: outputs = [input_request.output_component] else: From aafaa166b44677f917806facd42d33451cb5479b Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 09:35:57 -0300 Subject: [PATCH 02/10] chore: Update package versions in pyproject.toml files --- poetry.lock | 106 ++++++++++++++++---------------- pyproject.toml | 2 +- src/backend/base/poetry.lock | 18 +++--- src/backend/base/pyproject.toml | 2 +- 4 files changed, 64 insertions(+), 64 deletions(-) diff --git a/poetry.lock b/poetry.lock index b7b0e66a1..146cd5d66 100644 --- a/poetry.lock +++ b/poetry.lock @@ -471,17 +471,17 @@ files = [ [[package]] name = "boto3" -version = "1.34.116" +version = "1.34.117" description = "The AWS SDK for Python" optional = false python-versions = ">=3.8" files = [ - {file = "boto3-1.34.116-py3-none-any.whl", hash = "sha256:e7f5ab2d1f1b90971a2b9369760c2c6bae49dae98c084a5c3f5c78e3968ace15"}, - {file = "boto3-1.34.116.tar.gz", hash = "sha256:53cb8aeb405afa1cd2b25421e27a951aeb568026675dec020587861fac96ac87"}, + {file = "boto3-1.34.117-py3-none-any.whl", hash = "sha256:1506589e30566bbb2f4997b60968ff7d4ef8a998836c31eedd36437ac3b7408a"}, + {file = "boto3-1.34.117.tar.gz", hash = "sha256:c8a383b904d6faaf7eed0c06e31b423db128e4c09ce7bd2afc39d1cd07030a51"}, ] [package.dependencies] -botocore = ">=1.34.116,<1.35.0" +botocore = ">=1.34.117,<1.35.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.10.0,<0.11.0" @@ -490,13 +490,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.34.116" +version = "1.34.117" description = "Low-level, data-driven core of boto 3." optional = false python-versions = ">=3.8" files = [ - {file = "botocore-1.34.116-py3-none-any.whl", hash = "sha256:ec4d42c816e9b2d87a2439ad277e7dda16a4a614ef6839cf66f4c1a58afa547c"}, - {file = "botocore-1.34.116.tar.gz", hash = "sha256:269cae7ba99081519a9f87d7298e238d9e68ba94eb4f8ddfa906224c34cb8b6c"}, + {file = "botocore-1.34.117-py3-none-any.whl", hash = "sha256:26a431997f882bcdd1e835f44c24b2a1752b1c4e5183c2ce62999ce95d518d6c"}, + {file = "botocore-1.34.117.tar.gz", hash = "sha256:4637ca42e6c51aebc4d9a2d92f97bf4bdb042e3f7985ff31a659a11e4c170e73"}, ] [package.dependencies] @@ -2882,13 +2882,13 @@ grpc = ["grpcio (>=1.44.0,<2.0.0.dev0)"] [[package]] name = "gotrue" -version = "2.4.2" +version = "2.4.3" description = "Python Client Library for Supabase Auth" optional = false python-versions = "<4.0,>=3.8" files = [ - {file = "gotrue-2.4.2-py3-none-any.whl", hash = "sha256:64cd40933d1f0a5d5cc4f4bd93bc51d730b94812447b6600f774790a4901e455"}, - {file = "gotrue-2.4.2.tar.gz", hash = "sha256:e100745161f1c58dd05b9c1ef8bcd4cd78cdfb38d8d2c253ade63143a3dc6aeb"}, + {file = "gotrue-2.4.3-py3-none-any.whl", hash = "sha256:1e1679890c6a7bbfb10999b817e134d593dec4f7ff2ea05d48a78c2f384355ed"}, + {file = "gotrue-2.4.3.tar.gz", hash = "sha256:f93953654408aa35230317c1670ae1435e01ee5a461f2bfbc541fafd59b99c6b"}, ] [package.dependencies] @@ -4058,19 +4058,19 @@ text-helpers = ["chardet (>=5.1.0,<6.0.0)"] [[package]] name = "langchain-anthropic" -version = "0.1.13" +version = "0.1.15" description = "An integration package connecting AnthropicMessages and LangChain" optional = false python-versions = "<4.0,>=3.8.1" files = [ - {file = "langchain_anthropic-0.1.13-py3-none-any.whl", hash = "sha256:121f6f480da7685c239573d98322adb94fe486d40651ac341637f65da36881de"}, - {file = "langchain_anthropic-0.1.13.tar.gz", hash = "sha256:32e7ac51e1874c47e1a20493e75f5bfc88b0ffeaf5f1aed6091547e1ae44bb85"}, + {file = "langchain_anthropic-0.1.15-py3-none-any.whl", hash = "sha256:7cceea526f473e4d514f39295dc128eec57da628a4bbb54850d11dda7aa959fc"}, + {file = "langchain_anthropic-0.1.15.tar.gz", hash = "sha256:c5c3c6eaccb11ed99a63886e50873ac21eaf8e9441e0f75c7ae7cd8cdef65155"}, ] [package.dependencies] -anthropic = ">=0.26.0,<1" +anthropic = ">=0.28.0,<1" defusedxml = ">=0.7.1,<0.8.0" -langchain-core = ">=0.1.43,<0.3" +langchain-core = ">=0.2.2rc1,<0.3" [[package]] name = "langchain-astradb" @@ -4322,7 +4322,7 @@ types-requests = ">=2.31.0.2,<3.0.0.0" [[package]] name = "langflow-base" -version = "0.0.54" +version = "0.0.55" description = "A Python package with a built-in web application" optional = false python-versions = ">=3.10,<3.13" @@ -4419,13 +4419,13 @@ requests = ">=2,<3" [[package]] name = "litellm" -version = "1.39.5" +version = "1.40.0" description = "Library to easily interface with LLM API providers" optional = false python-versions = "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3.8" files = [ - {file = "litellm-1.39.5-py3-none-any.whl", hash = "sha256:1e8dd43c5d257fa8d7a0039b20aed7aeed4463d53608d1ba4ac233f1967a5330"}, - {file = "litellm-1.39.5.tar.gz", hash = "sha256:8f4ea9fe21d67890e81a578e12c30b4172260ff35971dc7c3edf7eb69167d3be"}, + {file = "litellm-1.40.0-py3-none-any.whl", hash = "sha256:c3055767ae144585699fdb07b3ad678e66738c2eff19abd7761c8fe22d6e636f"}, + {file = "litellm-1.40.0.tar.gz", hash = "sha256:12b4c0ad850ede5aebdb2f48e3a8e898efb25df5bc915ff89929ad963cb92f54"}, ] [package.dependencies] @@ -6182,13 +6182,13 @@ tests = ["pytest (>=5.4.1)", "pytest-cov (>=2.8.1)", "pytest-mypy (>=0.8.0)", "p [[package]] name = "postgrest" -version = "0.16.4" +version = "0.16.7" description = "PostgREST client for Python. This library provides an ORM interface to PostgREST." optional = false python-versions = "<4.0,>=3.8" files = [ - {file = "postgrest-0.16.4-py3-none-any.whl", hash = "sha256:304425381eb38e31018832a524943d7d1f07687be80c3c7397d8ae69ca56cb88"}, - {file = "postgrest-0.16.4.tar.gz", hash = "sha256:e16973155be1464101d18a51cc060707cd177b918f4b01ea8afa51746ca870ef"}, + {file = "postgrest-0.16.7-py3-none-any.whl", hash = "sha256:0727dbdbc4e00fd98244596812e7dba6261019f3ec09138be291479a76d9fe99"}, + {file = "postgrest-0.16.7.tar.gz", hash = "sha256:779e20bd34f3c14e1e99129407612f85d7bb1d80b5cee2f54e50194b4488c658"}, ] [package.dependencies] @@ -7763,28 +7763,28 @@ pyasn1 = ">=0.1.3" [[package]] name = "ruff" -version = "0.4.6" +version = "0.4.7" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.4.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ef995583a038cd4a7edf1422c9e19118e2511b8ba0b015861b4abd26ec5367c5"}, - {file = "ruff-0.4.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:602ebd7ad909eab6e7da65d3c091547781bb06f5f826974a53dbe563d357e53c"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f9ced5cbb7510fd7525448eeb204e0a22cabb6e99a3cb160272262817d49786"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:04a80acfc862e0e1630c8b738e70dcca03f350bad9e106968a8108379e12b31f"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:be47700ecb004dfa3fd4dcdddf7322d4e632de3c06cd05329d69c45c0280e618"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:1ff930d6e05f444090a0139e4e13e1e2e1f02bd51bb4547734823c760c621e79"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f13410aabd3b5776f9c5699f42b37a3a348d65498c4310589bc6e5c548dc8a2f"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0cf5cc02d3ae52dfb0c8a946eb7a1d6ffe4d91846ffc8ce388baa8f627e3bd50"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ea3424793c29906407e3cf417f28fc33f689dacbbadfb52b7e9a809dd535dcef"}, - {file = "ruff-0.4.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:1fa8561489fadf483ffbb091ea94b9c39a00ed63efacd426aae2f197a45e67fc"}, - {file = "ruff-0.4.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:4d5b914818d8047270308fe3e85d9d7f4a31ec86c6475c9f418fbd1624d198e0"}, - {file = "ruff-0.4.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:4f02284335c766678778475e7698b7ab83abaf2f9ff0554a07b6f28df3b5c259"}, - {file = "ruff-0.4.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3a6a0a4f4b5f54fff7c860010ab3dd81425445e37d35701a965c0248819dde7a"}, - {file = "ruff-0.4.6-py3-none-win32.whl", hash = "sha256:9018bf59b3aa8ad4fba2b1dc0299a6e4e60a4c3bc62bbeaea222679865453062"}, - {file = "ruff-0.4.6-py3-none-win_amd64.whl", hash = "sha256:a769ae07ac74ff1a019d6bd529426427c3e30d75bdf1e08bb3d46ac8f417326a"}, - {file = "ruff-0.4.6-py3-none-win_arm64.whl", hash = "sha256:735a16407a1a8f58e4c5b913ad6102722e80b562dd17acb88887685ff6f20cf6"}, - {file = "ruff-0.4.6.tar.gz", hash = "sha256:a797a87da50603f71e6d0765282098245aca6e3b94b7c17473115167d8dfb0b7"}, + {file = "ruff-0.4.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:e089371c67892a73b6bb1525608e89a2aca1b77b5440acf7a71dda5dac958f9e"}, + {file = "ruff-0.4.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:10f973d521d910e5f9c72ab27e409e839089f955be8a4c8826601a6323a89753"}, + {file = "ruff-0.4.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:59c3d110970001dfa494bcd95478e62286c751126dfb15c3c46e7915fc49694f"}, + {file = "ruff-0.4.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fa9773c6c00f4958f73b317bc0fd125295110c3776089f6ef318f4b775f0abe4"}, + {file = "ruff-0.4.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07fc80bbb61e42b3b23b10fda6a2a0f5a067f810180a3760c5ef1b456c21b9db"}, + {file = "ruff-0.4.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:fa4dafe3fe66d90e2e2b63fa1591dd6e3f090ca2128daa0be33db894e6c18648"}, + {file = "ruff-0.4.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a7c0083febdec17571455903b184a10026603a1de078428ba155e7ce9358c5f6"}, + {file = "ruff-0.4.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ad1b20e66a44057c326168437d680a2166c177c939346b19c0d6b08a62a37589"}, + {file = "ruff-0.4.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cbf5d818553add7511c38b05532d94a407f499d1a76ebb0cad0374e32bc67202"}, + {file = "ruff-0.4.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:50e9651578b629baec3d1513b2534de0ac7ed7753e1382272b8d609997e27e83"}, + {file = "ruff-0.4.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8874a9df7766cb956b218a0a239e0a5d23d9e843e4da1e113ae1d27ee420877a"}, + {file = "ruff-0.4.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:b9de9a6e49f7d529decd09381c0860c3f82fa0b0ea00ea78409b785d2308a567"}, + {file = "ruff-0.4.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:13a1768b0691619822ae6d446132dbdfd568b700ecd3652b20d4e8bc1e498f78"}, + {file = "ruff-0.4.7-py3-none-win32.whl", hash = "sha256:769e5a51df61e07e887b81e6f039e7ed3573316ab7dd9f635c5afaa310e4030e"}, + {file = "ruff-0.4.7-py3-none-win_amd64.whl", hash = "sha256:9e3ab684ad403a9ed1226894c32c3ab9c2e0718440f6f50c7c5829932bc9e054"}, + {file = "ruff-0.4.7-py3-none-win_arm64.whl", hash = "sha256:10f2204b9a613988e3484194c2c9e96a22079206b22b787605c255f130db5ed7"}, + {file = "ruff-0.4.7.tar.gz", hash = "sha256:2331d2b051dc77a289a653fcc6a42cce357087c5975738157cd966590b18b5e1"}, ] [[package]] @@ -9013,13 +9013,13 @@ types-pyOpenSSL = "*" [[package]] name = "types-requests" -version = "2.32.0.20240523" +version = "2.32.0.20240602" description = "Typing stubs for requests" optional = false python-versions = ">=3.8" files = [ - {file = "types-requests-2.32.0.20240523.tar.gz", hash = "sha256:26b8a6de32d9f561192b9942b41c0ab2d8010df5677ca8aa146289d11d505f57"}, - {file = "types_requests-2.32.0.20240523-py3-none-any.whl", hash = "sha256:f19ed0e2daa74302069bbbbf9e82902854ffa780bc790742a810a9aaa52f65ec"}, + {file = "types-requests-2.32.0.20240602.tar.gz", hash = "sha256:3f98d7bbd0dd94ebd10ff43a7fbe20c3b8528acace6d8efafef0b6a184793f06"}, + {file = "types_requests-2.32.0.20240602-py3-none-any.whl", hash = "sha256:ed3946063ea9fbc6b5fc0c44fa279188bae42d582cb63760be6cb4b9d06c3de8"}, ] [package.dependencies] @@ -9038,13 +9038,13 @@ files = [ [[package]] name = "typing-extensions" -version = "4.12.0" +version = "4.12.1" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.12.0-py3-none-any.whl", hash = "sha256:b349c66bea9016ac22978d800cfff206d5f9816951f12a7d0ec5578b0a819594"}, - {file = "typing_extensions-4.12.0.tar.gz", hash = "sha256:8cbcdc8606ebcb0d95453ad7dc5065e6237b6aa230a31e81d0f440c30fed5fd8"}, + {file = "typing_extensions-4.12.1-py3-none-any.whl", hash = "sha256:6024b58b69089e5a89c347397254e35f1bf02a907728ec7fee9bf0fe837d203a"}, + {file = "typing_extensions-4.12.1.tar.gz", hash = "sha256:915f5e35ff76f56588223f15fdd5938f9a1cf9195c0de25130c627e4d597f6d1"}, ] [[package]] @@ -9300,13 +9300,13 @@ test = ["Cython (>=0.29.36,<0.30.0)", "aiohttp (==3.9.0b0)", "aiohttp (>=3.8.1)" [[package]] name = "validators" -version = "0.28.1" +version = "0.28.3" description = "Python Data Validation for Humansβ„’" optional = false python-versions = ">=3.8" files = [ - {file = "validators-0.28.1-py3-none-any.whl", hash = "sha256:890c98789ad884037f059af6ea915ec2d667129d509180c2c590b8009a4c4219"}, - {file = "validators-0.28.1.tar.gz", hash = "sha256:5ac88e7916c3405f0ce38ac2ac82a477fcf4d90dbbeddd04c8193171fc17f7dc"}, + {file = "validators-0.28.3-py3-none-any.whl", hash = "sha256:53cafa854f13850156259d9cc479b864ee901f6a96e6b109e6fc33f98f37d99f"}, + {file = "validators-0.28.3.tar.gz", hash = "sha256:c6c79840bcde9ba77b19f6218f7738188115e27830cbaff43264bc4ed24c429d"}, ] [[package]] @@ -9454,13 +9454,13 @@ files = [ [[package]] name = "weaviate-client" -version = "4.6.3" +version = "4.6.4" description = "A python native Weaviate client" optional = false python-versions = ">=3.8" files = [ - {file = "weaviate_client-4.6.3-py3-none-any.whl", hash = "sha256:b2921f9aea84a4eccb1c75d55dd2857a87241e5536540fb96ffdf4737ed4fe8a"}, - {file = "weaviate_client-4.6.3.tar.gz", hash = "sha256:a6e638f746f91c310fe6680cffa77949718f17d8b40b966f7037028cacfd94e0"}, + {file = "weaviate_client-4.6.4-py3-none-any.whl", hash = "sha256:19b76fb923a5f0b6fcb7471ef3cd990d2791ede71731e53429e1066a9dbf2af2"}, + {file = "weaviate_client-4.6.4.tar.gz", hash = "sha256:5378db8a33bf1d48adff3f9efa572d9fb04eaeb36444817cab56f1ba3c595500"}, ] [package.dependencies] @@ -9471,7 +9471,7 @@ grpcio-tools = ">=1.57.0,<2.0.0" httpx = ">=0.25.0,<=0.27.0" pydantic = ">=2.5.0,<3.0.0" requests = ">=2.30.0,<3.0.0" -validators = "0.28.1" +validators = "0.28.3" [[package]] name = "websocket-client" diff --git a/pyproject.toml b/pyproject.toml index 8ff91de1c..bec91ee97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "1.0.0a43" +version = "1.0.0a44" description = "A Python package with a built-in web application" authors = ["Langflow "] maintainers = [ diff --git a/src/backend/base/poetry.lock b/src/backend/base/poetry.lock index 21906d71b..55aee39bf 100644 --- a/src/backend/base/poetry.lock +++ b/src/backend/base/poetry.lock @@ -264,13 +264,13 @@ files = [ [[package]] name = "certifi" -version = "2024.2.2" +version = "2024.6.2" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, - {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, + {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, + {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516"}, ] [[package]] @@ -2720,13 +2720,13 @@ typing-extensions = ">=3.7.4.3" [[package]] name = "types-requests" -version = "2.32.0.20240523" +version = "2.32.0.20240602" description = "Typing stubs for requests" optional = false python-versions = ">=3.8" files = [ - {file = "types-requests-2.32.0.20240523.tar.gz", hash = "sha256:26b8a6de32d9f561192b9942b41c0ab2d8010df5677ca8aa146289d11d505f57"}, - {file = "types_requests-2.32.0.20240523-py3-none-any.whl", hash = "sha256:f19ed0e2daa74302069bbbbf9e82902854ffa780bc790742a810a9aaa52f65ec"}, + {file = "types-requests-2.32.0.20240602.tar.gz", hash = "sha256:3f98d7bbd0dd94ebd10ff43a7fbe20c3b8528acace6d8efafef0b6a184793f06"}, + {file = "types_requests-2.32.0.20240602-py3-none-any.whl", hash = "sha256:ed3946063ea9fbc6b5fc0c44fa279188bae42d582cb63760be6cb4b9d06c3de8"}, ] [package.dependencies] @@ -2734,13 +2734,13 @@ urllib3 = ">=2" [[package]] name = "typing-extensions" -version = "4.12.0" +version = "4.12.1" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.12.0-py3-none-any.whl", hash = "sha256:b349c66bea9016ac22978d800cfff206d5f9816951f12a7d0ec5578b0a819594"}, - {file = "typing_extensions-4.12.0.tar.gz", hash = "sha256:8cbcdc8606ebcb0d95453ad7dc5065e6237b6aa230a31e81d0f440c30fed5fd8"}, + {file = "typing_extensions-4.12.1-py3-none-any.whl", hash = "sha256:6024b58b69089e5a89c347397254e35f1bf02a907728ec7fee9bf0fe837d203a"}, + {file = "typing_extensions-4.12.1.tar.gz", hash = "sha256:915f5e35ff76f56588223f15fdd5938f9a1cf9195c0de25130c627e4d597f6d1"}, ] [[package]] diff --git a/src/backend/base/pyproject.toml b/src/backend/base/pyproject.toml index 30530c541..3dc50f617 100644 --- a/src/backend/base/pyproject.toml +++ b/src/backend/base/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow-base" -version = "0.0.54" +version = "0.0.55" description = "A Python package with a built-in web application" authors = ["Langflow "] maintainers = [ From 5fe568cc6c461581ef29b30ccc5f0ad197fc6a0e Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 09:54:47 -0300 Subject: [PATCH 03/10] refactor: Update factory_restart_space.py to use environment variable for Hugging Face API token --- .github/workflows/docker-build.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 2c8e61547..8cb6d0a8d 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -54,10 +54,28 @@ jobs: tags: ${{ env.TAGS }} - name: Wait for Docker Hub to propagate run: sleep 120 - - name: Restart HuggingFace Spaces Build - # There's a script in ./scripts/factory_reset_space.py that will reset the build - # using the HUGGINGFACE_API_TOKEN secret + + restart-space: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.12" + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }} + uses: "./.github/actions/poetry_caching" + with: + python-version: ${{ matrix.python-version }} + poetry-version: ${{ env.POETRY_VERSION }} + cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }} + - name: Install Python dependencies run: | - python ./scripts/factory_restart_space.py + poetry env use ${{ matrix.python-version }} + poetry install + + - name: Restart HuggingFace Spaces Build + run: | + poetry run python ./scripts/factory_restart_space.py env: HUGGINGFACE_API_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }} From 6033c148755530ff593c532b95e867117620f666 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 12:56:54 -0300 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=94=A7=20(Makefile):=20Add=20suppor?= =?UTF-8?q?t=20for=20specifying=20the=20number=20of=20workers=20for=20uvic?= =?UTF-8?q?orn=20server=20=E2=AC=86=EF=B8=8F=20(pyproject.toml):=20Upgrade?= =?UTF-8?q?=20uvicorn=20dependency=20to=20version=200.30.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 5 +++-- poetry.lock | 16 ++++++++-------- src/backend/base/poetry.lock | 16 ++++++++-------- src/backend/base/pyproject.toml | 2 +- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index d056654f9..f62ecb411 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ port ?= 7860 env ?= .env open_browser ?= true path = src/backend/base/langflow/frontend +workers ?= 1 codespell: @poetry install --with spelling @@ -144,10 +145,10 @@ backend: @-kill -9 $(lsof -t -i:7860) ifdef login @echo "Running backend autologin is $(login)"; - LANGFLOW_AUTO_LOGIN=$(login) poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio + LANGFLOW_AUTO_LOGIN=$(login) poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio --workers $(workers) else @echo "Running backend respecting the .env file"; - poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio + poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio --workers $(workers) endif build_and_run: diff --git a/poetry.lock b/poetry.lock index 146cd5d66..e0978b558 100644 --- a/poetry.lock +++ b/poetry.lock @@ -4365,7 +4365,7 @@ rich = "^13.7.0" sqlmodel = "^0.0.18" typer = "^0.12.0" uncurl = "^0.0.11" -uvicorn = "^0.29.0" +uvicorn = "^0.30.0" websockets = "*" [package.extras] @@ -6834,17 +6834,17 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" [[package]] name = "pydantic-settings" -version = "2.2.1" +version = "2.3.0" description = "Settings management using Pydantic" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic_settings-2.2.1-py3-none-any.whl", hash = "sha256:0235391d26db4d2190cb9b31051c4b46882d28a51533f97440867f012d4da091"}, - {file = "pydantic_settings-2.2.1.tar.gz", hash = "sha256:00b9f6a5e95553590434c0fa01ead0b216c3e10bc54ae02e37f359948643c5ed"}, + {file = "pydantic_settings-2.3.0-py3-none-any.whl", hash = "sha256:26eeed27370a9c5e3f64e4a7d6602573cbedf05ed940f1d5b11c3f178427af7a"}, + {file = "pydantic_settings-2.3.0.tar.gz", hash = "sha256:78db28855a71503cfe47f39500a1dece523c640afd5280edb5c5c9c9cfa534c9"}, ] [package.dependencies] -pydantic = ">=2.3.0" +pydantic = ">=2.7.0" python-dotenv = ">=0.21.0" [package.extras] @@ -9230,13 +9230,13 @@ files = [ [[package]] name = "uvicorn" -version = "0.29.0" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.29.0-py3-none-any.whl", hash = "sha256:2c2aac7ff4f4365c206fd773a39bf4ebd1047c238f8b8268ad996829323473de"}, - {file = "uvicorn-0.29.0.tar.gz", hash = "sha256:6a69214c0b6a087462412670b3ef21224fa48cae0e452b5883e8e8bdfdd11dd0"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/src/backend/base/poetry.lock b/src/backend/base/poetry.lock index 55aee39bf..324dccc72 100644 --- a/src/backend/base/poetry.lock +++ b/src/backend/base/poetry.lock @@ -2214,17 +2214,17 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" [[package]] name = "pydantic-settings" -version = "2.2.1" +version = "2.3.0" description = "Settings management using Pydantic" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic_settings-2.2.1-py3-none-any.whl", hash = "sha256:0235391d26db4d2190cb9b31051c4b46882d28a51533f97440867f012d4da091"}, - {file = "pydantic_settings-2.2.1.tar.gz", hash = "sha256:00b9f6a5e95553590434c0fa01ead0b216c3e10bc54ae02e37f359948643c5ed"}, + {file = "pydantic_settings-2.3.0-py3-none-any.whl", hash = "sha256:26eeed27370a9c5e3f64e4a7d6602573cbedf05ed940f1d5b11c3f178427af7a"}, + {file = "pydantic_settings-2.3.0.tar.gz", hash = "sha256:78db28855a71503cfe47f39500a1dece523c640afd5280edb5c5c9c9cfa534c9"}, ] [package.dependencies] -pydantic = ">=2.3.0" +pydantic = ">=2.7.0" python-dotenv = ">=0.21.0" [package.extras] @@ -2890,13 +2890,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.29.0" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.29.0-py3-none-any.whl", hash = "sha256:2c2aac7ff4f4365c206fd773a39bf4ebd1047c238f8b8268ad996829323473de"}, - {file = "uvicorn-0.29.0.tar.gz", hash = "sha256:6a69214c0b6a087462412670b3ef21224fa48cae0e452b5883e8e8bdfdd11dd0"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] @@ -3265,4 +3265,4 @@ local = [] [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "1dc0dd442df5d174ea85c859208f5cfea9d4785c7b7a93f2c6bf8c92e93d8cad" +content-hash = "48a7355a7096e763b75315d0704bed8f4d8134a33553e62bc305a686b9e72803" diff --git a/src/backend/base/pyproject.toml b/src/backend/base/pyproject.toml index 3dc50f617..3d80fe194 100644 --- a/src/backend/base/pyproject.toml +++ b/src/backend/base/pyproject.toml @@ -28,7 +28,7 @@ langflow-base = "langflow.__main__:main" python = ">=3.10,<3.13" fastapi = "^0.111.0" httpx = "*" -uvicorn = "^0.29.0" +uvicorn = "^0.30.0" gunicorn = "^22.0.0" langchain = "~0.2.0" langchainhub = "~0.1.15" From 099d44bad09b030af79a3723bf490fefe1e3e1aa Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 13:02:49 -0300 Subject: [PATCH 05/10] refactor: Update database service to use pool_size and max_overflow settings The DatabaseService class in service.py has been updated to use the pool_size and max_overflow settings from the SettingsService. This change allows for better control over the number of connections in the connection pool and the number of connections that can be opened beyond the pool size. The commit also includes necessary modifications to the create_engine function to pass the pool_size and max_overflow parameters. Note: The commit message has been generated based on the provided code changes and recent commits. --- .../base/langflow/services/database/service.py | 11 +++++++++-- src/backend/base/langflow/services/settings/base.py | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/backend/base/langflow/services/database/service.py b/src/backend/base/langflow/services/database/service.py index 674c6c645..1e1ea9f8c 100644 --- a/src/backend/base/langflow/services/database/service.py +++ b/src/backend/base/langflow/services/database/service.py @@ -20,12 +20,14 @@ from langflow.services.utils import teardown_superuser if TYPE_CHECKING: from sqlalchemy.engine import Engine + from langflow.services.settings.manager import SettingsService class DatabaseService(Service): name = "database_service" - def __init__(self, database_url: str): + def __init__(self, database_url: str, settings_service: "SettingsService"): + self.settings_service = settings_service self.database_url = database_url # This file is in langflow.services.database.manager.py # the ini is in langflow @@ -41,7 +43,12 @@ class DatabaseService(Service): connect_args = {"check_same_thread": False} else: connect_args = {} - return create_engine(self.database_url, connect_args=connect_args) + return create_engine( + self.database_url, + connect_args=connect_args, + pool_size=self.settings_service.settings.pool_size, + max_overflow=self.settings_service.settings.max_overflow, + ) def __enter__(self): self._session = Session(self.engine) diff --git a/src/backend/base/langflow/services/settings/base.py b/src/backend/base/langflow/services/settings/base.py index 0f9d0d029..4f50cb756 100644 --- a/src/backend/base/langflow/services/settings/base.py +++ b/src/backend/base/langflow/services/settings/base.py @@ -67,6 +67,11 @@ class Settings(BaseSettings): dev: bool = False database_url: Optional[str] = None + """Database URL for Langflow. If not provided, Langflow will use a SQLite database.""" + pool_size: int = 10 + """The number of connections to keep open in the connection pool. If not provided, the default is 10.""" + max_overflow: int = 10 + """The number of connections to allow that can be opened beyond the pool size. If not provided, the default is 10.""" cache_type: str = "async" remove_api_keys: bool = False components_path: List[str] = [] From 06df938c001eb6a060db60aab2565fa105d886e7 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 13:04:56 -0300 Subject: [PATCH 06/10] refactor: Update DatabaseService to use settings_service for database URL The DatabaseService class in service.py has been updated to use the settings_service object for retrieving the database URL instead of directly passing it as a parameter. This change improves code organization and ensures consistency with other services that rely on the settings_service. The necessary modifications have been made in both the DatabaseService class and the DatabaseServiceFactory class. Note: The commit message has been generated based on the provided code changes and recent commits. --- src/backend/base/langflow/services/database/factory.py | 2 +- src/backend/base/langflow/services/database/service.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/base/langflow/services/database/factory.py b/src/backend/base/langflow/services/database/factory.py index 7f7a142b5..f9c269f12 100644 --- a/src/backend/base/langflow/services/database/factory.py +++ b/src/backend/base/langflow/services/database/factory.py @@ -15,4 +15,4 @@ class DatabaseServiceFactory(ServiceFactory): # Here you would have logic to create and configure a DatabaseService if not settings_service.settings.database_url: raise ValueError("No database URL provided") - return DatabaseService(settings_service.settings.database_url) + return DatabaseService(settings_service) diff --git a/src/backend/base/langflow/services/database/service.py b/src/backend/base/langflow/services/database/service.py index 1e1ea9f8c..df1bbe224 100644 --- a/src/backend/base/langflow/services/database/service.py +++ b/src/backend/base/langflow/services/database/service.py @@ -26,9 +26,9 @@ if TYPE_CHECKING: class DatabaseService(Service): name = "database_service" - def __init__(self, database_url: str, settings_service: "SettingsService"): + def __init__(self, settings_service: "SettingsService"): self.settings_service = settings_service - self.database_url = database_url + self.database_url = settings_service.settings.database_url # This file is in langflow.services.database.manager.py # the ini is in langflow langflow_dir = Path(__file__).parent.parent.parent From ced4fd080089b27c58edfb6a6eca532c7245449e Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 13:05:37 -0300 Subject: [PATCH 07/10] refactor: Update OpenAIModelComponent to use float type for temperature parameter The OpenAIModelComponent class in OpenAIModel.py has been updated to use the float type for the temperature parameter instead of the Optional[float] type. This change ensures consistency and improves code readability. The default value for the temperature parameter remains unchanged at 0.1. Note: The commit message has been generated based on the provided code changes and recent commits. --- src/backend/base/langflow/components/models/OpenAIModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/base/langflow/components/models/OpenAIModel.py b/src/backend/base/langflow/components/models/OpenAIModel.py index ced22c331..0aedce495 100644 --- a/src/backend/base/langflow/components/models/OpenAIModel.py +++ b/src/backend/base/langflow/components/models/OpenAIModel.py @@ -78,7 +78,7 @@ class OpenAIModelComponent(LCModelComponent): self, input_value: Text, openai_api_key: str, - temperature: Optional[float] = 0.1, + temperature: float = 0.1, model_name: str = "gpt-4o", max_tokens: Optional[int] = 256, model_kwargs: NestedDict = {}, From 5ea2699b29629ea6b4298e1fa5c9702808027854 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 13:08:12 -0300 Subject: [PATCH 08/10] refactor: Update DatabaseService to use settings_service for database URL --- src/backend/base/langflow/services/database/service.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/base/langflow/services/database/service.py b/src/backend/base/langflow/services/database/service.py index df1bbe224..cf3795610 100644 --- a/src/backend/base/langflow/services/database/service.py +++ b/src/backend/base/langflow/services/database/service.py @@ -20,7 +20,8 @@ from langflow.services.utils import teardown_superuser if TYPE_CHECKING: from sqlalchemy.engine import Engine - from langflow.services.settings.manager import SettingsService + + from langflow.services.settings.service import SettingsService class DatabaseService(Service): @@ -28,7 +29,9 @@ class DatabaseService(Service): def __init__(self, settings_service: "SettingsService"): self.settings_service = settings_service - self.database_url = settings_service.settings.database_url + if settings_service.settings.database_url is None: + raise ValueError("No database URL provided") + self.database_url: str = settings_service.settings.database_url # This file is in langflow.services.database.manager.py # the ini is in langflow langflow_dir = Path(__file__).parent.parent.parent @@ -274,3 +277,4 @@ class DatabaseService(Service): logger.error(f"Error tearing down database: {exc}") self.engine.dispose() + self.engine.dispose() From 25b99ef5908de5c2caf9c21b1d8d338bdd414d0d Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 14:03:23 -0300 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=93=9D=20(README.md):=20Update=20de?= =?UTF-8?q?ployment=20links=20to=20point=20to=20the=20correct=20branches?= =?UTF-8?q?=20for=20deployment=20purposes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d4776daeb..3c29e83e2 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@

- Docs - - Join our Discord - - Follow us on X - + Docs - + Join our Discord - + Follow us on X - Live demo

@@ -31,11 +31,20 @@ # πŸ“ Content -- [Get Started](#-get-started) -- [Create Flows](#-create-flows) +- [](#) +- [πŸ“ Content](#-content) +- [πŸ“¦ Get Started](#-get-started) +- [🎨 Create Flows](#-create-flows) - [Deploy](#deploy) -- [Command Line Interface (CLI)](#️-command-line-interface-cli) -- [Contribute](#-contribute) + - [Deploy Langflow on Google Cloud Platform](#deploy-langflow-on-google-cloud-platform) + - [Deploy on Railway](#deploy-on-railway) + - [Deploy on Render](#deploy-on-render) +- [πŸ–₯️ Command Line Interface (CLI)](#️-command-line-interface-cli) + - [Usage](#usage) + - [Environment Variables](#environment-variables) +- [πŸ‘‹ Contribute](#-contribute) +- [🌟 Contributors](#-contributors) +- [πŸ“„ License](#-license) # πŸ“¦ Get Started @@ -96,7 +105,7 @@ Or this one to deploy Langflow 0.6.x: ## Deploy on Render - + Deploy to Render From 23d3c45a1b2a02cc3de55a4a10e75db7661bddea Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 3 Jun 2024 14:05:33 -0300 Subject: [PATCH 10/10] refactor: Update Dockerfile and render.yaml for pre-release deployment The Dockerfile `render.pre-release.Dockerfile` has been added to the repository, which sets the base image to `langflowai/langflow:1.0-alpha`. Additionally, the `render.yaml` file has been modified to use the new Dockerfile path `./docker/render.pre-release.Dockerfile` for the `langflow` web service. This change ensures that the pre-release version of the application is deployed correctly. Note: The commit message has been generated based on the provided code changes and recent commits. --- docker/render.pre-release.Dockerfile | 1 + render.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 docker/render.pre-release.Dockerfile diff --git a/docker/render.pre-release.Dockerfile b/docker/render.pre-release.Dockerfile new file mode 100644 index 000000000..d3aa9cbde --- /dev/null +++ b/docker/render.pre-release.Dockerfile @@ -0,0 +1 @@ +FROM langflowai/langflow:1.0-alpha diff --git a/render.yaml b/render.yaml index 9276efee1..919a3e21f 100644 --- a/render.yaml +++ b/render.yaml @@ -3,7 +3,7 @@ services: - type: web name: langflow runtime: docker - dockerfilePath: ./docker/render.Dockerfile + dockerfilePath: ./docker/render.pre-release.Dockerfile repo: https://github.com/langflow-ai/langflow branch: dev healthCheckPath: /health