From fa9a3a210b724db7c82b60d04ecfedd7095dbbd8 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sat, 27 May 2023 23:39:05 -0300 Subject: [PATCH 01/26] =?UTF-8?q?=F0=9F=90=9B=20fix(base.py):=20change=20c?= =?UTF-8?q?ondition=20to=20check=20if=20content=20is=20empty=20instead=20o?= =?UTF-8?q?f=20None=20The=20previous=20condition=20was=20checking=20if=20t?= =?UTF-8?q?he=20content=20was=20None,=20but=20it=20should=20check=20if=20i?= =?UTF-8?q?t=20is=20empty.=20This=20change=20fixes=20the=20error=20message?= =?UTF-8?q?=20to=20be=20more=20accurate.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/cache/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/langflow/cache/base.py b/src/backend/langflow/cache/base.py index 1f2039b27..0f1ff5d92 100644 --- a/src/backend/langflow/cache/base.py +++ b/src/backend/langflow/cache/base.py @@ -120,7 +120,7 @@ def save_binary_file(content: str, file_name: str, accepted_types: list[str]) -> # Get the destination folder cache_path = Path(tempfile.gettempdir()) / PREFIX - if content is None: + if not content: raise ValueError("Please, reload the file in the loader.") data = content.split(",")[1] decoded_bytes = base64.b64decode(data) From 209e31da26dd95c4e6c274a3f0b0ab17dd3679e5 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Rosalino Date: Sun, 28 May 2023 02:05:32 -0300 Subject: [PATCH 02/26] feat: adds NotionDirectoryLoader --- src/backend/langflow/config.yaml | 1 + .../interface/document_loaders/base.py | 2 +- .../inputDirectoryComponent/index.tsx | 98 +++++++++++++++++++ 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 src/frontend/src/components/inputDirectoryComponent/index.tsx diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index b1da1b622..6dadc7a88 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -42,6 +42,7 @@ documentloaders: - IMSDbLoader - GitbookLoader - ReadTheDocsLoader + - NotionDirectoryLoader embeddings: - OpenAIEmbeddings - HuggingFaceEmbeddings diff --git a/src/backend/langflow/interface/document_loaders/base.py b/src/backend/langflow/interface/document_loaders/base.py index aab017c0f..a13d5cd5b 100644 --- a/src/backend/langflow/interface/document_loaders/base.py +++ b/src/backend/langflow/interface/document_loaders/base.py @@ -118,7 +118,7 @@ class DocumentLoaderCreator(LangChainTypeCreator): "value": "", "display_name": "Web Page", } - elif name in {"ReadTheDocsLoader"}: + elif name in {"ReadTheDocsLoader", "NotionDirectoryLoader"}: signature["template"]["path"] = { "type": "str", "required": True, diff --git a/src/frontend/src/components/inputDirectoryComponent/index.tsx b/src/frontend/src/components/inputDirectoryComponent/index.tsx new file mode 100644 index 000000000..eb167bbee --- /dev/null +++ b/src/frontend/src/components/inputDirectoryComponent/index.tsx @@ -0,0 +1,98 @@ +import { DocumentMagnifyingGlassIcon } from "@heroicons/react/24/outline"; +import { useContext, useEffect, useState } from "react"; +import { alertContext } from "../../contexts/alertContext"; +import { FileComponentType } from "../../types/components"; + +export default function InputDirectoryComponent({ + value, + onChange, + disabled, + suffixes, + fileTypes, + onFileChange, +}: FileComponentType) { + const [myValue, setMyValue] = useState(value); + const { setErrorData } = useContext(alertContext); + useEffect(() => { + if (disabled) { + setMyValue(""); + onChange(""); + onFileChange(""); + } + }, [disabled, onChange]); + + function attachFiles(files) { + onFileChange(files); + } + + function checkFileType(fileName: string): boolean { + for (let index = 0; index < suffixes.length; index++) { + if (fileName.endsWith(suffixes[index])) { + return true; + } + } + return false; + } + + const handleDirectoryButtonClick = () => { + const input = document.createElement("input"); + input.type = "file"; + input.accept = suffixes.join(","); + input.style.display = "none"; + input.multiple = true; + input.webkitdirectory = true; + input.onchange = (e: Event) => { + const filesArray = []; + const inputElement = e.target as HTMLInputElement; + console.log(inputElement.webkitEntries); // Not working + const files = (e.target as HTMLInputElement).files; + const directory = (e.target as HTMLInputElement).dirName; // Not working + + console.log(directory); + if (files) { + for (let index = 0; index < files.length; index++) { + const file = files[index]; + if (checkFileType(file.name)) { + console.log("going in: ", file); + filesArray.push(file); + } + } + if (filesArray.length > 0) { + setMyValue(filesArray[0].webkitRelativePath); + onChange(filesArray[0].webkitRelativePath); + attachFiles(filesArray[0].webkitRelativePath); + } else { + setErrorData({ + title: + "Please select a valid directory. Only directories containing files with these file types are allowed:", + list: fileTypes, + }); + } + } + }; + input.click(); + }; + + return ( +
+
+ + {myValue !== "" ? myValue : "No directory"} + + +
+
+ ); +} From 36910ff1872ea26a20c29b5164b9320d313222e3 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Rosalino Date: Sun, 28 May 2023 02:13:24 -0300 Subject: [PATCH 03/26] chore: removed not needed inputDirectoryComponent --- .../inputDirectoryComponent/index.tsx | 98 ------------------- 1 file changed, 98 deletions(-) delete mode 100644 src/frontend/src/components/inputDirectoryComponent/index.tsx diff --git a/src/frontend/src/components/inputDirectoryComponent/index.tsx b/src/frontend/src/components/inputDirectoryComponent/index.tsx deleted file mode 100644 index eb167bbee..000000000 --- a/src/frontend/src/components/inputDirectoryComponent/index.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { DocumentMagnifyingGlassIcon } from "@heroicons/react/24/outline"; -import { useContext, useEffect, useState } from "react"; -import { alertContext } from "../../contexts/alertContext"; -import { FileComponentType } from "../../types/components"; - -export default function InputDirectoryComponent({ - value, - onChange, - disabled, - suffixes, - fileTypes, - onFileChange, -}: FileComponentType) { - const [myValue, setMyValue] = useState(value); - const { setErrorData } = useContext(alertContext); - useEffect(() => { - if (disabled) { - setMyValue(""); - onChange(""); - onFileChange(""); - } - }, [disabled, onChange]); - - function attachFiles(files) { - onFileChange(files); - } - - function checkFileType(fileName: string): boolean { - for (let index = 0; index < suffixes.length; index++) { - if (fileName.endsWith(suffixes[index])) { - return true; - } - } - return false; - } - - const handleDirectoryButtonClick = () => { - const input = document.createElement("input"); - input.type = "file"; - input.accept = suffixes.join(","); - input.style.display = "none"; - input.multiple = true; - input.webkitdirectory = true; - input.onchange = (e: Event) => { - const filesArray = []; - const inputElement = e.target as HTMLInputElement; - console.log(inputElement.webkitEntries); // Not working - const files = (e.target as HTMLInputElement).files; - const directory = (e.target as HTMLInputElement).dirName; // Not working - - console.log(directory); - if (files) { - for (let index = 0; index < files.length; index++) { - const file = files[index]; - if (checkFileType(file.name)) { - console.log("going in: ", file); - filesArray.push(file); - } - } - if (filesArray.length > 0) { - setMyValue(filesArray[0].webkitRelativePath); - onChange(filesArray[0].webkitRelativePath); - attachFiles(filesArray[0].webkitRelativePath); - } else { - setErrorData({ - title: - "Please select a valid directory. Only directories containing files with these file types are allowed:", - list: fileTypes, - }); - } - } - }; - input.click(); - }; - - return ( -
-
- - {myValue !== "" ? myValue : "No directory"} - - -
-
- ); -} From 023df99ecc7c07da78b8f7f545685e255c20f427 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 16:18:33 -0300 Subject: [PATCH 04/26] =?UTF-8?q?=F0=9F=94=A8=20refactor(embeddings.py):?= =?UTF-8?q?=20move=20openai=20fields=20formatting=20to=20a=20separate=20me?= =?UTF-8?q?thod=20=E2=9C=85=20test(embeddings=5Ftemplate.py):=20add=20test?= =?UTF-8?q?s=20for=20openai=20fields=20formatting=20The=20openai=20fields?= =?UTF-8?q?=20formatting=20is=20now=20done=20in=20a=20separate=20method,?= =?UTF-8?q?=20which=20improves=20the=20readability=20and=20maintainability?= =?UTF-8?q?=20of=20the=20code.=20Tests=20were=20added=20to=20ensure=20that?= =?UTF-8?q?=20the=20formatting=20is=20done=20correctly.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/frontend_node/embeddings.py | 21 +++++-- tests/test_embeddings_template.py | 59 +++++++++++++++++++ 2 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 tests/test_embeddings_template.py diff --git a/src/backend/langflow/template/frontend_node/embeddings.py b/src/backend/langflow/template/frontend_node/embeddings.py index d21e12e73..d466b11a4 100644 --- a/src/backend/langflow/template/frontend_node/embeddings.py +++ b/src/backend/langflow/template/frontend_node/embeddings.py @@ -22,6 +22,22 @@ class EmbeddingFrontendNode(FrontendNode): field.display_name = "Jina API URL" field.password = False + @staticmethod + def format_openai_fields(field: TemplateField): + if "openai" in field.name: + field.show = True + field.advanced = True + split_name = field.name.split("_") + title_name = " ".join([s.capitalize() for s in split_name]) + field.display_name = title_name.replace("Openai", "OpenAI").replace( + "Api", "API" + ) + + if "api_key" in field.name: + field.password = True + field.show = True + field.advanced = False + @staticmethod def format_field(field: TemplateField, name: Optional[str] = None) -> None: FrontendNode.format_field(field, name) @@ -30,9 +46,6 @@ class EmbeddingFrontendNode(FrontendNode): if field.name == "headers": field.show = False - if "openai" in field.name: - field.show = True - field.advanced = "api_key" not in field.name - # Format Jina fields EmbeddingFrontendNode.format_jina_fields(field) + EmbeddingFrontendNode.format_openai_fields(field) diff --git a/tests/test_embeddings_template.py b/tests/test_embeddings_template.py new file mode 100644 index 000000000..7334c2abd --- /dev/null +++ b/tests/test_embeddings_template.py @@ -0,0 +1,59 @@ +from langflow.template.field.base import TemplateField +from langflow.template.frontend_node.embeddings import EmbeddingFrontendNode + + +def test_format_jina_fields(): + field = TemplateField(name="jina") + EmbeddingFrontendNode.format_jina_fields(field) + assert field.show is True + assert field.advanced is False + + field = TemplateField(name="auth") + EmbeddingFrontendNode.format_jina_fields(field) + assert field.password is True + assert field.show is True + assert field.advanced is False + + field = TemplateField(name="jina_api_url") + EmbeddingFrontendNode.format_jina_fields(field) + assert field.show is True + assert field.advanced is True + assert field.display_name == "Jina API URL" + assert field.password is False + + +def test_format_openai_fields(): + field = TemplateField(name="openai") + EmbeddingFrontendNode.format_openai_fields(field) + assert field.show is True + assert field.advanced is True + assert field.display_name == "OpenAI" + + field = TemplateField(name="openai_api_key") + EmbeddingFrontendNode.format_openai_fields(field) + assert field.password is True + assert field.show is True + assert field.advanced is False + + +def test_format_field(): + field = TemplateField(name="headers") + EmbeddingFrontendNode.format_field(field) + assert field.show is False + + field = TemplateField(name="jina") + EmbeddingFrontendNode.format_field(field) + assert field.advanced is False + assert field.show is True + + field = TemplateField(name="openai") + EmbeddingFrontendNode.format_field(field) + assert field.advanced is True + assert field.show is True + assert field.display_name == "OpenAI" + + field = TemplateField(name="test_field", required=True) + EmbeddingFrontendNode.format_field(field) + assert field.advanced is False + assert field.show is True + assert field.required is True From 4848759aeb6bd0568df868bb588841092865c6ac Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 16:36:57 -0300 Subject: [PATCH 05/26] =?UTF-8?q?=F0=9F=9A=80=20chore(Makefile):=20add=20m?= =?UTF-8?q?ake=20targets=20to=20install=20backend=20and=20frontend=20depen?= =?UTF-8?q?dencies=20The=20Makefile=20now=20has=20two=20new=20targets,=20`?= =?UTF-8?q?install=5Fbackend`=20and=20`install=5Ffrontend`,=20which=20inst?= =?UTF-8?q?all=20the=20dependencies=20for=20the=20backend=20and=20frontend?= =?UTF-8?q?=20respectively.=20This=20makes=20it=20easier=20for=20developer?= =?UTF-8?q?s=20to=20set=20up=20the=20project=20as=20they=20can=20now=20run?= =?UTF-8?q?=20`make=20init`=20to=20install=20the=20pre-commit=20hooks=20an?= =?UTF-8?q?d=20all=20dependencies.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index e03967b23..fdb09a13e 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,10 @@ all: help init: @echo 'Installing pre-commit hooks' git config core.hooksPath .githooks + @echo 'Installing backend dependencies' + make install_backend + @echo 'Installing frontend dependencies' + make install_frontend coverage: poetry run pytest --cov \ From c2027898de8d1500c36aa7547d1a23c09b58519f Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 17:14:49 -0300 Subject: [PATCH 06/26] =?UTF-8?q?=F0=9F=90=9B=20fix(config.yaml):=20add=20?= =?UTF-8?q?CTransformers=20to=20the=20list=20of=20supported=20llms=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(utils.py):=20fix=20setting=20of=20streaming?= =?UTF-8?q?=20option=20for=20llm=20=F0=9F=8E=A8=20style(llms.py):=20add=20?= =?UTF-8?q?model=5Ffile=20and=20model=5Ftype=20fields=20to=20the=20list=20?= =?UTF-8?q?of=20non-advanced=20fields=20The=20first=20change=20adds=20CTra?= =?UTF-8?q?nsformers=20to=20the=20list=20of=20supported=20llms=20in=20the?= =?UTF-8?q?=20config.yaml=20file.=20The=20second=20change=20fixes=20a=20bu?= =?UTF-8?q?g=20in=20the=20try=5Fsetting=5Fstreaming=5Foptions=20function?= =?UTF-8?q?=20in=20utils.py=20where=20the=20streaming=20option=20was=20not?= =?UTF-8?q?=20being=20set=20correctly.=20The=20third=20change=20is=20a=20s?= =?UTF-8?q?tyle=20change=20that=20adds=20the=20model=5Ffile=20and=20model?= =?UTF-8?q?=5Ftype=20fields=20to=20the=20list=20of=20non-advanced=20fields?= =?UTF-8?q?=20in=20the=20LLMFrontendNode=20class=20in=20llms.py.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/config.yaml | 4 ++-- src/backend/langflow/interface/utils.py | 4 ++-- src/backend/langflow/template/frontend_node/llms.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index b1da1b622..18bdaf9e2 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -45,13 +45,13 @@ documentloaders: embeddings: - OpenAIEmbeddings - HuggingFaceEmbeddings - llms: - OpenAI # - AzureOpenAI - ChatOpenAI - HuggingFaceHub - LlamaCpp + - CTransformers memories: - ConversationBufferMemory - ConversationSummaryMemory @@ -113,7 +113,7 @@ vectorstores: - Qdrant - Weaviate wrappers: - - RequestsWrapper # Wait more tests + - RequestsWrapper # - ChatPromptTemplate # - SystemMessagePromptTemplate # - HumanMessagePromptTemplate diff --git a/src/backend/langflow/interface/utils.py b/src/backend/langflow/interface/utils.py index 7368fda3e..2b7c5acd1 100644 --- a/src/backend/langflow/interface/utils.py +++ b/src/backend/langflow/interface/utils.py @@ -44,7 +44,7 @@ def try_setting_streaming_options(langchain_object, websocket): langchain_object.llm_chain, "llm" ): llm = langchain_object.llm_chain.llm - if isinstance(llm, BaseLanguageModel): - llm.streaming = bool(hasattr(llm, "streaming")) + if isinstance(llm, BaseLanguageModel) and hasattr(llm, "streaming"): + llm.streaming = True return langchain_object diff --git a/src/backend/langflow/template/frontend_node/llms.py b/src/backend/langflow/template/frontend_node/llms.py index 4dc32dff1..272770e2e 100644 --- a/src/backend/langflow/template/frontend_node/llms.py +++ b/src/backend/langflow/template/frontend_node/llms.py @@ -43,7 +43,7 @@ class LLMFrontendNode(FrontendNode): field.field_type = "code" field.advanced = True field.show = True - elif field.name in ["model_name", "temperature"]: + elif field.name in ["model_name", "temperature", "model_file", "model_type"]: field.advanced = False field.show = True From f315d78f14871b99c94ec389cecc69f5e31c978f Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 17:15:10 -0300 Subject: [PATCH 07/26] =?UTF-8?q?=F0=9F=94=BA=20chore(pyproject.toml):=20u?= =?UTF-8?q?pdate=20langchain=20dependency=20from=200.0.176=20to=200.0.183?= =?UTF-8?q?=20=E2=9C=A8=20feat(pyproject.toml):=20add=20ctransformers=20de?= =?UTF-8?q?pendency=20to=20support=20text=20classification=20tasks=20The?= =?UTF-8?q?=20langchain=20dependency=20has=20been=20updated=20to=20version?= =?UTF-8?q?=200.0.183=20to=20ensure=20that=20the=20latest=20features=20and?= =?UTF-8?q?=20bug=20fixes=20are=20available.=20The=20ctransformers=20depen?= =?UTF-8?q?dency=20has=20been=20added=20to=20support=20text=20classificati?= =?UTF-8?q?on=20tasks.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 37 +++++++++++++++++++++++++++---------- pyproject.toml | 3 ++- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/poetry.lock b/poetry.lock index aad835dc1..201830ac9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -876,6 +876,24 @@ test = ["iso8601", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-co test-randomorder = ["pytest-randomly"] tox = ["tox"] +[[package]] +name = "ctransformers" +version = "0.2.2" +description = "Python bindings for the Transformer models implemented in C/C++ using GGML library." +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "ctransformers-0.2.2-py3-none-any.whl", hash = "sha256:bf682dd0293dd87911c9a9a1169a4873ff55baebc16d465c6029c77f11b18cf6"}, + {file = "ctransformers-0.2.2.tar.gz", hash = "sha256:1fc36b3fde36d9fd3cb69e48993315bb1f5f54ae552720eb909dc4b3a131c743"}, +] + +[package.dependencies] +huggingface-hub = "*" + +[package.extras] +tests = ["pytest"] + [[package]] name = "dataclasses-json" version = "0.5.7" @@ -2293,14 +2311,14 @@ test = ["ipykernel", "pre-commit", "pytest", "pytest-cov", "pytest-timeout"] [[package]] name = "langchain" -version = "0.0.176" +version = "0.0.183" description = "Building applications with LLMs through composability" category = "main" optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langchain-0.0.176-py3-none-any.whl", hash = "sha256:b2a1958ed07d884869b4bdaa28d63a005787e7f4938d2bbe984b3662827db861"}, - {file = "langchain-0.0.176.tar.gz", hash = "sha256:25f2875d48efab9b32affbe886b85580b1a9df0fb5ae54798eb28aeafba60bec"}, + {file = "langchain-0.0.183-py3-none-any.whl", hash = "sha256:d98e56bf5189599f6500d59908f85b5a6cdf65545e34b41165c7c98beb1ccd0e"}, + {file = "langchain-0.0.183.tar.gz", hash = "sha256:ec9712ae9d11b14f02e703f123d9493f82d49fd80e86df4ff4014df2af06aeca"}, ] [package.dependencies] @@ -2317,14 +2335,13 @@ SQLAlchemy = ">=1.4,<3" tenacity = ">=8.1.0,<9.0.0" [package.extras] -all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.2.6,<0.3.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.3.0,<4.0.0)", "docarray (>=0.31.0,<0.32.0)", "duckduckgo-search (>=2.8.6,<3.0.0)", "elasticsearch (>=8,<9)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "hnswlib (>=0.7.0,<0.8.0)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jina (>=3.14,<4.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "lark (>=1.1.5,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "networkx (>=2.6.3,<3.0.0)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "protobuf (==3.19.6)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.1.2,<2.0.0)", "redis (>=4,<5)", "sentence-transformers (>=2,<3)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tiktoken (>=0.3.2,<0.4.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] -azure = ["azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "openai (>=0,<1)"] +all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.2.6,<0.3.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.3.0,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=2.8.6,<3.0.0)", "elasticsearch (>=8,<9)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jina (>=3.14,<4.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "langkit (>=0.0.1.dev3,<0.1.0)", "lark (>=1.1.5,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "momento (>=1.5.0,<2.0.0)", "neo4j (>=5.8.1,<6.0.0)", "networkx (>=2.6.3,<3.0.0)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.1.2,<2.0.0)", "redis (>=4,<5)", "requests-toolbelt (>=1.0.0,<2.0.0)", "sentence-transformers (>=2,<3)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tiktoken (>=0.3.2,<0.4.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] +azure = ["azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "openai (>=0,<1)"] cohere = ["cohere (>=3,<4)"] +docarray = ["docarray[hnswlib] (>=0.32.0,<0.33.0)"] embeddings = ["sentence-transformers (>=2,<3)"] -extended-testing = ["atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "chardet (>=5.1.0,<6.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "psychicapi (>=0.2,<0.3)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.25,<0.26)"] -hnswlib = ["docarray (>=0.31.0,<0.32.0)", "hnswlib (>=0.7.0,<0.8.0)", "protobuf (==3.19.6)"] -in-memory-store = ["docarray (>=0.31.0,<0.32.0)"] -llms = ["anthropic (>=0.2.6,<0.3.0)", "cohere (>=3,<4)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "torch (>=1,<3)", "transformers (>=4,<5)"] +extended-testing = ["atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "chardet (>=5.1.0,<6.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "psychicapi (>=0.2,<0.3)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.30,<0.31)"] +llms = ["anthropic (>=0.2.6,<0.3.0)", "cohere (>=3,<4)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "torch (>=1,<3)", "transformers (>=4,<5)"] openai = ["openai (>=0,<1)", "tiktoken (>=0.3.2,<0.4.0)"] qdrant = ["qdrant-client (>=1.1.2,<2.0.0)"] text-helpers = ["chardet (>=5.1.0,<6.0.0)"] @@ -6133,4 +6150,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "abbb024a67e3326821999f9a0a6164b13e877b0b72d1cd6912ca694c83fffa22" +content-hash = "76ed90caa5b359e5c367272e7db37230e8dea200e7171f1ccfc2015eacebe1b0" diff --git a/pyproject.toml b/pyproject.toml index 1cb6f3581..f261aea9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ google-search-results = "^2.4.1" google-api-python-client = "^2.79.0" typer = "^0.7.0" gunicorn = "^20.1.0" -langchain = "^0.0.176" +langchain = "^0.0.183" openai = "^0.27.2" types-pyyaml = "^6.0.12.8" dill = "^0.3.6" @@ -55,6 +55,7 @@ websockets = "^11.0.3" weaviate-client = "^3.19.2" jina = "3.15.2" sentence-transformers = "^2.2.2" +ctransformers = "^0.2.2" [tool.poetry.group.dev.dependencies] black = "^23.1.0" From 5f25bb0d580de827722043b85a408bbf1812d6c5 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 17:25:27 -0300 Subject: [PATCH 08/26] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.py):=20fix=20try?= =?UTF-8?q?=5Fsetting=5Fstreaming=5Foptions=20function=20to=20correctly=20?= =?UTF-8?q?set=20streaming=20attribute=20The=20try=5Fsetting=5Fstreaming?= =?UTF-8?q?=5Foptions=20function=20now=20correctly=20sets=20the=20streamin?= =?UTF-8?q?g=20attribute=20of=20the=20llm=20object=20to=20True=20if=20it?= =?UTF-8?q?=20is=20an=20instance=20of=20BaseLanguageModel=20and=20has=20th?= =?UTF-8?q?e=20streaming=20attribute.=20This=20fixes=20a=20bug=20where=20t?= =?UTF-8?q?he=20streaming=20attribute=20was=20not=20being=20set=20correctl?= =?UTF-8?q?y.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/interface/utils.py b/src/backend/langflow/interface/utils.py index 7368fda3e..2b7c5acd1 100644 --- a/src/backend/langflow/interface/utils.py +++ b/src/backend/langflow/interface/utils.py @@ -44,7 +44,7 @@ def try_setting_streaming_options(langchain_object, websocket): langchain_object.llm_chain, "llm" ): llm = langchain_object.llm_chain.llm - if isinstance(llm, BaseLanguageModel): - llm.streaming = bool(hasattr(llm, "streaming")) + if isinstance(llm, BaseLanguageModel) and hasattr(llm, "streaming"): + llm.streaming = True return langchain_object From 4409066e815a99805d75ab8c748259f251cd1646 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 17:28:42 -0300 Subject: [PATCH 09/26] =?UTF-8?q?=F0=9F=94=BC=20chore(pyproject.toml):=20u?= =?UTF-8?q?pdate=20langchain=20dependency=20from=200.0.176=20to=200.0.183?= =?UTF-8?q?=20=E2=9C=A8=20feat(pyproject.toml):=20add=20cohere=20dependenc?= =?UTF-8?q?y=20to=20enable=20new=20features=20=F0=9F=94=A7=20chore(config.?= =?UTF-8?q?yaml):=20add=20Cohere=20to=20the=20list=20of=20supported=20LLMS?= =?UTF-8?q?=20The=20langchain=20dependency=20was=20updated=20to=20version?= =?UTF-8?q?=200.0.183=20to=20take=20advantage=20of=20the=20latest=20featur?= =?UTF-8?q?es=20and=20bug=20fixes.=20The=20cohere=20dependency=20was=20add?= =?UTF-8?q?ed=20to=20enable=20new=20features.=20Cohere=20is=20now=20added?= =?UTF-8?q?=20to=20the=20list=20of=20supported=20LLMS=20in=20the=20config.?= =?UTF-8?q?yaml=20file.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 36 +++++++++++++++++++++++--------- pyproject.toml | 3 ++- src/backend/langflow/config.yaml | 1 + 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/poetry.lock b/poetry.lock index aad835dc1..9a225f3c4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -717,6 +717,23 @@ pandas = ["pandas"] sqlalchemy = ["sqlalchemy (>1.3.21,<1.4)"] superset = ["apache-superset (>=1.4.1)"] +[[package]] +name = "cohere" +version = "4.6.0" +description = "" +category = "main" +optional = false +python-versions = ">=3.7,<4.0" +files = [ + {file = "cohere-4.6.0-py3-none-any.whl", hash = "sha256:fc60fa73a2d96bdb9f70da4a290d3ede320b74ac01a24c229011049d7cb3511f"}, + {file = "cohere-4.6.0.tar.gz", hash = "sha256:43218a0a40f6fc023e068732994fb631ce5d160a0bc9f9a3a22524b5932f34ea"}, +] + +[package.dependencies] +aiohttp = ">=3.0,<4.0" +backoff = ">=2.0,<3.0" +requests = ">=2.0,<3.0" + [[package]] name = "colorama" version = "0.4.6" @@ -2293,14 +2310,14 @@ test = ["ipykernel", "pre-commit", "pytest", "pytest-cov", "pytest-timeout"] [[package]] name = "langchain" -version = "0.0.176" +version = "0.0.183" description = "Building applications with LLMs through composability" category = "main" optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langchain-0.0.176-py3-none-any.whl", hash = "sha256:b2a1958ed07d884869b4bdaa28d63a005787e7f4938d2bbe984b3662827db861"}, - {file = "langchain-0.0.176.tar.gz", hash = "sha256:25f2875d48efab9b32affbe886b85580b1a9df0fb5ae54798eb28aeafba60bec"}, + {file = "langchain-0.0.183-py3-none-any.whl", hash = "sha256:d98e56bf5189599f6500d59908f85b5a6cdf65545e34b41165c7c98beb1ccd0e"}, + {file = "langchain-0.0.183.tar.gz", hash = "sha256:ec9712ae9d11b14f02e703f123d9493f82d49fd80e86df4ff4014df2af06aeca"}, ] [package.dependencies] @@ -2317,14 +2334,13 @@ SQLAlchemy = ">=1.4,<3" tenacity = ">=8.1.0,<9.0.0" [package.extras] -all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.2.6,<0.3.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.3.0,<4.0.0)", "docarray (>=0.31.0,<0.32.0)", "duckduckgo-search (>=2.8.6,<3.0.0)", "elasticsearch (>=8,<9)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "hnswlib (>=0.7.0,<0.8.0)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jina (>=3.14,<4.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "lark (>=1.1.5,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "networkx (>=2.6.3,<3.0.0)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "protobuf (==3.19.6)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.1.2,<2.0.0)", "redis (>=4,<5)", "sentence-transformers (>=2,<3)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tiktoken (>=0.3.2,<0.4.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] -azure = ["azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "openai (>=0,<1)"] +all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.2.6,<0.3.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.3.0,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=2.8.6,<3.0.0)", "elasticsearch (>=8,<9)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jina (>=3.14,<4.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "langkit (>=0.0.1.dev3,<0.1.0)", "lark (>=1.1.5,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "momento (>=1.5.0,<2.0.0)", "neo4j (>=5.8.1,<6.0.0)", "networkx (>=2.6.3,<3.0.0)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.1.2,<2.0.0)", "redis (>=4,<5)", "requests-toolbelt (>=1.0.0,<2.0.0)", "sentence-transformers (>=2,<3)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tiktoken (>=0.3.2,<0.4.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] +azure = ["azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "openai (>=0,<1)"] cohere = ["cohere (>=3,<4)"] +docarray = ["docarray[hnswlib] (>=0.32.0,<0.33.0)"] embeddings = ["sentence-transformers (>=2,<3)"] -extended-testing = ["atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "chardet (>=5.1.0,<6.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "psychicapi (>=0.2,<0.3)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.25,<0.26)"] -hnswlib = ["docarray (>=0.31.0,<0.32.0)", "hnswlib (>=0.7.0,<0.8.0)", "protobuf (==3.19.6)"] -in-memory-store = ["docarray (>=0.31.0,<0.32.0)"] -llms = ["anthropic (>=0.2.6,<0.3.0)", "cohere (>=3,<4)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "torch (>=1,<3)", "transformers (>=4,<5)"] +extended-testing = ["atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "chardet (>=5.1.0,<6.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "psychicapi (>=0.2,<0.3)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.30,<0.31)"] +llms = ["anthropic (>=0.2.6,<0.3.0)", "cohere (>=3,<4)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "torch (>=1,<3)", "transformers (>=4,<5)"] openai = ["openai (>=0,<1)", "tiktoken (>=0.3.2,<0.4.0)"] qdrant = ["qdrant-client (>=1.1.2,<2.0.0)"] text-helpers = ["chardet (>=5.1.0,<6.0.0)"] @@ -6133,4 +6149,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "abbb024a67e3326821999f9a0a6164b13e877b0b72d1cd6912ca694c83fffa22" +content-hash = "7acf62317e2782126c25e293bc3bc61403336274fd5abfec37bd1bc4750e8162" diff --git a/pyproject.toml b/pyproject.toml index 1cb6f3581..f1e1fcc29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ google-search-results = "^2.4.1" google-api-python-client = "^2.79.0" typer = "^0.7.0" gunicorn = "^20.1.0" -langchain = "^0.0.176" +langchain = "^0.0.183" openai = "^0.27.2" types-pyyaml = "^6.0.12.8" dill = "^0.3.6" @@ -55,6 +55,7 @@ websockets = "^11.0.3" weaviate-client = "^3.19.2" jina = "3.15.2" sentence-transformers = "^2.2.2" +cohere = "^4.6.0" [tool.poetry.group.dev.dependencies] black = "^23.1.0" diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index b1da1b622..b6c506d52 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -52,6 +52,7 @@ llms: - ChatOpenAI - HuggingFaceHub - LlamaCpp + - Cohere memories: - ConversationBufferMemory - ConversationSummaryMemory From fa8cd1e31cca44a5d2c041d265a11caf7e905861 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 17:36:37 -0300 Subject: [PATCH 10/26] =?UTF-8?q?=F0=9F=94=92=20chore(pyproject.toml):=20u?= =?UTF-8?q?pdate=20dependencies=20to=20latest=20versions=20FastAPI=20and?= =?UTF-8?q?=20Langchain=20dependencies=20have=20been=20updated=20to=20thei?= =?UTF-8?q?r=20latest=20versions=20to=20ensure=20that=20the=20application?= =?UTF-8?q?=20is=20using=20the=20latest=20features=20and=20security=20patc?= =?UTF-8?q?hes.=20The=20Llama-cpp-python=20dependency=20has=20also=20been?= =?UTF-8?q?=20updated=20to=20a=20more=20recent=20version.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 69 +++++++++++++++++++++++++------------------------- pyproject.toml | 9 ++++--- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/poetry.lock b/poetry.lock index aad835dc1..1104b786a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -212,14 +212,14 @@ server = ["Deprecated (>=1.2.0,<1.3.0)", "PyYAML (>=5.4.1,<6.1.0)", "aiofiles (> [[package]] name = "asgiref" -version = "3.7.1" +version = "3.7.2" description = "ASGI specs, helper code, and adapters" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "asgiref-3.7.1-py3-none-any.whl", hash = "sha256:33958cb2e4b3cd8b1b06ef295bd8605cde65b11df51d3beab39e2e149a610ab3"}, - {file = "asgiref-3.7.1.tar.gz", hash = "sha256:8de379fcc383bcfe4507e229fc31209ea23d4831c850f74063b2c11639474dd2"}, + {file = "asgiref-3.7.2-py3-none-any.whl", hash = "sha256:89b2ef2247e3b562a16eef663bc0e2e703ec6468e2fa8a5cd61cd449786d4f6e"}, + {file = "asgiref-3.7.2.tar.gz", hash = "sha256:9e0ce3aa93a819ba5b45120216b23878cf6e8525eb3848653452b4192b92afed"}, ] [package.dependencies] @@ -387,14 +387,14 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "cachetools" -version = "5.3.0" +version = "5.3.1" description = "Extensible memoizing collections and decorators" category = "main" optional = false -python-versions = "~=3.7" +python-versions = ">=3.7" files = [ - {file = "cachetools-5.3.0-py3-none-any.whl", hash = "sha256:429e1a1e845c008ea6c85aa35d4b98b65d6a9763eeef3e37e92728a12d1de9d4"}, - {file = "cachetools-5.3.0.tar.gz", hash = "sha256:13dfddc7b8df938c21a940dfa6557ce6e94a2f1cdfa58eb90c805721d58f2c14"}, + {file = "cachetools-5.3.1-py3-none-any.whl", hash = "sha256:95ef631eeaea14ba2e36f06437f36463aac3a096799e876ee55e5cdccb102590"}, + {file = "cachetools-5.3.1.tar.gz", hash = "sha256:dce83f2d9b4e1f732a8cd44af8e8fab2dbe46201467fc98b3ef8f269092bf62b"}, ] [[package]] @@ -938,21 +938,21 @@ files = [ [[package]] name = "deprecated" -version = "1.2.13" +version = "1.2.14" description = "Python @deprecated decorator to deprecate old python classes, functions or methods." category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ - {file = "Deprecated-1.2.13-py2.py3-none-any.whl", hash = "sha256:64756e3e14c8c5eea9795d93c524551432a0be75629f8f29e67ab8caf076c76d"}, - {file = "Deprecated-1.2.13.tar.gz", hash = "sha256:43ac5335da90c31c24ba028af536a91d41d53f9e6901ddb021bcc572ce44e38d"}, + {file = "Deprecated-1.2.14-py2.py3-none-any.whl", hash = "sha256:6fac8b097794a90302bdbb17b9b815e732d3c4720583ff1b198499d78470466c"}, + {file = "Deprecated-1.2.14.tar.gz", hash = "sha256:e5323eb936458dccc2582dc6f9c322c852a775a27065ff2b0c4970b9d53d01b3"}, ] [package.dependencies] wrapt = ">=1.10,<2" [package.extras] -dev = ["PyTest", "PyTest (<5)", "PyTest-Cov", "PyTest-Cov (<2.6)", "bump2version (<1)", "configparser (<5)", "importlib-metadata (<3)", "importlib-resources (<4)", "sphinx (<2)", "sphinxcontrib-websupport (<2)", "tox", "zipp (<2)"] +dev = ["PyTest", "PyTest-Cov", "bump2version (<1)", "sphinx (<2)", "tox"] [[package]] name = "dill" @@ -1165,25 +1165,25 @@ importlib-resources = {version = ">=5.0", markers = "python_version < \"3.10\""} [[package]] name = "fastapi" -version = "0.92.0" +version = "0.95.2" description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "fastapi-0.92.0-py3-none-any.whl", hash = "sha256:ae7b97c778e2f2ec3fb3cb4fb14162129411d99907fb71920f6d69a524340ebf"}, - {file = "fastapi-0.92.0.tar.gz", hash = "sha256:023a0f5bd2c8b2609014d3bba1e14a1d7df96c6abea0a73070621c9862b9a4de"}, + {file = "fastapi-0.95.2-py3-none-any.whl", hash = "sha256:d374dbc4ef2ad9b803899bd3360d34c534adc574546e25314ab72c0c4411749f"}, + {file = "fastapi-0.95.2.tar.gz", hash = "sha256:4d9d3e8c71c73f11874bcf5e33626258d143252e329a01002f767306c64fb982"}, ] [package.dependencies] pydantic = ">=1.6.2,<1.7 || >1.7,<1.7.1 || >1.7.1,<1.7.2 || >1.7.2,<1.7.3 || >1.7.3,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0" -starlette = ">=0.25.0,<0.26.0" +starlette = ">=0.27.0,<0.28.0" [package.extras] all = ["email-validator (>=1.1.1)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "python-multipart (>=0.0.5)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"] dev = ["pre-commit (>=2.17.0,<3.0.0)", "ruff (==0.0.138)", "uvicorn[standard] (>=0.12.0,<0.21.0)"] -doc = ["mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.3.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pyyaml (>=5.3.1,<7.0.0)", "typer[all] (>=0.6.1,<0.8.0)"] -test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==22.10.0)", "coverage[toml] (>=6.5.0,<8.0)", "databases[sqlite] (>=0.3.2,<0.7.0)", "email-validator (>=1.1.1,<2.0.0)", "flask (>=1.1.2,<3.0.0)", "httpx (>=0.23.0,<0.24.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.982)", "orjson (>=3.2.1,<4.0.0)", "passlib[bcrypt] (>=1.7.2,<2.0.0)", "peewee (>=3.13.3,<4.0.0)", "pytest (>=7.1.3,<8.0.0)", "python-jose[cryptography] (>=3.3.0,<4.0.0)", "python-multipart (>=0.0.5,<0.0.6)", "pyyaml (>=5.3.1,<7.0.0)", "ruff (==0.0.138)", "sqlalchemy (>=1.3.18,<1.4.43)", "types-orjson (==3.6.2)", "types-ujson (==5.6.0.0)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0)"] +doc = ["mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.3.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pyyaml (>=5.3.1,<7.0.0)", "typer-cli (>=0.0.13,<0.0.14)", "typer[all] (>=0.6.1,<0.8.0)"] +test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==23.1.0)", "coverage[toml] (>=6.5.0,<8.0)", "databases[sqlite] (>=0.3.2,<0.7.0)", "email-validator (>=1.1.1,<2.0.0)", "flask (>=1.1.2,<3.0.0)", "httpx (>=0.23.0,<0.24.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.982)", "orjson (>=3.2.1,<4.0.0)", "passlib[bcrypt] (>=1.7.2,<2.0.0)", "peewee (>=3.13.3,<4.0.0)", "pytest (>=7.1.3,<8.0.0)", "python-jose[cryptography] (>=3.3.0,<4.0.0)", "python-multipart (>=0.0.5,<0.0.7)", "pyyaml (>=5.3.1,<7.0.0)", "ruff (==0.0.138)", "sqlalchemy (>=1.3.18,<1.4.43)", "types-orjson (==3.6.2)", "types-ujson (==5.7.0.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0)"] [[package]] name = "filelock" @@ -2293,14 +2293,14 @@ test = ["ipykernel", "pre-commit", "pytest", "pytest-cov", "pytest-timeout"] [[package]] name = "langchain" -version = "0.0.176" +version = "0.0.183" description = "Building applications with LLMs through composability" category = "main" optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langchain-0.0.176-py3-none-any.whl", hash = "sha256:b2a1958ed07d884869b4bdaa28d63a005787e7f4938d2bbe984b3662827db861"}, - {file = "langchain-0.0.176.tar.gz", hash = "sha256:25f2875d48efab9b32affbe886b85580b1a9df0fb5ae54798eb28aeafba60bec"}, + {file = "langchain-0.0.183-py3-none-any.whl", hash = "sha256:d98e56bf5189599f6500d59908f85b5a6cdf65545e34b41165c7c98beb1ccd0e"}, + {file = "langchain-0.0.183.tar.gz", hash = "sha256:ec9712ae9d11b14f02e703f123d9493f82d49fd80e86df4ff4014df2af06aeca"}, ] [package.dependencies] @@ -2317,14 +2317,13 @@ SQLAlchemy = ">=1.4,<3" tenacity = ">=8.1.0,<9.0.0" [package.extras] -all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.2.6,<0.3.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.3.0,<4.0.0)", "docarray (>=0.31.0,<0.32.0)", "duckduckgo-search (>=2.8.6,<3.0.0)", "elasticsearch (>=8,<9)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "hnswlib (>=0.7.0,<0.8.0)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jina (>=3.14,<4.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "lark (>=1.1.5,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "networkx (>=2.6.3,<3.0.0)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "protobuf (==3.19.6)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.1.2,<2.0.0)", "redis (>=4,<5)", "sentence-transformers (>=2,<3)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tiktoken (>=0.3.2,<0.4.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] -azure = ["azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "openai (>=0,<1)"] +all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.2.6,<0.3.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.3.0,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=2.8.6,<3.0.0)", "elasticsearch (>=8,<9)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jina (>=3.14,<4.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "langkit (>=0.0.1.dev3,<0.1.0)", "lark (>=1.1.5,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "momento (>=1.5.0,<2.0.0)", "neo4j (>=5.8.1,<6.0.0)", "networkx (>=2.6.3,<3.0.0)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.1.2,<2.0.0)", "redis (>=4,<5)", "requests-toolbelt (>=1.0.0,<2.0.0)", "sentence-transformers (>=2,<3)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tiktoken (>=0.3.2,<0.4.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] +azure = ["azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "openai (>=0,<1)"] cohere = ["cohere (>=3,<4)"] +docarray = ["docarray[hnswlib] (>=0.32.0,<0.33.0)"] embeddings = ["sentence-transformers (>=2,<3)"] -extended-testing = ["atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "chardet (>=5.1.0,<6.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "psychicapi (>=0.2,<0.3)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.25,<0.26)"] -hnswlib = ["docarray (>=0.31.0,<0.32.0)", "hnswlib (>=0.7.0,<0.8.0)", "protobuf (==3.19.6)"] -in-memory-store = ["docarray (>=0.31.0,<0.32.0)"] -llms = ["anthropic (>=0.2.6,<0.3.0)", "cohere (>=3,<4)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "torch (>=1,<3)", "transformers (>=4,<5)"] +extended-testing = ["atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "chardet (>=5.1.0,<6.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "psychicapi (>=0.2,<0.3)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.30,<0.31)"] +llms = ["anthropic (>=0.2.6,<0.3.0)", "cohere (>=3,<4)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "torch (>=1,<3)", "transformers (>=4,<5)"] openai = ["openai (>=0,<1)", "tiktoken (>=0.3.2,<0.4.0)"] qdrant = ["qdrant-client (>=1.1.2,<2.0.0)"] text-helpers = ["chardet (>=5.1.0,<6.0.0)"] @@ -2377,13 +2376,13 @@ test = ["coverage", "pytest", "pytest-cov"] [[package]] name = "llama-cpp-python" -version = "0.1.50" +version = "0.1.55" description = "A Python wrapper for llama.cpp" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "llama_cpp_python-0.1.50.tar.gz", hash = "sha256:e305ae1b9f135f94afd8dd227701e6a1cd36db9c28f736b830ec364127c00bb9"}, + {file = "llama_cpp_python-0.1.55.tar.gz", hash = "sha256:1bc749f314a979c601b2dae22eb1f2d63fe791bc1237cce24d36b4f856be8ca2"}, ] [package.dependencies] @@ -5004,14 +5003,14 @@ tests = ["cython", "littleutils", "pygments", "pytest", "typeguard"] [[package]] name = "starlette" -version = "0.25.0" +version = "0.27.0" description = "The little ASGI library that shines." category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "starlette-0.25.0-py3-none-any.whl", hash = "sha256:774f1df1983fd594b9b6fb3ded39c2aa1979d10ac45caac0f4255cbe2acb8628"}, - {file = "starlette-0.25.0.tar.gz", hash = "sha256:854c71e73736c429c2bdb07801f2c76c9cba497e7c3cf4988fde5e95fe4cdb3c"}, + {file = "starlette-0.27.0-py3-none-any.whl", hash = "sha256:918416370e846586541235ccd38a474c08b80443ed31c578a418e2209b3eef91"}, + {file = "starlette-0.27.0.tar.gz", hash = "sha256:6a6b0d042acb8d469a01eba54e9cda6cbd24ac602c4cd016723117d6a7e73b75"}, ] [package.dependencies] @@ -5954,14 +5953,14 @@ files = [ [[package]] name = "xlsxwriter" -version = "3.1.1" +version = "3.1.2" description = "A Python module for creating Excel XLSX files." category = "main" optional = false python-versions = ">=3.6" files = [ - {file = "XlsxWriter-3.1.1-py3-none-any.whl", hash = "sha256:b50e3bd905d7dafa6ea45210e2cc5600b4ccd104a0d3a4d4d7cf813b78426440"}, - {file = "XlsxWriter-3.1.1.tar.gz", hash = "sha256:03459ee76f664470c4c63a8977cab624fb259d0fc1faac64dc9cc6f3cc08f945"}, + {file = "XlsxWriter-3.1.2-py3-none-any.whl", hash = "sha256:331508ff39d610ecdaf979e458840bc1eab6e6a02cfd5d08f044f0f73636236f"}, + {file = "XlsxWriter-3.1.2.tar.gz", hash = "sha256:78751099a770273f1c98b8d6643351f68f98ae8e6acf9d09d37dc6798f8cd3de"}, ] [[package]] @@ -6133,4 +6132,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "abbb024a67e3326821999f9a0a6164b13e877b0b72d1cd6912ca694c83fffa22" +content-hash = "e27db1a183064e9181241ce688ee70a4fee4b5df7d3ebf4b6c13eae8fffe4dcc" diff --git a/pyproject.toml b/pyproject.toml index 1cb6f3581..b2863de69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,22 +22,22 @@ langflow = "langflow.__main__:main" [tool.poetry.dependencies] python = ">=3.9,<3.12" -fastapi = "^0.92.0" +fastapi = "^0.95.0" uvicorn = "^0.20.0" beautifulsoup4 = "^4.11.2" google-search-results = "^2.4.1" google-api-python-client = "^2.79.0" typer = "^0.7.0" gunicorn = "^20.1.0" -langchain = "^0.0.176" -openai = "^0.27.2" +langchain = "^0.0.183" +openai = "^0.27.7" types-pyyaml = "^6.0.12.8" dill = "^0.3.6" pandas = "^1.5.3" chromadb = "^0.3.21" huggingface-hub = "^0.13.3" rich = "^13.3.3" -llama-cpp-python = "0.1.50" +llama-cpp-python = "^0.1.50" networkx = "^3.1" unstructured = "^0.5.11" pypdf = "^3.7.1" @@ -56,6 +56,7 @@ weaviate-client = "^3.19.2" jina = "3.15.2" sentence-transformers = "^2.2.2" + [tool.poetry.group.dev.dependencies] black = "^23.1.0" ipykernel = "^6.21.2" From edfc103999e1051f5446e29d6afbe532d6ea4bea Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 17:53:49 -0300 Subject: [PATCH 11/26] =?UTF-8?q?=F0=9F=9A=80=20feat(config.yaml):=20add?= =?UTF-8?q?=20CohereEmbeddings=20to=20the=20list=20of=20supported=20embedd?= =?UTF-8?q?ings=20The=20CohereEmbeddings=20is=20added=20to=20the=20list=20?= =?UTF-8?q?of=20supported=20embeddings=20in=20the=20config.yaml=20file.=20?= =?UTF-8?q?This=20allows=20the=20application=20to=20use=20the=20CohereEmbe?= =?UTF-8?q?ddings=20for=20language=20processing=20tasks.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 2 +- src/backend/langflow/config.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 9cf4c8e16..ab566e063 100644 --- a/poetry.lock +++ b/poetry.lock @@ -6149,4 +6149,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "e27db1a183064e9181241ce688ee70a4fee4b5df7d3ebf4b6c13eae8fffe4dcc" +content-hash = "ae4852378416319ee45512e200759438615dc8a4e840369176234dd04ec2a3ec" diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index b6c506d52..92a922526 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -45,6 +45,7 @@ documentloaders: embeddings: - OpenAIEmbeddings - HuggingFaceEmbeddings + - CohereEmbeddings llms: - OpenAI From ece95309731a415b80e52e101be065241b730763 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 17:57:33 -0300 Subject: [PATCH 12/26] =?UTF-8?q?=F0=9F=8E=A8=20style(inputComponent):=20c?= =?UTF-8?q?hange=20input=20placeholder=20text=20to=20be=20more=20descripti?= =?UTF-8?q?ve=20=F0=9F=8E=A8=20style(inputListComponent):=20change=20input?= =?UTF-8?q?=20placeholder=20text=20to=20be=20more=20descriptive=20The=20pl?= =?UTF-8?q?aceholder=20text=20for=20both=20input=20components=20has=20been?= =?UTF-8?q?=20changed=20to=20"Type=20something..."=20to=20be=20more=20desc?= =?UTF-8?q?riptive=20and=20provide=20better=20guidance=20to=20the=20user.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/components/inputComponent/index.tsx | 2 +- src/frontend/src/components/inputListComponent/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 8f8f4c587..c7047d494 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -32,7 +32,7 @@ export default function InputComponent({ disabled ? " bg-gray-200 dark:bg-gray-700" : "", password && !pwdVisible && myValue !== "" ? "password" : "" )} - placeholder="Type a text" + placeholder="Type something..." onChange={(e) => { setMyValue(e.target.value); onChange(e.target.value); diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index ea47af8f9..49b0a1a5a 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -33,7 +33,7 @@ export default function InputListComponent({ "block w-full form-input rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + (disabled ? " bg-gray-200" : "") } - placeholder="Type a text" + placeholder="Type something..." onChange={(e) => { setInputList((old) => { let newInputList = _.cloneDeep(old); From 4c71b1d17ff6d1ca012e909ede69f13611fe6b6d Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sun, 28 May 2023 20:34:01 -0300 Subject: [PATCH 13/26] =?UTF-8?q?=F0=9F=94=87=20chore(tabsContext.tsx):=20?= =?UTF-8?q?comment=20out=20code=20that=20was=20causing=20issues=20with=20f?= =?UTF-8?q?ile=20upload=20The=20code=20that=20was=20causing=20issues=20wit?= =?UTF-8?q?h=20file=20upload=20has=20been=20commented=20out=20for=20now.?= =?UTF-8?q?=20The=20code=20was=20resetting=20the=20content=20of=20a=20file?= =?UTF-8?q?,=20which=20was=20causing=20issues=20with=20the=20file=20upload?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/contexts/tabsContext.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 6db425599..0c69a6931 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -63,7 +63,8 @@ export function TabsProvider({ children }: { children: ReactNode }) { console.log(node.data.node.template[key].type); if (node.data.node.template[key].type === "file") { console.log(node.data.node.template[key]); - node.data.node.template[key].content = ""; + // ! Commenting this out for now, as it is causing issues with the file upload + // node.data.node.template[key].content = ""; } }); }); From 46813e5c3f7be3d39e0fe07fbad96034e653a2c3 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Sun, 28 May 2023 20:37:07 -0300 Subject: [PATCH 14/26] Fixing modal trattative error when is Prompt/Text --- .../src/components/promptComponent/index.tsx | 3 + .../components/textAreaComponent/index.tsx | 3 + .../src/modals/genericModal/index.tsx | 68 +++++++++++-------- src/frontend/src/utils.ts | 5 ++ 4 files changed, 52 insertions(+), 27 deletions(-) diff --git a/src/frontend/src/components/promptComponent/index.tsx b/src/frontend/src/components/promptComponent/index.tsx index 10ac41281..f31c37f51 100644 --- a/src/frontend/src/components/promptComponent/index.tsx +++ b/src/frontend/src/components/promptComponent/index.tsx @@ -5,6 +5,7 @@ import CodeAreaModal from "../../modals/codeAreaModal"; import TextAreaModal from "../../modals/textAreaModal"; import { TextAreaComponentType } from "../../types/components"; import GenericModal from "../../modals/genericModal"; +import { TypeModal } from "../../utils"; export default function PromptAreaComponent({ value, @@ -30,6 +31,7 @@ export default function PromptAreaComponent({ onClick={() => { openPopUp( { openPopUp( { openPopUp( { openPopUp( void; value: string; buttonText: string; modalTitle: string; + type: number; }) { - const [myButtonText, setmyButtonText] = useState(buttonText); - const [myModalTitle, setMyModalTitle] = useState(modalTitle); + const [myButtonText] = useState(buttonText); + const [myModalTitle] = useState(modalTitle); + const [myModalType] = useState(type); const [open, setOpen] = useState(true); const [myValue, setMyValue] = useState(value); const { dark } = useContext(darkContext); @@ -114,36 +118,46 @@ export default function PromptAreaModal({ type="button" className="inline-flex w-full justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm" onClick={() => { - checkPrompt(myValue) - .then((apiReturn) => { - if (apiReturn.data) { - let inputVariables = - apiReturn.data.input_variables; - if (inputVariables.length === 0) { - setErrorData({ - title: - "The template you are attempting to use does not contain any variables for data entry.", - }); + switch (myModalType) { + case 1: + setModalOpen(false); + break; + case 2: + checkPrompt(myValue) + .then((apiReturn) => { + if (apiReturn.data) { + let inputVariables = + apiReturn.data.input_variables; + if (inputVariables.length === 0) { + setErrorData({ + title: + "The template you are attempting to use does not contain any variables for data entry.", + }); + } else { + setSuccessData({ + title: "Prompt is ready", + }); + setModalOpen(false); + setValue(myValue); + } } else { - setSuccessData({ - title: "Prompt is ready", + setErrorData({ + title: "Something went wrong, please try again", }); - setModalOpen(false); - setValue(myValue); } - } else { - setErrorData({ - title: "Something went wrong, please try again", + }) + .catch((error) => { + return setErrorData({ + title: + "There is something wrong with this prompt, please review it", + list: [error.response.data.detail], }); - } - }) - .catch((error) => { - return setErrorData({ - title: - "There is something wrong with this prompt, please review it", - list: [error.response.data.detail], }); - }); + break; + + default: + break; + } }} > {myButtonText} diff --git a/src/frontend/src/utils.ts b/src/frontend/src/utils.ts index d464290e1..c88fded26 100644 --- a/src/frontend/src/utils.ts +++ b/src/frontend/src/utils.ts @@ -25,6 +25,11 @@ export function classNames(...classes: Array) { return classes.filter(Boolean).join(" "); } +export enum TypeModal { + TEXT = 1, + PROMPT = 2 +} + export const textColors = { white: "text-white", red: "text-red-700", From 9bac61b563bf33fb9c477ad8d718b6fbd033a8ca Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Mon, 29 May 2023 07:30:58 -0300 Subject: [PATCH 15/26] =?UTF-8?q?=F0=9F=9A=80=20feat(config.yaml):=20add?= =?UTF-8?q?=20new=20text=20splitters=20and=20toolkits=20Added=20new=20text?= =?UTF-8?q?=20splitters=20to=20the=20configuration=20file:=20RecursiveChar?= =?UTF-8?q?acterTextSplitter,=20LatexTextSplitter,=20and=20PythonCodeTextS?= =?UTF-8?q?plitter.=20These=20text=20splitters=20will=20be=20used=20to=20s?= =?UTF-8?q?plit=20text=20into=20smaller=20chunks=20for=20processing.=20Als?= =?UTF-8?q?o,=20added=20new=20toolkits=20to=20the=20configuration=20file:?= =?UTF-8?q?=20OpenAPIToolkit=20and=20JsonToolkit.=20These=20toolkits=20wil?= =?UTF-8?q?l=20be=20used=20to=20process=20the=20text=20chunks=20generated?= =?UTF-8?q?=20by=20the=20text=20splitters.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index 6dadc7a88..23cf2b6f2 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -63,6 +63,9 @@ prompts: - ZeroShotPrompt textsplitters: - CharacterTextSplitter + - RecursiveCharacterTextSplitter + - LatexTextSplitter + - PythonCodeTextSplitter toolkits: - OpenAPIToolkit - JsonToolkit From acec6904575cfd5c5d165ac37ef2ce2f2da96102 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Mon, 29 May 2023 08:45:42 -0300 Subject: [PATCH 16/26] Title case on names/title, fixing/changing icons, cursor on chat --- .../src/CustomNodes/GenericNode/index.tsx | 22 ++++++---- .../chatComponent/chatTrigger/index.tsx | 12 +++--- src/frontend/src/modals/NodeModal/index.tsx | 6 +-- .../extraSidebarComponent/index.tsx | 43 ++++++++++--------- src/frontend/src/utils.ts | 32 ++++++++++++++ src/frontend/tailwind.config.js | 1 + 6 files changed, 78 insertions(+), 38 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 96890d76e..64665bf73 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -1,13 +1,17 @@ import { BugAntIcon, - CheckCircleIcon, Cog6ToothIcon, - EllipsisHorizontalCircleIcon, - ExclamationCircleIcon, InformationCircleIcon, TrashIcon, } from "@heroicons/react/24/outline"; -import { classNames, nodeColors, nodeIcons, toNormalCase } from "../../utils"; + +import { + CheckCircleIcon, + EllipsisHorizontalCircleIcon, + ExclamationCircleIcon, +} from "@heroicons/react/24/solid"; + +import { classNames, nodeColors, nodeIcons, toNormalCase, toTitleCase } from "../../utils"; import ParameterComponent from "./components/parameterComponent"; import { typesContext } from "../../contexts/typesContext"; import { useContext, useState, useEffect, useRef, Fragment } from "react"; @@ -101,7 +105,9 @@ export default function GenericNode({ color: nodeColors[types[data.type]] ?? nodeColors.unknown, }} /> -
{data.type}
+ +
{data.type}
+
@@ -225,8 +231,8 @@ export default function GenericNode({ data.node.template[t].display_name ? data.node.template[t].display_name : data.node.template[t].name - ? toNormalCase(data.node.template[t].name) - : toNormalCase(t) + ? toTitleCase(data.node.template[t].name) + : toTitleCase(t) } name={t} tooltipTitle={ diff --git a/src/frontend/src/components/chatComponent/chatTrigger/index.tsx b/src/frontend/src/components/chatComponent/chatTrigger/index.tsx index 23b76b6e1..daa49f34f 100644 --- a/src/frontend/src/components/chatComponent/chatTrigger/index.tsx +++ b/src/frontend/src/components/chatComponent/chatTrigger/index.tsx @@ -23,14 +23,12 @@ export default function ChatTrigger({ open, setOpen }) { >
{ + setOpen(true); + }} > -