From 29542f4cf87e5b4a52ef77feefee4d6cb0d51e39 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 09:12:41 -0300 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=94=A7=20chore(utils.py):=20add=20s?= =?UTF-8?q?etup=5Fllm=5Fcaching=20function=20to=20set=20up=20LLM=20caching?= =?UTF-8?q?=20=E2=9C=A8=20feat(main.py):=20call=20setup=5Fllm=5Fcaching=20?= =?UTF-8?q?function=20on=20app=20startup=20The=20`setup=5Fllm=5Fcaching`?= =?UTF-8?q?=20function=20is=20added=20to=20`utils.py`=20to=20set=20up=20LL?= =?UTF-8?q?M=20caching.=20The=20function=20is=20then=20called=20on=20app?= =?UTF-8?q?=20startup=20in=20`main.py`=20using=20the=20`app.on=5Fevent("st?= =?UTF-8?q?artup")`=20method.=20This=20improves=20the=20performance=20of?= =?UTF-8?q?=20the=20application=20by=20caching=20LLM=20objects.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/utils.py | 10 ++++++++++ src/backend/langflow/main.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/backend/langflow/interface/utils.py b/src/backend/langflow/interface/utils.py index 2777025ab..668e1e6e4 100644 --- a/src/backend/langflow/interface/utils.py +++ b/src/backend/langflow/interface/utils.py @@ -7,6 +7,7 @@ import re import yaml from langchain.base_language import BaseLanguageModel from PIL.Image import Image +from langflow.utils.logger import logger def load_file_into_dict(file_path: str) -> dict: @@ -58,3 +59,12 @@ def try_setting_streaming_options(langchain_object, websocket): def extract_input_variables_from_prompt(prompt: str) -> list[str]: """Extract input variables from prompt.""" return re.findall(r"{(.*?)}", prompt) + + +def setup_llm_caching(): + """Setup LLM caching.""" + import langchain + from langchain.cache import SQLiteCache + + logger.debug("Setting up LLM caching") + langchain.llm_cache = SQLiteCache() diff --git a/src/backend/langflow/main.py b/src/backend/langflow/main.py index ad3217eb5..2a1293f2e 100644 --- a/src/backend/langflow/main.py +++ b/src/backend/langflow/main.py @@ -3,6 +3,7 @@ from fastapi.middleware.cors import CORSMiddleware from langflow.api import router from langflow.database.base import create_db_and_tables +from langflow.interface.utils import setup_llm_caching def create_app(): @@ -28,6 +29,7 @@ def create_app(): app.include_router(router) app.on_event("startup")(create_db_and_tables) + app.on_event("startup")(setup_llm_caching) return app From 89c2e5b0649eea501c9a10338da487cdf7617bf5 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 18:19:59 -0300 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=9A=80=20feat(utils.py):=20add=20su?= =?UTF-8?q?pport=20for=20configurable=20LLM=20caching=20This=20commit=20ad?= =?UTF-8?q?ds=20support=20for=20configurable=20LLM=20caching.=20The=20`set?= =?UTF-8?q?up=5Fllm=5Fcaching`=20function=20now=20imports=20the=20cache=20?= =?UTF-8?q?class=20from=20the=20`langchain.cache`=20module=20based=20on=20?= =?UTF-8?q?the=20`settings.cache`=20value.=20If=20the=20import=20is=20succ?= =?UTF-8?q?essful,=20the=20`langchain.llm=5Fcache`=20is=20set=20to=20an=20?= =?UTF-8?q?instance=20of=20the=20cache=20class.=20If=20the=20import=20fail?= =?UTF-8?q?s,=20a=20warning=20is=20logged.=20If=20an=20exception=20is=20ra?= =?UTF-8?q?ised=20during=20the=20setup,=20a=20warning=20is=20logged=20with?= =?UTF-8?q?=20the=20error=20message.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/utils.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/interface/utils.py b/src/backend/langflow/interface/utils.py index 668e1e6e4..1a37e89b4 100644 --- a/src/backend/langflow/interface/utils.py +++ b/src/backend/langflow/interface/utils.py @@ -64,7 +64,16 @@ def extract_input_variables_from_prompt(prompt: str) -> list[str]: def setup_llm_caching(): """Setup LLM caching.""" import langchain - from langchain.cache import SQLiteCache + from langflow.settings import settings + from langflow.interface.importing.utils import import_class - logger.debug("Setting up LLM caching") - langchain.llm_cache = SQLiteCache() + try: + cache_class = import_class(f"langchain.cache.{settings.cache}") + + logger.debug(f"Setting up LLM caching with {cache_class.__name__}") + langchain.llm_cache = cache_class() + logger.info(f"LLM caching setup with {cache_class.__name__}") + except ImportError: + logger.warning(f"Could not import {settings.cache}. ") + except Exception as exc: + logger.warning(f"Could not setup LLM caching. Error: {exc}") From a15da8eb0d1697cc194917606142597db260a4f9 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 18:20:13 -0300 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=9A=80=20feat(settings.py):=20add?= =?UTF-8?q?=20cache=20configuration=20option=20The=20cache=20configuration?= =?UTF-8?q?=20option=20has=20been=20added=20to=20the=20settings=20file=20w?= =?UTF-8?q?ith=20a=20default=20value=20of=20"InMemoryCache".=20This=20allo?= =?UTF-8?q?ws=20the=20user=20to=20choose=20the=20cache=20implementation=20?= =?UTF-8?q?they=20want=20to=20use.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/langflow/settings.py b/src/backend/langflow/settings.py index 9d6ac3fa9..e3644e84c 100644 --- a/src/backend/langflow/settings.py +++ b/src/backend/langflow/settings.py @@ -21,6 +21,7 @@ class Settings(BaseSettings): utilities: List[str] = [] dev: bool = False database_url: str = "sqlite:///./langflow.db" + cache: str = "InMemoryCache" remove_api_keys: bool = False class Config: From 5f56384dce10d327ea29c6ea35ed7417a8c7d028 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 18:20:21 -0300 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=9A=80=20feat(=5F=5Fmain=5F=5F.py):?= =?UTF-8?q?=20add=20support=20for=20cache=20configuration=20The=20`update?= =?UTF-8?q?=5Fsettings`=20function=20now=20accepts=20a=20`cache`=20paramet?= =?UTF-8?q?er=20that=20allows=20the=20user=20to=20specify=20the=20type=20o?= =?UTF-8?q?f=20cache=20to=20use.=20The=20`cache`=20parameter=20is=20set=20?= =?UTF-8?q?to=20a=20default=20value=20of=20`SQLiteCache`=20and=20can=20be?= =?UTF-8?q?=20overridden=20by=20setting=20the=20`LANGCHAIN=5FCACHE`=20envi?= =?UTF-8?q?ronment=20variable.=20This=20feature=20improves=20the=20flexibi?= =?UTF-8?q?lity=20of=20the=20application=20as=20it=20allows=20the=20user?= =?UTF-8?q?=20to=20choose=20the=20type=20of=20cache=20that=20best=20suits?= =?UTF-8?q?=20their=20needs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/__main__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/__main__.py b/src/backend/langflow/__main__.py index 29f60ed23..a3841ec93 100644 --- a/src/backend/langflow/__main__.py +++ b/src/backend/langflow/__main__.py @@ -30,6 +30,7 @@ def get_number_of_workers(workers=None): def update_settings( config: str, + cache: str, dev: bool = False, database_url: Optional[str] = None, remove_api_keys: bool = False, @@ -41,6 +42,8 @@ def update_settings( settings.update_settings(database_url=database_url) if remove_api_keys: settings.update_settings(remove_api_keys=remove_api_keys) + if cache: + settings.update_settings(cache=cache) def serve_on_jcloud(): @@ -102,6 +105,11 @@ def serve( ), log_level: str = typer.Option("critical", help="Logging level."), log_file: Path = typer.Option("logs/langflow.log", help="Path to the log file."), + cache: str = typer.Argument( + envvar="LANGCHAIN_CACHE", + help="Type of cache to use. (InMemoryCache, SQLiteCache)", + default="SQLiteCache", + ), jcloud: bool = typer.Option(False, help="Deploy on Jina AI Cloud"), dev: bool = typer.Option(False, help="Run in development mode (may contain bugs)"), database_url: str = typer.Option( @@ -130,7 +138,11 @@ def serve( configure(log_level=log_level, log_file=log_file) update_settings( - config, dev=dev, database_url=database_url, remove_api_keys=remove_api_keys + config, + dev=dev, + database_url=database_url, + remove_api_keys=remove_api_keys, + cache=cache, ) # get the directory of the current file if not path: From 31f3b74c90317f5ede8ba76a229b42f3ca1d5b00 Mon Sep 17 00:00:00 2001 From: Naveen Choudhary Date: Thu, 15 Jun 2023 23:08:22 -0500 Subject: [PATCH 05/10] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e504c74b8..bd50b118e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,7 @@ pymongo = "^4.4.0" certifi = "^2023.5.7" -[tool.poetry.group.dev.dependencies] +[tool.poetry.dev-dependencies] black = "^23.1.0" ipykernel = "^6.21.2" mypy = "^1.1.1" From a2197bfeb5df931909da3feb65928689186a4420 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 19:39:20 -0300 Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=90=9B=20fix(Midjorney):=20fix=20ty?= =?UTF-8?q?po=20in=20import=20statement=20and=20component=20name=20The=20i?= =?UTF-8?q?mport=20statement=20and=20component=20name=20were=20both=20miss?= =?UTF-8?q?pelled=20as=20"Midjorney"=20instead=20of=20"Midjourney".=20This?= =?UTF-8?q?=20commit=20fixes=20the=20typo=20in=20both=20places.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/icons/Midjorney/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/icons/Midjorney/index.tsx b/src/frontend/src/icons/Midjorney/index.tsx index fd09aa700..fc2daacb8 100644 --- a/src/frontend/src/icons/Midjorney/index.tsx +++ b/src/frontend/src/icons/Midjorney/index.tsx @@ -1,9 +1,9 @@ import React, { forwardRef } from "react"; -import { ReactComponent as MidjorneySVG } from "./Midjourney_Emblem.svg"; +import { ReactComponent as MidjourneySVG } from "./Midjourney_Emblem.svg"; -export const MidjorneyIcon = forwardRef< +export const MidjourneyIcon = forwardRef< SVGSVGElement, React.PropsWithChildren<{}> >((props, ref) => { - return ; + return ; }); From 263ca75fd57c430e901c24a5a4556f7ea012bee7 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 19:39:30 -0300 Subject: [PATCH 07/10] =?UTF-8?q?=E2=9C=A8=20feat(utils.ts):=20add=20new?= =?UTF-8?q?=20icons=20to=20nodeIconsLucide=20The=20import=20of=20Boxes=20a?= =?UTF-8?q?nd=20LayoutDashboard=20were=20removed=20as=20they=20were=20not?= =?UTF-8?q?=20being=20used=20in=20the=20file.=20New=20icons=20were=20added?= =?UTF-8?q?=20to=20nodeIconsLucide=20to=20improve=20the=20variety=20of=20i?= =?UTF-8?q?cons=20available=20for=20use.=20The=20new=20icons=20added=20are?= =?UTF-8?q?=20MongoDBAtlasVectorSearch,=20Pinecone,=20and=20SupabaseVector?= =?UTF-8?q?Store.=20=F0=9F=94=A5=20chore(utils.ts):=20remove=20unused=20im?= =?UTF-8?q?port=20of=20Boxes=20and=20LayoutDashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/utils.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/utils.ts b/src/frontend/src/utils.ts index 9e23d5342..a01acc137 100644 --- a/src/frontend/src/utils.ts +++ b/src/frontend/src/utils.ts @@ -45,7 +45,6 @@ import { twMerge } from "tailwind-merge"; import { ADJECTIVES, DESCRIPTIONS, NOUNS } from "./constants"; import { ComponentType, SVGProps } from "react"; import { - Boxes, Cpu, Fingerprint, Gift, @@ -53,7 +52,6 @@ import { HelpCircle, Laptop2, Layers, - LayoutDashboard, Lightbulb, Link, MessageCircle, @@ -189,7 +187,7 @@ export const nodeIcons: { HuggingFaceEmbeddings: HugginFaceIcon, IFixitLoader: IFixIcon, Meta: MetaIcon, - Midjorney: MidjorneyIcon, + Midjourney: MidjorneyIcon, NotionDirectoryLoader: NotionIcon, ChatOpenAI: OpenAiIcon, OpenAI: OpenAiIcon, @@ -290,6 +288,9 @@ export const nodeIconsLucide: { Midjorney: MidjorneyIcon as React.ForwardRefExoticComponent< ComponentType> >, + MongoDBAtlasVectorSearch: MongoDBIcon as React.ForwardRefExoticComponent< + ComponentType> + >, NotionDirectoryLoader: NotionIcon as React.ForwardRefExoticComponent< ComponentType> >, @@ -302,6 +303,9 @@ export const nodeIconsLucide: { OpenAIEmbeddings: OpenAiIcon as React.ForwardRefExoticComponent< ComponentType> >, + Pinecone: PineconeIcon as React.ForwardRefExoticComponent< + ComponentType> + >, Qdrant: QDrantIcon as React.ForwardRefExoticComponent< ComponentType> >, @@ -311,6 +315,9 @@ export const nodeIconsLucide: { SlackDirectoryLoader: SlackIcon as React.ForwardRefExoticComponent< ComponentType> >, + SupabaseVectorStore: SupabaseIcon as React.ForwardRefExoticComponent< + ComponentType> + >, agents: Rocket as React.ForwardRefExoticComponent< ComponentType> >, From 6f9e6922dfc7de9d9645e44df12a90979dee7f54 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 19:42:56 -0300 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.ts):=20correct?= =?UTF-8?q?=20typo=20in=20MidjourneyIcon=20import=20The=20import=20stateme?= =?UTF-8?q?nt=20for=20the=20MidjourneyIcon=20was=20misspelled=20as=20Midjo?= =?UTF-8?q?rneyIcon,=20which=20caused=20a=20runtime=20error.=20This=20comm?= =?UTF-8?q?it=20fixes=20the=20typo=20by=20changing=20the=20import=20statem?= =?UTF-8?q?ent=20to=20MidjourneyIcon.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/utils.ts b/src/frontend/src/utils.ts index a01acc137..834094ef0 100644 --- a/src/frontend/src/utils.ts +++ b/src/frontend/src/utils.ts @@ -33,7 +33,7 @@ import { HackerNewsIcon } from "./icons/hackerNews"; import { HugginFaceIcon } from "./icons/HuggingFace"; import { IFixIcon } from "./icons/IFixIt"; import { MetaIcon } from "./icons/Meta"; -import { MidjorneyIcon } from "./icons/Midjorney"; +import { MidjourneyIcon } from "./icons/Midjorney"; import { NotionIcon } from "./icons/Notion"; import { OpenAiIcon } from "./icons/OpenAi"; import { QDrantIcon } from "./icons/QDrant"; @@ -187,7 +187,7 @@ export const nodeIcons: { HuggingFaceEmbeddings: HugginFaceIcon, IFixitLoader: IFixIcon, Meta: MetaIcon, - Midjourney: MidjorneyIcon, + Midjourney: MidjourneyIcon, NotionDirectoryLoader: NotionIcon, ChatOpenAI: OpenAiIcon, OpenAI: OpenAiIcon, @@ -285,7 +285,7 @@ export const nodeIconsLucide: { Meta: MetaIcon as React.ForwardRefExoticComponent< ComponentType> >, - Midjorney: MidjorneyIcon as React.ForwardRefExoticComponent< + Midjorney: MidjourneyIcon as React.ForwardRefExoticComponent< ComponentType> >, MongoDBAtlasVectorSearch: MongoDBIcon as React.ForwardRefExoticComponent< From 5cd809ea6a40c0c6384a18727593eab11756155f Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 19:45:00 -0300 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=94=BC=20chore(pyproject.toml):=20u?= =?UTF-8?q?pdate=20langchain=20dependency=20to=20version=200.0.215=20?= =?UTF-8?q?=F0=9F=94=BC=20chore(pyproject.toml):=20bump=20package=20versio?= =?UTF-8?q?n=20to=200.2.1=20The=20langchain=20dependency=20has=20been=20up?= =?UTF-8?q?dated=20to=20version=200.0.215,=20which=20includes=20bug=20fixe?= =?UTF-8?q?s=20and=20performance=20improvements.=20The=20package=20version?= =?UTF-8?q?=20has=20been=20bumped=20to=200.2.1=20to=20reflect=20the=20chan?= =?UTF-8?q?ges=20made.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 72 ++++++++++++++++++++++++-------------------------- pyproject.toml | 4 +-- 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/poetry.lock b/poetry.lock index ef3ad4285..81019657b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -296,14 +296,14 @@ tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pyte [[package]] name = "authlib" -version = "1.2.0" +version = "1.2.1" description = "The ultimate Python library in building OAuth and OpenID Connect servers and clients." category = "main" optional = false python-versions = "*" files = [ - {file = "Authlib-1.2.0-py2.py3-none-any.whl", hash = "sha256:4ddf4fd6cfa75c9a460b361d4bd9dac71ffda0be879dbe4292a02e92349ad55a"}, - {file = "Authlib-1.2.0.tar.gz", hash = "sha256:4fa3e80883a5915ef9f5bc28630564bc4ed5b5af39812a3ff130ec76bd631e9d"}, + {file = "Authlib-1.2.1-py2.py3-none-any.whl", hash = "sha256:c88984ea00149a90e3537c964327da930779afa4564e354edfd98410bea01911"}, + {file = "Authlib-1.2.1.tar.gz", hash = "sha256:421f7c6b468d907ca2d9afede256f068f87e34d23dd221c07d13d4c234726afb"}, ] [package.dependencies] @@ -2580,14 +2580,14 @@ test = ["ipykernel", "pre-commit", "pytest", "pytest-cov", "pytest-timeout"] [[package]] name = "keyring" -version = "24.1.0" +version = "24.2.0" description = "Store and access your passwords safely." category = "main" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "keyring-24.1.0-py3-none-any.whl", hash = "sha256:ade5e1e7710a7579d7c01e64a712926270239aba48055b1cdc6c022dd6d789b5"}, - {file = "keyring-24.1.0.tar.gz", hash = "sha256:bd48a36612ef55505bf70e563528e3e66ba93267e344b6780cf6151f9c1eda6d"}, + {file = "keyring-24.2.0-py3-none-any.whl", hash = "sha256:4901caaf597bfd3bbd78c9a0c7c4c29fcd8310dab2cffefe749e916b6527acd6"}, + {file = "keyring-24.2.0.tar.gz", hash = "sha256:ca0746a19ec421219f4d713f848fa297a661a8a8c1504867e55bfb5e09091509"}, ] [package.dependencies] @@ -2604,14 +2604,14 @@ testing = ["pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", [[package]] name = "langchain" -version = "0.0.211" +version = "0.0.215" description = "Building applications with LLMs through composability" category = "main" optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langchain-0.0.211-py3-none-any.whl", hash = "sha256:527b602466d68e5c4e82c550cb6e218d7fe0e1b3d37f97beddc13785a75dbf96"}, - {file = "langchain-0.0.211.tar.gz", hash = "sha256:35b43d4492ef3de67b6ea0168f12a489029cae0f5c4031d5c907764168b177cb"}, + {file = "langchain-0.0.215-py3-none-any.whl", hash = "sha256:af9587c2eb317a6e33123f8a4ee8ccd8685cfab62359ea4fec52c962d9646acf"}, + {file = "langchain-0.0.215.tar.gz", hash = "sha256:a6b261f3be941eeac2d9b37fbf8996fa4279ef724f064e8c90813046126da85b"}, ] [package.dependencies] @@ -5445,41 +5445,39 @@ tests = ["black (>=22.3.0)", "flake8 (>=3.8.2)", "matplotlib (>=3.1.3)", "mypy ( [[package]] name = "scipy" -version = "1.10.1" +version = "1.11.0" description = "Fundamental algorithms for scientific computing in Python" category = "main" optional = false -python-versions = "<3.12,>=3.8" +python-versions = "<3.13,>=3.9" files = [ - {file = "scipy-1.10.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e7354fd7527a4b0377ce55f286805b34e8c54b91be865bac273f527e1b839019"}, - {file = "scipy-1.10.1-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:4b3f429188c66603a1a5c549fb414e4d3bdc2a24792e061ffbd607d3d75fd84e"}, - {file = "scipy-1.10.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1553b5dcddd64ba9a0d95355e63fe6c3fc303a8fd77c7bc91e77d61363f7433f"}, - {file = "scipy-1.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c0ff64b06b10e35215abce517252b375e580a6125fd5fdf6421b98efbefb2d2"}, - {file = "scipy-1.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:fae8a7b898c42dffe3f7361c40d5952b6bf32d10c4569098d276b4c547905ee1"}, - {file = "scipy-1.10.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0f1564ea217e82c1bbe75ddf7285ba0709ecd503f048cb1236ae9995f64217bd"}, - {file = "scipy-1.10.1-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:d925fa1c81b772882aa55bcc10bf88324dadb66ff85d548c71515f6689c6dac5"}, - {file = "scipy-1.10.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aaea0a6be54462ec027de54fca511540980d1e9eea68b2d5c1dbfe084797be35"}, - {file = "scipy-1.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15a35c4242ec5f292c3dd364a7c71a61be87a3d4ddcc693372813c0b73c9af1d"}, - {file = "scipy-1.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:43b8e0bcb877faf0abfb613d51026cd5cc78918e9530e375727bf0625c82788f"}, - {file = "scipy-1.10.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5678f88c68ea866ed9ebe3a989091088553ba12c6090244fdae3e467b1139c35"}, - {file = "scipy-1.10.1-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:39becb03541f9e58243f4197584286e339029e8908c46f7221abeea4b749fa88"}, - {file = "scipy-1.10.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bce5869c8d68cf383ce240e44c1d9ae7c06078a9396df68ce88a1230f93a30c1"}, - {file = "scipy-1.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07c3457ce0b3ad5124f98a86533106b643dd811dd61b548e78cf4c8786652f6f"}, - {file = "scipy-1.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:049a8bbf0ad95277ffba9b3b7d23e5369cc39e66406d60422c8cfef40ccc8415"}, - {file = "scipy-1.10.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:cd9f1027ff30d90618914a64ca9b1a77a431159df0e2a195d8a9e8a04c78abf9"}, - {file = "scipy-1.10.1-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:79c8e5a6c6ffaf3a2262ef1be1e108a035cf4f05c14df56057b64acc5bebffb6"}, - {file = "scipy-1.10.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:51af417a000d2dbe1ec6c372dfe688e041a7084da4fdd350aeb139bd3fb55353"}, - {file = "scipy-1.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1b4735d6c28aad3cdcf52117e0e91d6b39acd4272f3f5cd9907c24ee931ad601"}, - {file = "scipy-1.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:7ff7f37b1bf4417baca958d254e8e2875d0cc23aaadbe65b3d5b3077b0eb23ea"}, - {file = "scipy-1.10.1.tar.gz", hash = "sha256:2cf9dfb80a7b4589ba4c40ce7588986d6d5cebc5457cad2c2880f6bc2d42f3a5"}, + {file = "scipy-1.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2e4f14c11fbf825319dbd7f467639a241e7c956c34edb1e036ec7bb6271e4f7b"}, + {file = "scipy-1.11.0-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:b269ed44e2e2e43611f2ae95ba551fd98abbdc1a7ea8268f72f75876982368c4"}, + {file = "scipy-1.11.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c29bae479b17d85208dfdfc67e50d5944ee23211f236728aadde9b0b7c1c33e"}, + {file = "scipy-1.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a53f9cebcfda6158c241c35a559407a4ef6b8cb0863eb4144958fe0a0b7c3dae"}, + {file = "scipy-1.11.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:ebf4b2ea26d50312731ddba2406389c5ddcbff9d777cf3277ea11decc81e5dfb"}, + {file = "scipy-1.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:894ced9a2cdb050ff5e392f274617af46dca896d5c9112fa4a2019929554d321"}, + {file = "scipy-1.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7a92bd3cd4acad2e0e0b360176d5ec68b100983c8145add8a8233acddf4e5fcc"}, + {file = "scipy-1.11.0-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:586608ea35206257d4e0ce6f154a6cfef71723b2c1f6d40de5e0b0e8a81cd2ff"}, + {file = "scipy-1.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d8e631c3c49c24f30828580b8126fe3be5cca5409dad5b797418a5b8965eeafa"}, + {file = "scipy-1.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ccc70892ea674f93183c5c4139557b611e42f644dd755da4b19ca974ab770672"}, + {file = "scipy-1.11.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80015b8928f91bd40377b2b1010ba2e09b03680cbfc291208740494aeb8debf2"}, + {file = "scipy-1.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:6302c7cba5bf99c901653ff158746625526cc438f058bce41514d7469b79b2c3"}, + {file = "scipy-1.11.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c61ea63124da6a3cff38126426912cc86420898b4902a9bc5e5b6524547a6dcb"}, + {file = "scipy-1.11.0-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:684d44607eacd5dd367c7a9e76e922523fa9c0a7f2379a4d0fc4d70d751464cc"}, + {file = "scipy-1.11.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f0c9c160d117fe71cd2a12ef21cce8e0475ade2fd97c761ef327b9839089bd16"}, + {file = "scipy-1.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:83867a63515c4e3fce3272d81200dda614d70f4c3a22f047d84021bfe83d7929"}, + {file = "scipy-1.11.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:6666a1e31b2123a077f0dc7ab1053e36479cfd457fb9f5c367e7198505c6607a"}, + {file = "scipy-1.11.0-cp39-cp39-win_amd64.whl", hash = "sha256:fad4006248513528e0c496de295a9f4d2b65086cc0e388f748e7dbf49fa12760"}, + {file = "scipy-1.11.0.tar.gz", hash = "sha256:f9b0248cb9d08eead44cde47cbf6339f1e9aa0dfde28f5fb27950743e317bd5d"}, ] [package.dependencies] -numpy = ">=1.19.5,<1.27.0" +numpy = ">=1.21.6,<1.28.0" [package.extras] -dev = ["click", "doit (>=0.36.0)", "flake8", "mypy", "pycodestyle", "pydevtool", "rich-click", "typing_extensions"] -doc = ["matplotlib (>2)", "numpydoc", "pydata-sphinx-theme (==0.9.0)", "sphinx (!=4.1.0)", "sphinx-design (>=0.2.0)"] +dev = ["click", "cython-lint (>=0.12.2)", "doit (>=0.36.0)", "mypy", "pycodestyle", "pydevtool", "rich-click", "ruff", "types-psutil", "typing_extensions"] +doc = ["jupytext", "matplotlib (>2)", "myst-nb", "numpydoc", "pooch", "pydata-sphinx-theme (==0.9.0)", "sphinx (!=4.1.0)", "sphinx-design (>=0.2.0)"] test = ["asv", "gmpy2", "mpmath", "pooch", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"] [[package]] @@ -7117,4 +7115,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "e7b18762564269aaf9c6b046fa151f5e3acf85444f38653503341f658155e70a" +content-hash = "2f8373e1c80ce345f39ed9247fd4759ae94b5c754c4e850d3aa72183556eb92b" diff --git a/pyproject.toml b/pyproject.toml index bd50b118e..069662355 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "0.2.0" +version = "0.2.1" description = "A Python package with a built-in web application" authors = ["Logspace "] maintainers = [ @@ -30,7 +30,7 @@ google-search-results = "^2.4.1" google-api-python-client = "^2.79.0" typer = "^0.9.0" gunicorn = "^20.1.0" -langchain = "^0.0.211" +langchain = "^0.0.215" openai = "^0.27.8" types-pyyaml = "^6.0.12.8" pandas = "^1.5.3" From a3efa8fe5d62cc56935bd36ce22ba0cb9ff52a63 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 19:52:49 -0300 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.py):=20fix=20imp?= =?UTF-8?q?ort=20order=20to=20avoid=20import=20errors=20The=20import=20ord?= =?UTF-8?q?er=20was=20changed=20to=20avoid=20import=20errors.=20The=20impo?= =?UTF-8?q?rt=20of=20langchain=20was=20moved=20to=20the=20top=20of=20the?= =?UTF-8?q?=20file=20to=20avoid=20circular=20import=20errors.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/interface/utils.py b/src/backend/langflow/interface/utils.py index 1a37e89b4..8d45aa1b1 100644 --- a/src/backend/langflow/interface/utils.py +++ b/src/backend/langflow/interface/utils.py @@ -63,11 +63,12 @@ def extract_input_variables_from_prompt(prompt: str) -> list[str]: def setup_llm_caching(): """Setup LLM caching.""" - import langchain - from langflow.settings import settings - from langflow.interface.importing.utils import import_class try: + import langchain + from langflow.settings import settings + from langflow.interface.importing.utils import import_class + cache_class = import_class(f"langchain.cache.{settings.cache}") logger.debug(f"Setting up LLM caching with {cache_class.__name__}")