From f3e22b0080381a5ae883d55eafad485b7b476074 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 27 Jun 2023 18:25:05 -0300 Subject: [PATCH 1/9] fix: docs open in a new tab now --- .../src/pages/FlowPage/components/nodeToolbarComponent/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx index 7bc392e14..73ebff1d1 100644 --- a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx @@ -81,6 +81,7 @@ const NodeToolbarComponent = (props) => { ? " text-muted-foreground" : " text-foreground") )} + target="_blank" href={props.data.node.documentation} // deactivate link if no documentation is provided onClick={(event) => { From 0200b22189f76eff8cb73c1bbf384665f26ef6d8 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 27 Jun 2023 18:26:01 -0300 Subject: [PATCH 2/9] =?UTF-8?q?=F0=9F=8E=A8=20style(nodeToolbarComponent):?= =?UTF-8?q?=20add=20noopener=20and=20noreferrer=20attributes=20to=20docume?= =?UTF-8?q?ntation=20link=20The=20noopener=20and=20noreferrer=20attributes?= =?UTF-8?q?=20were=20added=20to=20the=20documentation=20link=20to=20improv?= =?UTF-8?q?e=20security=20by=20preventing=20the=20linked=20page=20from=20h?= =?UTF-8?q?aving=20access=20to=20the=20window.opener=20object=20and=20to?= =?UTF-8?q?=20prevent=20the=20referrer=20header=20from=20being=20sent=20to?= =?UTF-8?q?=20the=20linked=20page,=20respectively.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/FlowPage/components/nodeToolbarComponent/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx index 73ebff1d1..a60c928b6 100644 --- a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx @@ -82,6 +82,7 @@ const NodeToolbarComponent = (props) => { : " text-foreground") )} target="_blank" + rel="noopener noreferrer" href={props.data.node.documentation} // deactivate link if no documentation is provided onClick={(event) => { From 8aeb7c5fb1c6778f0239dcae1528c6bd778796cc Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 27 Jun 2023 18:28:01 -0300 Subject: [PATCH 3/9] =?UTF-8?q?=F0=9F=94=96=20chore(pyproject.toml):=20bum?= =?UTF-8?q?p=20version=20to=200.2.4=20The=20version=20number=20has=20been?= =?UTF-8?q?=20updated=20from=200.2.3=20to=200.2.4.=20This=20is=20a=20chore?= =?UTF-8?q?=20commit=20as=20it=20does=20not=20introduce=20any=20new=20feat?= =?UTF-8?q?ures=20or=20bug=20fixes,=20but=20rather=20updates=20the=20versi?= =?UTF-8?q?on=20number=20to=20reflect=20changes=20made=20in=20the=20packag?= =?UTF-8?q?e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index b854f5c2e..edcb3bb3c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -4690,14 +4690,14 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pypdf" -version = "3.11.0" +version = "3.11.1" description = "A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files" category = "main" optional = false python-versions = ">=3.6" files = [ - {file = "pypdf-3.11.0-py3-none-any.whl", hash = "sha256:4f1fd2c1ee05e381e05447152d9e993016666647578fcdd7cf15739d13536861"}, - {file = "pypdf-3.11.0.tar.gz", hash = "sha256:2f5b9b28763234427cd6e525795e583aae7e36a79bdadd48ba8ab5277c12182a"}, + {file = "pypdf-3.11.1-py3-none-any.whl", hash = "sha256:2afc8914355a784fb184f60ae82fe10f9b992aa0733b705f0746966e470f98bd"}, + {file = "pypdf-3.11.1.tar.gz", hash = "sha256:198c4d0231525d0b730cbbd11a5fc7d9a2e410dfc8ae2928c8de000b7ef149c5"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index 4fc5e3ce3..bbd55eaf9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "0.2.3" +version = "0.2.4" description = "A Python package with a built-in web application" authors = ["Logspace "] maintainers = [ From 7364ba41f80144af91f147c041f275a65dd3e6d7 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 08:59:31 -0300 Subject: [PATCH 4/9] =?UTF-8?q?=F0=9F=90=9B=20fix(loading.py):=20handle=20?= =?UTF-8?q?case=20where=20metadata=20is=20an=20empty=20dict=20and=20docume?= =?UTF-8?q?nt=20already=20has=20metadata=20=F0=9F=90=9B=20fix(loading.py):?= =?UTF-8?q?=20handle=20case=20where=20separator=5Ftype=20is=20not=20provid?= =?UTF-8?q?ed=20in=20params=20The=20first=20fix=20ensures=20that=20if=20th?= =?UTF-8?q?e=20metadata=20is=20an=20empty=20dict,=20it=20will=20not=20be?= =?UTF-8?q?=20added=20to=20the=20documents=20if=20they=20already=20have=20?= =?UTF-8?q?metadata.=20This=20prevents=20overwriting=20existing=20metadata?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The second fix handles the case where the separator_type is not provided in the params. In this case, the text_splitter will be instantiated using the class_object and the params as is. --- .../langflow/interface/initialize/loading.py | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index cfa5b5717..14642828a 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -188,18 +188,22 @@ def instantiate_documentloader(class_object: Type[BaseLoader], params: Dict): extension.strip() in x for extension in extensions ) metadata = params.pop("metadata", None) + if metadata and isinstance(metadata, str): + try: + metadata = json.loads(metadata) + except json.JSONDecodeError as exc: + raise ValueError( + "The metadata you provided is not a valid JSON string." + ) from exc docs = class_object(**params).load() + # Now if metadata is an empty dict, we will not add it to the documents if metadata: - if isinstance(metadata, str): - try: - metadata = json.loads(metadata) - except json.JSONDecodeError as exc: - raise ValueError( - "The metadata you provided is not a valid JSON string." - ) from exc - for doc in docs: - doc.metadata = metadata + # If the document already has metadata, we will not overwrite it + if not doc.metadata: + doc.metadata = metadata + else: + doc.metadata.update(metadata) return docs @@ -216,13 +220,16 @@ def instantiate_textsplitter( "Try changing the chunk_size of the Text Splitter." ) from exc - if "separator_type" in params and params["separator_type"] == "Text": + if ( + "separator_type" in params + and params["separator_type"] == "Text" + or "separator_type" not in params + ): text_splitter = class_object(**params) else: params["language"] = params.pop("separator_type", None) params.pop("separators", None) text_splitter = class_object.from_language(**params) - return text_splitter.split_documents(documents) From e5b12ae05a20ad337576a58294cb151ff55997bf Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 09:19:07 -0300 Subject: [PATCH 5/9] =?UTF-8?q?=F0=9F=94=96=20chore(pyproject.toml):=20upd?= =?UTF-8?q?ate=20langchain=20dependency=20version=20to=20^0.0.218=20The=20?= =?UTF-8?q?langchain=20dependency=20version=20has=20been=20updated=20to=20?= =?UTF-8?q?^0.0.218=20to=20ensure=20compatibility=20with=20the=20latest=20?= =?UTF-8?q?features=20and=20bug=20fixes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 13 +++++++------ pyproject.toml | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index edcb3bb3c..135c6f2c7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2604,14 +2604,14 @@ testing = ["pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", [[package]] name = "langchain" -version = "0.0.215" +version = "0.0.218" description = "Building applications with LLMs through composability" category = "main" optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langchain-0.0.215-py3-none-any.whl", hash = "sha256:af9587c2eb317a6e33123f8a4ee8ccd8685cfab62359ea4fec52c962d9646acf"}, - {file = "langchain-0.0.215.tar.gz", hash = "sha256:a6b261f3be941eeac2d9b37fbf8996fa4279ef724f064e8c90813046126da85b"}, + {file = "langchain-0.0.218-py3-none-any.whl", hash = "sha256:c78b0bd65791b80ddf132913ce2239d4cb2dca2dde0ce20a77f36af0c12d397c"}, + {file = "langchain-0.0.218.tar.gz", hash = "sha256:85a237d5b3664bf9acc87420c813df245c03ef1a68cc2424eeb0d81e60d7a0b7"}, ] [package.dependencies] @@ -2629,13 +2629,14 @@ 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)", "awadb (>=0.3.3,<0.4.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)", "clarifai (==9.1.0)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.6.2,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=3.8.3,<4.0.0)", "elasticsearch (>=8,<9)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-auth (>=2.18.1,<3.0.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)", "nebula3-python (>=3.4.0,<4.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)", "pymongo (>=4.3.3,<5.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)", "singlestoredb (>=0.7.1,<0.8.0)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tigrisdb (>=1.0.0b6,<2.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)"] +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)", "awadb (>=0.3.3,<0.4.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)", "clarifai (==9.1.0)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.6.2,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=3.8.3,<4.0.0)", "elasticsearch (>=8,<9)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-auth (>=2.18.1,<3.0.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)", "nebula3-python (>=3.4.0,<4.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)", "pymongo (>=4.3.3,<5.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)", "singlestoredb (>=0.7.1,<0.8.0)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tigrisdb (>=1.0.0b6,<2.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)", "azure-search-documents (==11.4.0a20230509004)", "openai (>=0,<1)"] clarifai = ["clarifai (==9.1.0)"] 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)", "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)", "openai (>=0,<1)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "psychicapi (>=0.5,<0.6)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "streamlit (>=1.18.0,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.31)"] +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)", "esprima (>=4.0.1,<5.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)", "openai (>=0,<1)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "psychicapi (>=0.8.0,<0.9.0)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "streamlit (>=1.18.0,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.31)"] +javascript = ["esprima (>=4.0.1,<5.0.0)"] llms = ["anthropic (>=0.2.6,<0.3.0)", "clarifai (==9.1.0)", "cohere (>=3,<4)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "openllm (>=0.1.6)", "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)"] @@ -7115,4 +7116,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "2f8373e1c80ce345f39ed9247fd4759ae94b5c754c4e850d3aa72183556eb92b" +content-hash = "678e32f48c532893c302fda95dcb038add66aaf3e5fe9886d8ba19fa386a4d2e" diff --git a/pyproject.toml b/pyproject.toml index bbd55eaf9..1688e1ccf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "0.2.4" +version = "0.2.5" 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.215" +langchain = "^0.0.218" openai = "^0.27.8" types-pyyaml = "^6.0.12.8" pandas = "^1.5.3" From 8c12e17ad07d0bf36a407054dc5365c71443eeb5 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 18:06:46 -0300 Subject: [PATCH 6/9] =?UTF-8?q?=F0=9F=93=9D=20docs(config.yaml):=20update?= =?UTF-8?q?=20documentation=20link=20for=20ConversationBufferMemory=20in?= =?UTF-8?q?=20memories=20section=20The=20documentation=20link=20for=20Conv?= =?UTF-8?q?ersationBufferMemory=20in=20the=20memories=20section=20has=20be?= =?UTF-8?q?en=20updated=20to=20point=20to=20the=20correct=20URL=20"https:/?= =?UTF-8?q?/python.langchain.com/docs/modules/memory/how=5Fto/buffer".=20T?= =?UTF-8?q?his=20change=20ensures=20that=20users=20can=20access=20the=20co?= =?UTF-8?q?rrect=20documentation=20for=20using=20ConversationBufferMemory.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index 518ff7029..310117381 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -121,7 +121,7 @@ llms: documentation: "https://python.langchain.com/docs/modules/model_io/models/llms/integrations/huggingface_hub" memories: ConversationBufferMemory: - documentation: "https://python.langchain.com/docs/modules/memory/how_to/summary" + documentation: "https://python.langchain.com/docs/modules/memory/how_to/buffer" ConversationSummaryMemory: documentation: "https://python.langchain.com/docs/modules/memory/how_to/summary" ConversationKGMemory: From 3485893be04bbca558cd5f7f8198a9fffc08e348 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 18:16:04 -0300 Subject: [PATCH 7/9] =?UTF-8?q?=F0=9F=94=80=20refactor(textsplitters.py):?= =?UTF-8?q?=20extract=20options=20list=20into=20a=20variable=20for=20reusa?= =?UTF-8?q?bility=20and=20sorting=20The=20options=20list=20for=20the=20sep?= =?UTF-8?q?arator=5Ftype=20field=20in=20the=20TextSplittersFrontendNode=20?= =?UTF-8?q?class=20has=20been=20extracted=20into=20a=20variable=20called?= =?UTF-8?q?=20options.=20This=20improves=20code=20readability=20and=20allo?= =?UTF-8?q?ws=20for=20easier=20modification=20and=20sorting=20of=20the=20o?= =?UTF-8?q?ptions=20list.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/textsplitters.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/template/frontend_node/textsplitters.py b/src/backend/langflow/template/frontend_node/textsplitters.py index 0a444ff08..65a2be6f6 100644 --- a/src/backend/langflow/template/frontend_node/textsplitters.py +++ b/src/backend/langflow/template/frontend_node/textsplitters.py @@ -21,6 +21,8 @@ class TextSplittersFrontendNode(FrontendNode): # Add a field for type of separator # which will have Text or any value from the # Language enum + options = [x.value for x in Language] + ["Text"] + options.sort() self.template.add_field( TemplateField( field_type="str", @@ -29,7 +31,7 @@ class TextSplittersFrontendNode(FrontendNode): name="separator_type", advanced=False, is_list=True, - options=[x.value for x in Language], + options=options, value="Text", display_name="Separator Type", ) From 36212884e4f3f8f7e11b9b47e6dbc572783f2a9c Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 18:16:13 -0300 Subject: [PATCH 8/9] =?UTF-8?q?=F0=9F=90=9B=20fix(loading.py):=20refactor?= =?UTF-8?q?=20instantiate=5Ftextsplitter=20function=20to=20improve=20reada?= =?UTF-8?q?bility=20and=20remove=20unnecessary=20code=20The=20`instantiate?= =?UTF-8?q?=5Ftextsplitter`=20function=20has=20been=20refactored=20to=20im?= =?UTF-8?q?prove=20readability=20and=20remove=20unnecessary=20code.=20The?= =?UTF-8?q?=20condition=20for=20creating=20the=20`text=5Fsplitter`=20objec?= =?UTF-8?q?t=20has=20been=20simplified=20and=20the=20`separator=5Ftype`=20?= =?UTF-8?q?parameter=20is=20now=20removed=20from=20the=20`params`=20dictio?= =?UTF-8?q?nary=20if=20it=20exists.=20Additionally,=20the=20`language`=20p?= =?UTF-8?q?arameter=20is=20now=20passed=20as=20an=20instance=20of=20the=20?= =?UTF-8?q?`Language`=20class=20from=20the=20`langchain.text=5Fsplitter`?= =?UTF-8?q?=20module.=20This=20change=20ensures=20that=20the=20`text=5Fspl?= =?UTF-8?q?itter`=20object=20is=20created=20correctly=20and=20the=20`split?= =?UTF-8?q?=5Fdocuments`=20method=20is=20called=20with=20the=20appropriate?= =?UTF-8?q?=20parameters.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../langflow/interface/initialize/loading.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index 14642828a..3ddb64c24 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -221,14 +221,17 @@ def instantiate_textsplitter( ) from exc if ( - "separator_type" in params - and params["separator_type"] == "Text" - or "separator_type" not in params - ): + "separator_type" in params and params["separator_type"] == "Text" + ) or "separator_type" not in params: + params.pop("separator_type", None) text_splitter = class_object(**params) else: - params["language"] = params.pop("separator_type", None) + from langchain.text_splitter import Language + + language = params.pop("separator_type", None) + params["language"] = Language(language) params.pop("separators", None) + text_splitter = class_object.from_language(**params) return text_splitter.split_documents(documents) From 14da6494bf15fca7da472ff9e61b24477911f067 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 18:17:58 -0300 Subject: [PATCH 9/9] =?UTF-8?q?=F0=9F=94=96=20chore(pyproject.toml):=20upd?= =?UTF-8?q?ate=20package=20version=20to=200.2.6=20The=20package=20version?= =?UTF-8?q?=20has=20been=20updated=20from=200.2.5=20to=200.2.6.=20This=20c?= =?UTF-8?q?hange=20is=20made=20to=20reflect=20the=20latest=20changes=20and?= =?UTF-8?q?=20improvements=20in=20the=20package.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 135c6f2c7..a000e3d77 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2523,14 +2523,14 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "joblib" -version = "1.2.0" +version = "1.3.0" description = "Lightweight pipelining with Python functions" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "joblib-1.2.0-py3-none-any.whl", hash = "sha256:091138ed78f800342968c523bdde947e7a305b8594b910a0fea2ab83c3c6d385"}, - {file = "joblib-1.2.0.tar.gz", hash = "sha256:e1cee4a79e4af22881164f218d4311f60074197fb707e082e803b61f6d137018"}, + {file = "joblib-1.3.0-py3-none-any.whl", hash = "sha256:172d56d4c43dd6bcd953bea213018c4084cf754963bbf54b8dae40faea716b98"}, + {file = "joblib-1.3.0.tar.gz", hash = "sha256:0b12a65dc76c530dbd790dd92881f75c40932b4254a7c8e608a868df408ca0a3"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 1688e1ccf..9d549a405 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "0.2.5" +version = "0.2.6" description = "A Python package with a built-in web application" authors = ["Logspace "] maintainers = [