From f0c507a6604b87b8fb941f1117f55fca3cab1aec Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 20 Jun 2023 16:14:16 -0300 Subject: [PATCH 01/72] =?UTF-8?q?=F0=9F=90=9B=20fix(loading.py):=20include?= =?UTF-8?q?=20"config"=20in=20the=20list=20of=20keys=20to=20check=20for=20?= =?UTF-8?q?*kwargs=20=E2=9C=A8=20feat(constants.py):=20add=20default=20con?= =?UTF-8?q?fig=20for=20CTransformers=20=F0=9F=9A=80=20feat(llms.py):=20add?= =?UTF-8?q?=20method=20to=20format=20ctransformers=20field=20in=20LLMFront?= =?UTF-8?q?endNode=20The=20fix=20in=20loading.py=20ensures=20that=20the=20?= =?UTF-8?q?*kwargs=20are=20converted=20to=20a=20dictionary=20when=20the=20?= =?UTF-8?q?key=20contains=20"config".=20The=20addition=20of=20the=20defaul?= =?UTF-8?q?t=20config=20for=20CTransformers=20in=20constants.py=20provides?= =?UTF-8?q?=20a=20default=20configuration=20for=20the=20CTransformers=20mo?= =?UTF-8?q?del.=20The=20new=20method=20in=20llms.py=20formats=20the=20ctra?= =?UTF-8?q?nsformers=20field=20in=20the=20LLMFrontendNode.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/loading.py | 10 ++++++++-- .../template/frontend_node/constants.py | 17 +++++++++++++++++ .../langflow/template/frontend_node/llms.py | 10 ++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/interface/loading.py b/src/backend/langflow/interface/loading.py index a765d3b9b..85ace0b41 100644 --- a/src/backend/langflow/interface/loading.py +++ b/src/backend/langflow/interface/loading.py @@ -53,8 +53,8 @@ def convert_params_to_sets(params): def convert_kwargs(params): # if *kwargs are passed as a string, convert to dict - # first find any key that has kwargs in it - kwargs_keys = [key for key in params.keys() if "kwargs" in key] + # first find any key that has kwargs or config in it + kwargs_keys = [key for key in params.keys() if "kwargs" in key or "config" in key] for key in kwargs_keys: if isinstance(params[key], str): params[key] = json.loads(params[key]) @@ -82,10 +82,16 @@ def instantiate_based_on_type(class_object, base_type, node_type, params): return instantiate_utility(node_type, class_object, params) elif base_type == "chains": return instantiate_chains(node_type, class_object, params) + elif base_type == "llms": + return instantiate_llm(node_type, class_object, params) else: return class_object(**params) +def instantiate_llm(node_type, class_object, params): + return class_object(**params) + + def instantiate_chains(node_type, class_object, params): if "retriever" in params and hasattr(params["retriever"], "as_retriever"): params["retriever"] = params["retriever"].as_retriever() diff --git a/src/backend/langflow/template/frontend_node/constants.py b/src/backend/langflow/template/frontend_node/constants.py index 20b8a0c61..f9894a317 100644 --- a/src/backend/langflow/template/frontend_node/constants.py +++ b/src/backend/langflow/template/frontend_node/constants.py @@ -32,3 +32,20 @@ You are a good listener and you can talk about anything. HUMAN_PROMPT = "{input}" QA_CHAIN_TYPES = ["stuff", "map_reduce", "map_rerank", "refine"] + +CTRANSFORMERS_DEFAULT_CONFIG = { + "top_k": 40, + "top_p": 0.95, + "temperature": 0.8, + "repetition_penalty": 1.1, + "last_n_tokens": 64, + "seed": -1, + "max_new_tokens": 256, + "stop": None, + "stream": False, + "reset": True, + "batch_size": 8, + "threads": -1, + "context_length": -1, + "gpu_layers": 0, +} diff --git a/src/backend/langflow/template/frontend_node/llms.py b/src/backend/langflow/template/frontend_node/llms.py index 272e42c7f..fcd28df6c 100644 --- a/src/backend/langflow/template/frontend_node/llms.py +++ b/src/backend/langflow/template/frontend_node/llms.py @@ -1,7 +1,9 @@ +import json from typing import Optional from langflow.template.field.base import TemplateField from langflow.template.frontend_node.base import FrontendNode +from langflow.template.frontend_node.constants import CTRANSFORMERS_DEFAULT_CONFIG class LLMFrontendNode(FrontendNode): @@ -31,6 +33,13 @@ class LLMFrontendNode(FrontendNode): field.show = True field.advanced = not field.required + @staticmethod + def format_ctransformers_field(field: TemplateField): + if field.name == "config": + field.show = True + field.advanced = True + field.value = json.dumps(CTRANSFORMERS_DEFAULT_CONFIG, indent=2) + @staticmethod def format_field(field: TemplateField, name: Optional[str] = None) -> None: display_names_dict = { @@ -38,6 +47,7 @@ class LLMFrontendNode(FrontendNode): } FrontendNode.format_field(field, name) LLMFrontendNode.format_openai_field(field) + LLMFrontendNode.format_ctransformers_field(field) if name and "azure" in name.lower(): LLMFrontendNode.format_azure_field(field) if name and "llama" in name.lower(): From fc2e6c112eb8a6a5390ced06d6bebcae7585af96 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 23 Jun 2023 09:28:25 -0300 Subject: [PATCH 02/72] =?UTF-8?q?=F0=9F=90=9B=20fix(chat.py):=20delete=20f?= =?UTF-8?q?low=20from=20cache=20if=20it=20already=20exists=20before=20init?= =?UTF-8?q?ializing=20build=20The=20code=20now=20checks=20if=20the=20flow?= =?UTF-8?q?=20already=20exists=20in=20the=20cache=20and=20deletes=20it=20b?= =?UTF-8?q?efore=20initializing=20the=20build.=20This=20ensures=20that=20t?= =?UTF-8?q?he=20cache=20is=20always=20up=20to=20date=20and=20avoids=20any?= =?UTF-8?q?=20inconsistencies=20that=20may=20arise=20from=20having=20outda?= =?UTF-8?q?ted=20data=20in=20the=20cache.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index 262defed6..ae9fb8b30 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -39,6 +39,11 @@ async def init_build(graph_data: dict): try: flow_id = graph_data.get("id") + # Delete from cache if already exists + if flow_id in chat_manager.in_memory_cache: + with chat_manager.in_memory_cache._lock: + chat_manager.in_memory_cache.delete(flow_id) + logger.debug(f"Deleted flow {flow_id} from cache") if flow_id is None: raise ValueError("No ID provided") flow_data_store[flow_id] = graph_data From 8ccdeb9dd541a0da24788f4b1728054300c6cdcb Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 23 Jun 2023 09:54:15 -0300 Subject: [PATCH 03/72] =?UTF-8?q?=F0=9F=90=9B=20fix(chat.py):=20fix=20stre?= =?UTF-8?q?am=5Fbuild=20function=20to=20return=20StreamData=20objects=20in?= =?UTF-8?q?stead=20of=20strings=20=E2=9C=A8=20feat(chat.py):=20add=20progr?= =?UTF-8?q?ess=20information=20to=20the=20stream=5Fbuild=20function=20The?= =?UTF-8?q?=20stream=5Fbuild=20function=20now=20returns=20StreamData=20obj?= =?UTF-8?q?ects=20instead=20of=20strings,=20which=20improves=20the=20reada?= =?UTF-8?q?bility=20of=20the=20code.=20The=20function=20also=20now=20inclu?= =?UTF-8?q?des=20progress=20information=20in=20the=20response,=20which=20a?= =?UTF-8?q?llows=20the=20client=20to=20track=20the=20progress=20of=20the?= =?UTF-8?q?=20build=20process.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 65 +++++++++++++++++--------- src/backend/langflow/api/v1/schemas.py | 8 ++++ 2 files changed, 51 insertions(+), 22 deletions(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index ae9fb8b30..a730758d2 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -1,4 +1,3 @@ -import json from fastapi import ( APIRouter, HTTPException, @@ -7,7 +6,7 @@ from fastapi import ( status, ) from fastapi.responses import StreamingResponse -from langflow.api.v1.schemas import BuiltResponse, InitResponse +from langflow.api.v1.schemas import BuiltResponse, InitResponse, StreamData from langflow.chat.manager import ChatManager from langflow.graph.graph.base import Graph @@ -39,14 +38,18 @@ async def init_build(graph_data: dict): try: flow_id = graph_data.get("id") + if flow_id is None: + raise ValueError("No ID provided") + # Check if already building + if flow_id in flow_data_store and flow_data_store[flow_id].get("building"): + return InitResponse(flowId=flow_id) + # Delete from cache if already exists if flow_id in chat_manager.in_memory_cache: with chat_manager.in_memory_cache._lock: chat_manager.in_memory_cache.delete(flow_id) logger.debug(f"Deleted flow {flow_id} from cache") - if flow_id is None: - raise ValueError("No ID provided") - flow_data_store[flow_id] = graph_data + flow_data_store[flow_id] = {"graph_data": graph_data, "building": False} return InitResponse(flowId=flow_id) except Exception as exc: @@ -76,26 +79,44 @@ async def stream_build(flow_id: str): """Stream the build process based on stored flow data.""" async def event_stream(flow_id): - final_response = json.dumps({"end_of_stream": True}) + final_response = {"end_of_stream": True} try: if flow_id not in flow_data_store: error_message = "Invalid session ID" - yield f"data: {json.dumps({'error': error_message})}\n\n" + yield str(StreamData(event="error", data={"error": error_message})) + return + + if flow_data_store[flow_id].get("building"): + error_message = "Already building" + yield str(StreamData(event="error", data={"error": error_message})) return graph_data = flow_data_store[flow_id].get("data") if not graph_data: error_message = "No data provided" - yield f"data: {json.dumps({'error': error_message})}\n\n" + yield str(StreamData(event="error", data={"error": error_message})) return logger.debug("Building langchain object") - graph = Graph.from_payload(graph_data) - for node in graph.generator_build(): + try: + # Some error could happen when building the graph + graph = Graph.from_payload(graph_data) + except Exception as exc: + logger.exception(exc) + error_message = str(exc) + yield str(StreamData(event="error", data={"error": error_message})) + return + + number_of_nodes = len(graph.nodes) + for i, vertex in enumerate(graph.generator_build(), 1): try: - node.build() - params = node._built_object_repr() + log_dict = { + "log": f"Building node {vertex.vertex_type}", + } + yield str(StreamData(event="log", data=log_dict)) + vertex.build() + params = vertex._built_object_repr() valid = True logger.debug( f"Building node {params[:50]}{'...' if len(params) > 50 else ''}" @@ -104,21 +125,21 @@ async def stream_build(flow_id: str): params = str(exc) valid = False - response = json.dumps( - { - "valid": valid, - "params": params, - "id": node.id, - } - ) - yield f"data: {response}\n\n" + response = { + "valid": valid, + "params": params, + "id": vertex.id, + "progress": round(i / number_of_nodes, 2), + } + + yield str(StreamData(event="message", data=response)) chat_manager.set_cache(flow_id, graph.build()) except Exception as exc: logger.error("Error while building the flow: %s", exc) - yield f"error: {json.dumps({'error': str(exc)})}\n\n" + yield str(StreamData(event="error", data={"error": str(exc)})) finally: - yield f"data: {final_response}\n\n" + yield str(StreamData(event="message", data=final_response)) try: return StreamingResponse(event_stream(flow_id), media_type="text/event-stream") diff --git a/src/backend/langflow/api/v1/schemas.py b/src/backend/langflow/api/v1/schemas.py index 714f0df7f..263221d75 100644 --- a/src/backend/langflow/api/v1/schemas.py +++ b/src/backend/langflow/api/v1/schemas.py @@ -101,3 +101,11 @@ class InitResponse(BaseModel): class BuiltResponse(BaseModel): built: bool + + +class StreamData(BaseModel): + event: str + data: dict + + def __str__(self) -> str: + return f"event: {self.event}\ndata: {json.dumps(self.data)}\n\n" From c6b3986bc91eb5e4c48a94e565e66e1ed8423af8 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Tue, 27 Jun 2023 17:02:41 -0300 Subject: [PATCH 04/72] Adding accordion, tweaks tabs --- src/frontend/package-lock.json | 240 ++++++++- src/frontend/package.json | 5 +- .../components/AccordionComponent/index.tsx | 27 + .../components/codeAreaComponent/index.tsx | 2 +- .../components/dropdownComponent/index.tsx | 10 +- .../src/components/floatComponent/index.tsx | 2 +- .../components/inputFileComponent/index.tsx | 8 +- .../components/inputListComponent/index.tsx | 7 +- .../src/components/intComponent/index.tsx | 2 +- .../src/components/promptComponent/index.tsx | 6 +- .../components/textAreaComponent/index.tsx | 2 +- src/frontend/src/components/ui/accordion.tsx | 60 +++ src/frontend/src/modals/ApiModal/index.tsx | 498 +++++++++++++++++- src/frontend/src/types/components/index.ts | 9 + src/frontend/tailwind.config.js | 14 + 15 files changed, 851 insertions(+), 41 deletions(-) create mode 100644 src/frontend/src/components/AccordionComponent/index.tsx create mode 100644 src/frontend/src/components/ui/accordion.tsx diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json index 673f56f10..1c185a3b9 100644 --- a/src/frontend/package-lock.json +++ b/src/frontend/package-lock.json @@ -13,9 +13,11 @@ "@headlessui/react": "^1.7.10", "@heroicons/react": "^2.0.15", "@mui/material": "^5.11.9", + "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-dropdown-menu": "^2.0.5", + "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-label": "^2.0.2", "@radix-ui/react-menubar": "^1.0.3", "@radix-ui/react-progress": "^1.0.3", @@ -27,6 +29,7 @@ "@tabler/icons-react": "^2.18.0", "@tailwindcss/forms": "^0.5.3", "@tailwindcss/line-clamp": "^0.4.4", + "accordion": "^3.0.2", "ace-builds": "^1.16.0", "add": "^2.0.6", "ansi-to-html": "^0.7.2", @@ -53,7 +56,7 @@ "rehype-mathjax": "^4.0.2", "remark-gfm": "^3.0.1", "remark-math": "^5.1.1", - "shadcn-ui": "^0.1.3", + "shadcn-ui": "^0.2.2", "short-unique-id": "^4.4.4", "switch": "^0.0.0", "table": "^6.8.1", @@ -114,6 +117,20 @@ "node": ">=6.0.0" } }, + "node_modules/@antfu/ni": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/@antfu/ni/-/ni-0.21.4.tgz", + "integrity": "sha512-O0Uv9LbLDSoEg26fnMDdDRiPwFJnQSoD4WnrflDwKCJm8Cx/0mV4cGxwBLXan5mGIrpK4Dd7vizf4rQm0QCEAA==", + "bin": { + "na": "bin/na.mjs", + "nci": "bin/nci.mjs", + "ni": "bin/ni.mjs", + "nlx": "bin/nlx.mjs", + "nr": "bin/nr.mjs", + "nu": "bin/nu.mjs", + "nun": "bin/nun.mjs" + } + }, "node_modules/@babel/code-frame": { "version": "7.21.4", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", @@ -1366,6 +1383,37 @@ "@babel/runtime": "^7.13.10" } }, + "node_modules/@radix-ui/react-accordion": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-accordion/-/react-accordion-1.1.2.tgz", + "integrity": "sha512-fDG7jcoNKVjSK6yfmuAs0EnPDro0WMXIhMtXdTBWqEioVW206ku+4Lw07e+13lUkFkpoEQ2PdeMIAGpdqEAmDg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-collapsible": "1.0.3", + "@radix-ui/react-collection": "1.0.3", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-direction": "1.0.1", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-controllable-state": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-arrow": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.0.3.tgz", @@ -1419,6 +1467,36 @@ } } }, + "node_modules/@radix-ui/react-collapsible": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collapsible/-/react-collapsible-1.0.3.tgz", + "integrity": "sha512-UBmVDkmR6IvDsloHVN+3rtx4Mi5TFvylYXpluuv0f37dtaz3H99bp8No0LGXRigVpl3UAT4l9j6bIchh42S/Gg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-presence": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-controllable-state": "1.0.1", + "@radix-ui/react-use-layout-effect": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-collection": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.0.3.tgz", @@ -1630,6 +1708,14 @@ } } }, + "node_modules/@radix-ui/react-icons": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-icons/-/react-icons-1.3.0.tgz", + "integrity": "sha512-jQxj/0LKgp+j9BiTXz3O3sgs26RNet2iLWmsPyRz2SIcR4q/4SbazXfnYwbAr+vLYKSfc7qxzyGQA1HLlYiuNw==", + "peerDependencies": { + "react": "^16.x || ^17.x || ^18.x" + } + }, "node_modules/@radix-ui/react-id": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.0.1.tgz", @@ -3106,6 +3192,39 @@ "node": ">= 10" } }, + "node_modules/@ts-morph/common": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.19.0.tgz", + "integrity": "sha512-Unz/WHmd4pGax91rdIKWi51wnVUW11QttMEPpBiBgIewnc9UQIX7UDLxr5vRlqeByXCwhkF6VabSsI0raWcyAQ==", + "dependencies": { + "fast-glob": "^3.2.12", + "minimatch": "^7.4.3", + "mkdirp": "^2.1.6", + "path-browserify": "^1.0.1" + } + }, + "node_modules/@ts-morph/common/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@ts-morph/common/node_modules/minimatch": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.6.tgz", + "integrity": "sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@types/aria-query": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", @@ -3547,6 +3666,11 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" }, + "node_modules/accordion": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/accordion/-/accordion-3.0.2.tgz", + "integrity": "sha512-jbQfFaw+57OBwPt7qSNHuW+RA8smmRwkWRS1Ozh6K/QxUspBgBV/LpdSzlY7vee8TomS6j3D33B9rIeH1qMwsA==" + }, "node_modules/ace-builds": { "version": "1.16.0", "resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.16.0.tgz", @@ -4491,6 +4615,11 @@ "node": ">=6" } }, + "node_modules/code-block-writer": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-12.0.0.tgz", + "integrity": "sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w==" + }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -7838,11 +7967,33 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/mj-context-menu": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/mj-context-menu/-/mj-context-menu-0.6.1.tgz", "integrity": "sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA==" }, + "node_modules/mkdirp": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.6.tgz", + "integrity": "sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A==", + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -8210,6 +8361,11 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -9286,23 +9442,40 @@ } }, "node_modules/shadcn-ui": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/shadcn-ui/-/shadcn-ui-0.1.3.tgz", - "integrity": "sha512-f6Wa4ZIxsigfOonC3yyJkPb2JXJnuGFyUn1fJJrDUHvIJOydUukcdQsZg7Lp6F6llkmfRjra1dZOo0KpSfdjuQ==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/shadcn-ui/-/shadcn-ui-0.2.2.tgz", + "integrity": "sha512-T76EeZymSB45Yz63gkYOv9P0Ke+UA9IZenysx+975nyNzXxU7HRBgfwuHiMcrcubtOLrzRVedTLX3lcOMqDeRQ==", "dependencies": { + "@antfu/ni": "^0.21.4", "chalk": "5.2.0", "commander": "^10.0.0", + "cosmiconfig": "^8.1.3", + "diff": "^5.1.0", "execa": "^7.0.0", "fs-extra": "^11.1.0", + "https-proxy-agent": "^6.2.0", "node-fetch": "^3.3.0", "ora": "^6.1.2", "prompts": "^2.4.2", + "ts-morph": "^18.0.0", + "tsconfig-paths": "^4.2.0", "zod": "^3.20.2" }, "bin": { "shadcn-ui": "dist/index.js" } }, + "node_modules/shadcn-ui/node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/shadcn-ui/node_modules/chalk": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", @@ -9322,6 +9495,35 @@ "node": ">=14" } }, + "node_modules/shadcn-ui/node_modules/cosmiconfig": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.2.0.tgz", + "integrity": "sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==", + "dependencies": { + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + } + }, + "node_modules/shadcn-ui/node_modules/https-proxy-agent": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-6.2.1.tgz", + "integrity": "sha512-ONsE3+yfZF2caH5+bJlcddtWqNI3Gvs5A38+ngvljxaBiRXRswym2c7yf8UAeFpRFKjFNHIFEHqR/OLAWJzyiA==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -9575,6 +9777,14 @@ "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "engines": { + "node": ">=4" + } + }, "node_modules/strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", @@ -9950,6 +10160,28 @@ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" }, + "node_modules/ts-morph": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-18.0.0.tgz", + "integrity": "sha512-Kg5u0mk19PIIe4islUI/HWRvm9bC1lHejK4S0oh1zaZ77TMZAEmQC0sHQYiu2RgCQFZKXz1fMVi/7nOOeirznA==", + "dependencies": { + "@ts-morph/common": "~0.19.0", + "code-block-writer": "^12.0.0" + } + }, + "node_modules/tsconfig-paths": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", + "dependencies": { + "json5": "^2.2.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/tslib": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", diff --git a/src/frontend/package.json b/src/frontend/package.json index 95e826736..36c6bef58 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -8,9 +8,11 @@ "@headlessui/react": "^1.7.10", "@heroicons/react": "^2.0.15", "@mui/material": "^5.11.9", + "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-dropdown-menu": "^2.0.5", + "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-label": "^2.0.2", "@radix-ui/react-menubar": "^1.0.3", "@radix-ui/react-progress": "^1.0.3", @@ -22,6 +24,7 @@ "@tabler/icons-react": "^2.18.0", "@tailwindcss/forms": "^0.5.3", "@tailwindcss/line-clamp": "^0.4.4", + "accordion": "^3.0.2", "ace-builds": "^1.16.0", "add": "^2.0.6", "ansi-to-html": "^0.7.2", @@ -48,7 +51,7 @@ "rehype-mathjax": "^4.0.2", "remark-gfm": "^3.0.1", "remark-math": "^5.1.1", - "shadcn-ui": "^0.1.3", + "shadcn-ui": "^0.2.2", "short-unique-id": "^4.4.4", "switch": "^0.0.0", "table": "^6.8.1", diff --git a/src/frontend/src/components/AccordionComponent/index.tsx b/src/frontend/src/components/AccordionComponent/index.tsx new file mode 100644 index 000000000..1c2b41b46 --- /dev/null +++ b/src/frontend/src/components/AccordionComponent/index.tsx @@ -0,0 +1,27 @@ +import { ReactElement, useContext, useEffect, useRef, useState } from "react"; +import { AccordionComponentType, ProgressBarType } from "../../types/components"; +import { Progress } from "../../components/ui/progress"; +import { setInterval } from "timers/promises"; +import { + Accordion, + AccordionContent, + AccordionItem, + AccordionTrigger, +} from "../../components/ui/accordion" + +export default function AccordionComponent({ + trigger, + children, +}: AccordionComponentType) { + + return <> + + + {trigger} + + {children} + + + + +} diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index 1730904e2..6fec7cd27 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -47,7 +47,7 @@ export default function CodeAreaComponent({ className={ editNode ? "truncate cursor-pointer placeholder:text-center text-gray-500 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 border-1 shadow-sm sm:text-sm" + - INPUT_STYLE + INPUT_STYLE + (disabled ? " bg-gray-200 " : "") : "truncate block w-full text-gray-500 px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm sm:text-sm" + INPUT_STYLE + (disabled ? " bg-gray-200" : "") diff --git a/src/frontend/src/components/dropdownComponent/index.tsx b/src/frontend/src/components/dropdownComponent/index.tsx index 522078629..467103eae 100644 --- a/src/frontend/src/components/dropdownComponent/index.tsx +++ b/src/frontend/src/components/dropdownComponent/index.tsx @@ -11,6 +11,7 @@ export default function Dropdown({ onSelect, editNode = false, numberOfOptions = 0, + apiModal = false }: DropDownComponentType) { let [internalValue, setInternalValue] = useState( value === "" || !value ? "Choose an option" : value @@ -62,9 +63,12 @@ export default function Dropdown({ > {options.map((option, id) => ( diff --git a/src/frontend/src/components/floatComponent/index.tsx b/src/frontend/src/components/floatComponent/index.tsx index 2fc80962b..5f8f82242 100644 --- a/src/frontend/src/components/floatComponent/index.tsx +++ b/src/frontend/src/components/floatComponent/index.tsx @@ -57,7 +57,7 @@ export default function FloatComponent({ className={ editNode ? "focus:placeholder-transparent text-center placeholder:text-center border-1 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm" + - INPUT_STYLE + INPUT_STYLE + (disabled ? " bg-gray-200 " : "") : "focus:placeholder-transparent block w-full form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm ring-offset-gray-200 sm:text-sm" + INPUT_STYLE + (disabled ? " bg-gray-200 dark:bg-gray-700" : "") diff --git a/src/frontend/src/components/inputFileComponent/index.tsx b/src/frontend/src/components/inputFileComponent/index.tsx index 7b0325156..7c89302d3 100644 --- a/src/frontend/src/components/inputFileComponent/index.tsx +++ b/src/frontend/src/components/inputFileComponent/index.tsx @@ -98,23 +98,23 @@ export default function InputFileComponent({ disabled ? "pointer-events-none cursor-not-allowed w-full" : "w-full" } > -
+
{myValue !== "" ? myValue : "No file"}
diff --git a/src/frontend/src/components/textAreaComponent/index.tsx b/src/frontend/src/components/textAreaComponent/index.tsx index 4b4cd1582..160579d1a 100644 --- a/src/frontend/src/components/textAreaComponent/index.tsx +++ b/src/frontend/src/components/textAreaComponent/index.tsx @@ -53,7 +53,7 @@ export default function TextAreaComponent({ className={ editNode ? "truncate cursor-pointer placeholder:text-center text-gray-500 border-1 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm" + - INPUT_STYLE + INPUT_STYLE + (disabled ? " bg-gray-200 " : "") : "truncate block w-full text-gray-500 dark:text-muted px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm sm:text-sm" + (disabled ? " bg-gray-200" : "") } diff --git a/src/frontend/src/components/ui/accordion.tsx b/src/frontend/src/components/ui/accordion.tsx new file mode 100644 index 000000000..9679cf1c3 --- /dev/null +++ b/src/frontend/src/components/ui/accordion.tsx @@ -0,0 +1,60 @@ +"use client" + +import * as React from "react" +import * as AccordionPrimitive from "@radix-ui/react-accordion" +import { ChevronDownIcon } from "@radix-ui/react-icons" +import { cn } from "../../utils" + + +const Accordion = AccordionPrimitive.Root + +const AccordionItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AccordionItem.displayName = "AccordionItem" + +const AccordionTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + svg]:rotate-180", + className + )} + {...props} + > + {children} + + + +)) +AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName + +const AccordionContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + +
{children}
+
+)) +AccordionContent.displayName = AccordionPrimitive.Content.displayName + +export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 8b373c4e2..bc4ecac87 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -1,4 +1,4 @@ -import { useContext, useState } from "react"; +import { useContext, useEffect, useRef, useState } from "react"; import { PopUpContext } from "../../contexts/popUpContext"; import "ace-builds/src-noconflict/mode-python"; import "ace-builds/src-noconflict/theme-github"; @@ -26,6 +26,28 @@ import { TabsTrigger, } from "../../components/ui/tabs"; import { Check, Clipboard, Code2 } from "lucide-react"; +import { + Table, + TableBody, + TableCaption, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "../../components/ui/table"; +import { buildTweaks, classNames, limitScrollFieldsModal } from "../../utils"; +import AccordionComponent from "../../components/AccordionComponent"; +import CodeAreaComponent from "../../components/codeAreaComponent"; +import Dropdown from "../../components/dropdownComponent"; +import FloatComponent from "../../components/floatComponent"; +import InputComponent from "../../components/inputComponent"; +import InputFileComponent from "../../components/inputFileComponent"; +import InputListComponent from "../../components/inputListComponent"; +import IntComponent from "../../components/intComponent"; +import PromptAreaComponent from "../../components/promptComponent"; +import TextAreaComponent from "../../components/textAreaComponent"; +import ToggleShadComponent from "../../components/toggleShadComponent"; +import ShadTooltip from "../../components/ShadTooltipComponent"; export default function ApiModal({ flow }: { flow: FlowType }) { const [open, setOpen] = useState(true); @@ -33,6 +55,8 @@ export default function ApiModal({ flow }: { flow: FlowType }) { const { closePopUp } = useContext(PopUpContext); const [activeTab, setActiveTab] = useState("0"); const [isCopied, setIsCopied] = useState(false); + const [enabled, setEnabled] = useState(null); + const tweak = useRef([]); const copyToClipboard = () => { if (!navigator.clipboard || !navigator.clipboard.writeText) { @@ -54,10 +78,14 @@ export default function ApiModal({ flow }: { flow: FlowType }) { } } - const pythonApiCode = getPythonApiCode(flow); + useEffect(() => { + console.log(tweak.current); + }, [closePopUp]); + const pythonApiCode = getPythonApiCode(flow); const curl_code = getCurlCode(flow); const pythonCode = getPythonCode(flow); + const tweaksCode = buildTweaks(flow); const tabs = [ { @@ -80,10 +108,81 @@ export default function ApiModal({ flow }: { flow: FlowType }) { code: pythonCode, }, ]; + + if (Object.keys(tweaksCode).length > 0) { + tabs.push({ + name: "Tweaks", + mode: "python", + image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png", + code: pythonCode, + }); + } + + function buildTweakObject(tw, changes, template) { + if (template.type === "float") { + changes = parseFloat(changes); + } + if (template.type === "int") { + changes = parseInt(changes); + } + if (template.list === true && Array.isArray(changes)) { + changes = changes?.filter((x) => x !== ""); + } + + const existingTweak = tweak.current.find((element) => + element.hasOwnProperty(tw) + ); + + if (existingTweak) { + existingTweak[tw][template["name"]] = changes; + + if (template.list === true) { + if (changes.length === 0) { + if (existingTweak[tw] && existingTweak[tw][template["name"]]) { + delete existingTweak[tw][template["name"]]; + } + } + } + + if (existingTweak[tw][template["name"]] == template.value) { + tweak.current.forEach((element) => { + if (element[tw] && element[tw][template["name"]]) { + delete element[tw][template["name"]]; + } + if (element[tw] && Object.keys(element[tw])?.length === 0) { + tweak.current = tweak.current.filter((obj) => { + const prop = obj[Object.keys(obj)[0]].prop; + return prop !== undefined && prop !== null && prop !== ""; + }); + delete element[tw]; + } + }); + } + } else { + const newTweak = { + [tw]: { + [template["name"]]: changes, + }, + }; + tweak.current.push(newTweak); + } + + console.log(tweak.current); + } + + function buildContent(value) { + const htmlContent = ( +
+ {value != null && value != '' ? value : 'None'} +
+ ); + return htmlContent; + } + return ( - + Code @@ -103,32 +202,391 @@ export default function ApiModal({ flow }: { flow: FlowType }) {
{tabs.map((tab, index) => ( - {tab.name} + + {tab.name} + ))} -
- -
+ {Number(activeTab) < 3 && ( +
+ +
+ )}
{tabs.map((tab, index) => ( - - {tab.code} - + {index < 3 ? ( + + {tab.code} + + ) : index === 3 ? ( + <> +
+
+ {flow["data"]["nodes"].map((t: any, index) => ( +
+ +
+ + + + + PARAM + + + VALUE + + + + + {Object.keys(t["data"]["node"]["template"]) + .filter( + (n) => + n.charAt(0) !== "_" && + t.data.node.template[n].show && + (t.data.node.template[n].type === + "str" || + t.data.node.template[n].type === + "bool" || + t.data.node.template[n].type === + "float" || + t.data.node.template[n].type === + "code" || + t.data.node.template[n].type === + "prompt" || + t.data.node.template[n].type === + "file" || + t.data.node.template[n].type === + "int") + ) + .map((n, i) => { + // console.log(t.data.node.template[n]); + + return ( + + + {n} + + +
+ {t.data.node.template[n].type === + "str" && + !t.data.node.template[n] + .options ? ( +
+ {t.data.node.template[n] + .list ? ( + {}} + onAddInput={(k) => { + buildTweakObject( + t["data"]["id"], + k, + t.data.node.template[ + n + ] + ); + }} + /> + ) : t.data.node.template[n] + .multiline ? ( +
+ + {}} + /> + +
+ ) : ( + { + buildTweakObject( + t["data"]["id"], + k, + t.data.node.template[ + n + ] + ); + }} + /> + )} +
+ ) : t.data.node.template[n] + .type === "bool" ? ( +
+ {" "} + { + t.data.node.template[ + n + ].value = e; + setEnabled(e); + buildTweakObject( + t["data"]["id"], + e, + t.data.node.template[n] + ); + }} + size="small" + disabled={false} + /> +
+ ) + : + t.data.node.template[n] + .type === "file" ? ( + +
+ { + + }} + fileTypes={ + t.data.node.template[n] + .fileTypes + } + suffixes={ + t.data.node.template[n] + .suffixes + } + onFileChange={(k: any) => { + }} + > +
+
+ + ) + : t.data.node.template[n] + .type === "float" ? ( +
+ { + buildTweakObject( + t["data"]["id"], + k, + t.data.node.template[n] + ); + }} + /> +
+ ) : t.data.node.template[n] + .type === "str" && + t.data.node.template[n] + .options ? ( +
+ + buildTweakObject( + t["data"]["id"], + k, + t.data.node.template[n] + ) + } + value={ + t.data.node.template[n] + .value ?? + "Choose an option" + } + > +
+ ) : t.data.node.template[n] + .type === "int" ? ( +
+ { + buildTweakObject( + t["data"]["id"], + k, + t.data.node.template[n] + ); + }} + /> +
+ ) : t.data.node.template[n] + .type === "prompt" ? ( + +
+ {}} + /> +
+
+ ) : t.data.node.template[n] + .type === "code" ? ( + +
+ {}} + /> +
+
+ ) : t.data.node.template[n] + .type === "Any" ? ( + "-" + ) : ( +
+ )} +
+
+
+ ); + })} +
+
+
+
+
+ ))} + + {/* +
+ + + + + TWEAK + + + VALUE + + + + + {invoices.map((invoice) => ( + + + {invoice.paymentStatus} + + + {invoice.paymentMethod} + + + ))} + +
+
*/} +
+
+ + ) : null}
))} diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts index 630526193..0adbdc1d3 100644 --- a/src/frontend/src/types/components/index.ts +++ b/src/frontend/src/types/components/index.ts @@ -28,6 +28,7 @@ export type DropDownComponentType = { options: string[]; onSelect: (value: string) => void; editNode?: boolean; + apiModal?: boolean; numberOfOptions?: number; }; export type ParameterComponentType = { @@ -47,6 +48,8 @@ export type InputListComponentType = { onChange: (value: string[]) => void; disabled: boolean; editNode?: boolean; + onAddInput?: (value?: string[]) => void; + }; export type TextAreaComponentType = { @@ -115,3 +118,9 @@ export type RadialProgressType = { value?: number; color?: string; }; + +export type AccordionComponentType = { + children?: ReactElement; + value?: string; + trigger?: string; +}; \ No newline at end of file diff --git a/src/frontend/tailwind.config.js b/src/frontend/tailwind.config.js index 5561b1044..50d27a3c7 100644 --- a/src/frontend/tailwind.config.js +++ b/src/frontend/tailwind.config.js @@ -90,6 +90,20 @@ module.exports = { }, }, extend: { + keyframes: { + "accordion-down": { + from: { height: 0 }, + to: { height: "var(--radix-accordion-content-height)" }, + }, + "accordion-up": { + from: { height: "var(--radix-accordion-content-height)" }, + to: { height: 0 }, + }, + }, + animation: { + "accordion-down": "accordion-down 0.2s ease-out", + "accordion-up": "accordion-up 0.2s ease-out", + }, colors: { border: "hsl(var(--border))", input: "hsl(var(--input))", From ebee617b52a96ab9b5981815bb88ef671c297054 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Tue, 27 Jun 2023 17:24:19 -0300 Subject: [PATCH 05/72] =?UTF-8?q?=F0=9F=94=A8=20refactor(constants.tsx):?= =?UTF-8?q?=20add=20optional=20parameter=20to=20getPythonApiCode,=20getCur?= =?UTF-8?q?lCode=20and=20getPythonCode=20functions=20to=20allow=20tweaking?= =?UTF-8?q?=20of=20the=20flow=20=E2=9C=A8=20feat(ApiModal):=20pass=20the?= =?UTF-8?q?=20tweak.current=20value=20to=20the=20getPythonApiCode,=20getCu?= =?UTF-8?q?rlCode=20and=20getPythonCode=20functions=20to=20allow=20tweakin?= =?UTF-8?q?g=20of=20the=20flow.=20Update=20the=20tabs=20with=20the=20new?= =?UTF-8?q?=20code=20after=20a=20tweak=20is=20added.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/constants.tsx | 22 ++++++++++++---------- src/frontend/src/modals/ApiModal/index.tsx | 18 +++++++++++------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index f569046ea..4cebb9b54 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -54,7 +54,7 @@ export const TEXT_DIALOG_SUBTITLE = "Edit your text."; * @param {string} flowId - The id of the flow * @returns {string} - The python code */ -export const getPythonApiCode = (flow: FlowType): string => { +export const getPythonApiCode = (flow: FlowType, tweak?): string => { const flowId = flow.id; // create a dictionary of node ids and the values is an empty dictionary @@ -70,7 +70,9 @@ BASE_API_URL = "${window.location.protocol}//${ FLOW_ID = "${flowId}" # You can tweak the flow by adding a tweaks dictionary # e.g {"OpenAI-XXXXX": {"model_name": "gpt-4"}} -TWEAKS = ${JSON.stringify(tweaks, null, 2)} +TWEAKS = ${ + tweak ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) + } def run_flow(message: str, flow_id: str, tweaks: dict = None) -> dict: """ @@ -100,7 +102,7 @@ print(run_flow("Your message", flow_id=FLOW_ID, tweaks=TWEAKS))`; * @param {string} flowId - The id of the flow * @returns {string} - The curl code */ -export const getCurlCode = (flow: FlowType): string => { +export const getCurlCode = (flow: FlowType, tweak?): string => { const flowId = flow.id; const tweaks = buildTweaks(flow); return `curl -X POST \\ @@ -108,22 +110,22 @@ export const getCurlCode = (flow: FlowType): string => { window.location.host }/api/v1/process/${flowId} \\ -H 'Content-Type: application/json' \\ - -d '{"inputs": {"input": message}, "tweaks": ${JSON.stringify( - tweaks, - null, - 2 - )}}'`; + -d '{"inputs": {"input": message}, "tweaks": ${ + tweak ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) + }}'`; }; /** * Function to get the python code for the API * @param {string} flowName - The name of the flow * @returns {string} - The python code */ -export const getPythonCode = (flow: FlowType): string => { +export const getPythonCode = (flow: FlowType, tweak?): string => { const flowName = flow.name; const tweaks = buildTweaks(flow); return `from langflow import load_flow_from_json -TWEAKS = ${JSON.stringify(tweaks, null, 2)} +TWEAKS = ${ + tweak ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) + } flow = load_flow_from_json("${flowName}.json", tweaks=TWEAKS) # Now you can use it like any chain flow("Hey, have you heard of LangFlow?")`; diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index bc4ecac87..cfef3bd37 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -78,13 +78,9 @@ export default function ApiModal({ flow }: { flow: FlowType }) { } } - useEffect(() => { - console.log(tweak.current); - }, [closePopUp]); - - const pythonApiCode = getPythonApiCode(flow); - const curl_code = getCurlCode(flow); - const pythonCode = getPythonCode(flow); + const pythonApiCode = getPythonApiCode(flow, tweak.current); + const curl_code = getCurlCode(flow, tweak.current); + const pythonCode = getPythonCode(flow, tweak.current); const tweaksCode = buildTweaks(flow); const tabs = [ @@ -167,6 +163,14 @@ export default function ApiModal({ flow }: { flow: FlowType }) { tweak.current.push(newTweak); } + const pythonApiCode = getPythonApiCode(flow, tweak.current); + const curl_code = getCurlCode(flow, tweak.current); + const pythonCode = getPythonCode(flow, tweak.current); + + tabs[0].code = curl_code; + tabs[1].code = pythonApiCode; + tabs[2].code = pythonCode; + console.log(tweak.current); } From 132b2e367b162db69b97ad8b3a28ecb0a880726d Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Tue, 27 Jun 2023 19:51:53 -0300 Subject: [PATCH 06/72] =?UTF-8?q?=F0=9F=90=9B=20fix(constants.tsx):=20add?= =?UTF-8?q?=20check=20for=20empty=20tweak=20array=20to=20avoid=20JSON.stri?= =?UTF-8?q?ngify=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/constants.tsx | 6 +++--- src/frontend/src/modals/ApiModal/index.tsx | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index 4cebb9b54..4aee27d83 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -71,7 +71,7 @@ FLOW_ID = "${flowId}" # You can tweak the flow by adding a tweaks dictionary # e.g {"OpenAI-XXXXX": {"model_name": "gpt-4"}} TWEAKS = ${ - tweak ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) } def run_flow(message: str, flow_id: str, tweaks: dict = None) -> dict: @@ -111,7 +111,7 @@ export const getCurlCode = (flow: FlowType, tweak?): string => { }/api/v1/process/${flowId} \\ -H 'Content-Type: application/json' \\ -d '{"inputs": {"input": message}, "tweaks": ${ - tweak ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) }}'`; }; /** @@ -124,7 +124,7 @@ export const getPythonCode = (flow: FlowType, tweak?): string => { const tweaks = buildTweaks(flow); return `from langflow import load_flow_from_json TWEAKS = ${ - tweak ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) } flow = load_flow_from_json("${flowName}.json", tweaks=TWEAKS) # Now you can use it like any chain diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index cfef3bd37..5d4241338 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -77,6 +77,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { closePopUp(); } } + const pythonApiCode = getPythonApiCode(flow, tweak.current); const curl_code = getCurlCode(flow, tweak.current); From 4ac1326f3a252a698df09df0e3efbd4d78c5f0b7 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Tue, 27 Jun 2023 23:35:27 -0300 Subject: [PATCH 07/72] =?UTF-8?q?=F0=9F=90=9B=20fix(AccordionComponent):?= =?UTF-8?q?=20remove=20extra=20whitespace=20in=20AccordionTrigger=20classN?= =?UTF-8?q?ame=20for=20consistent=20styling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ feat(tabsContext): add setTweak and getTweak functions to TabsContext to manage tweak state 🐛 fix(ApiModal): remove unused imports and console.log statements ✨ feat(ApiModal): add functionality to get and set tweak state in TabsContext 🐛 fix(ApiModal): fix key prop warning in map function 🐛 fix(ApiModal): fix unused variable warning ✨ feat(ApiModal): add getValue function to get the value from tweak state or default value 🐛 fix(ApiModal): remove unused onChange functions 🐛 fix(ApiModal): fix key prop warning in map function 🐛 fix(ApiModal): fix unused variable warning ✨ feat(ApiModal): add functionality to get and set tweak state in TabsContext 🐛 fix(ApiModal): remove unused imports and console.log statements ✨ feat(tabsContext): add setTweak and getTweak functions to TabsContext to manage tweak state --- .../components/AccordionComponent/index.tsx | 3 +- src/frontend/src/contexts/tabsContext.tsx | 5 ++ src/frontend/src/modals/ApiModal/index.tsx | 78 ++++++++++++++----- src/frontend/src/types/tabs/index.ts | 2 + 4 files changed, 67 insertions(+), 21 deletions(-) diff --git a/src/frontend/src/components/AccordionComponent/index.tsx b/src/frontend/src/components/AccordionComponent/index.tsx index 1c2b41b46..19a811f87 100644 --- a/src/frontend/src/components/AccordionComponent/index.tsx +++ b/src/frontend/src/components/AccordionComponent/index.tsx @@ -14,10 +14,11 @@ export default function AccordionComponent({ children, }: AccordionComponentType) { + return <> - {trigger} + {trigger} {children} diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 7637699e3..1cccd4b06 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -53,6 +53,8 @@ const TabsContextInitialValue: TabsContextType = { tabsState: {}, setTabsState: (state: TabsState) => {}, getNodeId: (nodeType: string) => "", + setTweak: (tweak: any) => {}, + getTweak: {}, paste: ( selection: { nodes: any; edges: any }, position: { x: number; y: number; paneX?: number; paneY?: number } @@ -73,6 +75,7 @@ export function TabsProvider({ children }: { children: ReactNode }) { const { templates, reactFlowInstance } = useContext(typesContext); const [lastCopiedSelection, setLastCopiedSelection] = useState(null); const [tabsState, setTabsState] = useState({}); + const [getTweak, setTweak] = useState({}); const newNodeId = useRef(uid()); function incrementNodeId() { @@ -634,6 +637,8 @@ export function TabsProvider({ children }: { children: ReactNode }) { tabsState, setTabsState, paste, + getTweak, + setTweak }} > {children} diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 5d4241338..27522ece8 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -48,6 +48,8 @@ import PromptAreaComponent from "../../components/promptComponent"; import TextAreaComponent from "../../components/textAreaComponent"; import ToggleShadComponent from "../../components/toggleShadComponent"; import ShadTooltip from "../../components/ShadTooltipComponent"; +import { cloneDeep } from "lodash"; +import { TabsContext } from "../../contexts/tabsContext"; export default function ApiModal({ flow }: { flow: FlowType }) { const [open, setOpen] = useState(true); @@ -57,7 +59,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { const [isCopied, setIsCopied] = useState(false); const [enabled, setEnabled] = useState(null); const tweak = useRef([]); - + const { setTweak, getTweak } = useContext(TabsContext); const copyToClipboard = () => { if (!navigator.clipboard || !navigator.clipboard.writeText) { return; @@ -78,7 +80,6 @@ export default function ApiModal({ flow }: { flow: FlowType }) { } } - const pythonApiCode = getPythonApiCode(flow, tweak.current); const curl_code = getCurlCode(flow, tweak.current); const pythonCode = getPythonCode(flow, tweak.current); @@ -171,8 +172,8 @@ export default function ApiModal({ flow }: { flow: FlowType }) { tabs[0].code = curl_code; tabs[1].code = pythonApiCode; tabs[2].code = pythonCode; - - console.log(tweak.current); + + setTweak(tweak.current); } function buildContent(value) { @@ -184,6 +185,33 @@ export default function ApiModal({ flow }: { flow: FlowType }) { return htmlContent; } + function getValue(value, node, template){ + + let returnValue = value ?? ""; + + if(getTweak.length > 0){ + for (const obj of getTweak) { + // Obtém a chave do objeto interno + const key = Object.keys(obj)[0]; + // Obtém o valor do objeto interno + const value = obj[key]; + if(key == node['id']){ + Object.keys(value).forEach((key) => { + if(key == template['name']){ + returnValue = value[key]; + } + }) + } + } + } + else{ + return value ?? ""; + } + return returnValue; + } + + + return ( @@ -251,7 +279,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { )} > {flow["data"]["nodes"].map((t: any, index) => ( -
+
@@ -318,7 +346,9 @@ export default function ApiModal({ flow }: { flow: FlowType }) { : t.data.node .template[n].value } - onChange={(k) => {}} + onChange={(k) => { + + }} onAddInput={(k) => { buildTweakObject( t["data"]["id"], @@ -348,7 +378,8 @@ export default function ApiModal({ flow }: { flow: FlowType }) { .template[n] .value ?? "" } - onChange={(k) => {}} + onChange={(k) => { + }} /> @@ -361,8 +392,10 @@ export default function ApiModal({ flow }: { flow: FlowType }) { .password ?? false } value={ - t.data.node.template[n] - .value ?? "" + + getValue(t.data.node.template[n] + .value, t.data, t.data.node.template[n]) + } onChange={(k) => { buildTweakObject( @@ -420,7 +453,6 @@ export default function ApiModal({ flow }: { flow: FlowType }) { .value ?? "" } onChange={(k: any) => { - }} fileTypes={ t.data.node.template[n] @@ -444,8 +476,8 @@ export default function ApiModal({ flow }: { flow: FlowType }) { disabled={false} editNode={true} value={ - t.data.node.template[n] - .value ?? "" + getValue(t.data.node.template[n] + .value, t.data, t.data.node.template[n]) } onChange={(k) => { buildTweakObject( @@ -468,17 +500,21 @@ export default function ApiModal({ flow }: { flow: FlowType }) { t.data.node.template[n] .options } - onSelect={(k) => + onSelect={(k) =>{ + + + buildTweakObject( t["data"]["id"], k, t.data.node.template[n] ) } + + } value={ - t.data.node.template[n] - .value ?? - "Choose an option" + getValue(t.data.node.template[n] + .value, t.data, t.data.node.template[n]) } > @@ -489,8 +525,8 @@ export default function ApiModal({ flow }: { flow: FlowType }) { disabled={false} editNode={true} value={ - t.data.node.template[n] - .value ?? "" + getValue(t.data.node.template[n] + .value, t.data, t.data.node.template[n]) } onChange={(k) => { buildTweakObject( @@ -518,7 +554,8 @@ export default function ApiModal({ flow }: { flow: FlowType }) { t.data.node.template[n] .value ?? "" } - onChange={(k) => {}} + onChange={(k) => { + }} /> @@ -539,7 +576,8 @@ export default function ApiModal({ flow }: { flow: FlowType }) { t.data.node.template[n] .value ?? "" } - onChange={(k) => {}} + onChange={(k) => { + }} /> diff --git a/src/frontend/src/types/tabs/index.ts b/src/frontend/src/types/tabs/index.ts index 55829d6ca..8f823535c 100644 --- a/src/frontend/src/types/tabs/index.ts +++ b/src/frontend/src/types/tabs/index.ts @@ -28,6 +28,8 @@ export type TabsContextType = { ) => void; lastCopiedSelection: { nodes: any; edges: any }; setLastCopiedSelection: (selection: { nodes: any; edges: any }) => void; + setTweak: (tweak: any) => void; + getTweak: any; }; export type TabsState = { From d157fffee3de4634a7d9a738d473029fcb7bae70 Mon Sep 17 00:00:00 2001 From: zhenjianpeng Date: Wed, 28 Jun 2023 15:20:06 +0800 Subject: [PATCH 08/72] adding pg support for external message persistance --- src/backend/langflow/config.yaml | 1 + src/backend/langflow/custom/customs.py | 3 ++ .../langflow/interface/initialize/loading.py | 2 + .../template/frontend_node/memories.py | 40 +++++++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index d8cd4a325..0205cbb31 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -69,6 +69,7 @@ memories: - ConversationBufferMemory - ConversationSummaryMemory - ConversationKGMemory + - PostgresChatMessageHistory prompts: - PromptTemplate - FewShotPromptTemplate diff --git a/src/backend/langflow/custom/customs.py b/src/backend/langflow/custom/customs.py index fb6c1da16..0f1e44308 100644 --- a/src/backend/langflow/custom/customs.py +++ b/src/backend/langflow/custom/customs.py @@ -21,6 +21,9 @@ CUSTOM_NODES = { "utilities": { "SQLDatabase": frontend_node.agents.SQLDatabaseNode(), }, + "memories": { + "PostgresChatMessageHistory": frontend_node.memories.PostgresChatMessageHistoryFrontendNode(), + }, "chains": { "SeriesCharacterChain": frontend_node.chains.SeriesCharacterChainNode(), "TimeTravelGuideChain": frontend_node.chains.TimeTravelGuideChainNode(), diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index 88b981f9d..c527d745a 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -225,6 +225,7 @@ def load_agent_executor(agent_class: type[agent_module.Agent], params, **kwargs) """Load agent executor from agent class, tools and chain""" allowed_tools: Sequence[BaseTool] = params.get("allowed_tools", []) llm_chain = params["llm_chain"] + memory = params["memory"] # if allowed_tools is not a list or set, make it a list if not isinstance(allowed_tools, (list, set)) and isinstance( allowed_tools, BaseTool @@ -237,6 +238,7 @@ def load_agent_executor(agent_class: type[agent_module.Agent], params, **kwargs) return AgentExecutor.from_agent_and_tools( agent=agent, tools=allowed_tools, + memory=memory, **kwargs, ) diff --git a/src/backend/langflow/template/frontend_node/memories.py b/src/backend/langflow/template/frontend_node/memories.py index 4b312c926..e2f533e7f 100644 --- a/src/backend/langflow/template/frontend_node/memories.py +++ b/src/backend/langflow/template/frontend_node/memories.py @@ -2,6 +2,7 @@ from typing import Optional from langflow.template.field.base import TemplateField from langflow.template.frontend_node.base import FrontendNode +from langflow.template.template.base import Template class MemoryFrontendNode(FrontendNode): @@ -64,3 +65,42 @@ class MemoryFrontendNode(FrontendNode): field.value = "" if field.name == "memory_key": field.value = "chat_history" + + +class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode): + name: str = "PostgresChatMessageHistory" + template: Template = Template( + type_name="PostgresChatMessageHistory", + fields=[ + TemplateField( + field_type="str", + required=True, + placeholder="", + is_list=False, + show=True, + multiline=False, + name="session_id", + ), + TemplateField( + field_type="str", + required=True, + show=True, + name="connection_string", + ), + TemplateField( + field_type="str", + required=True, + placeholder="", + is_list=False, + show=True, + multiline=False, + value="message_store", + name="table_name", + ), + ], + ) + description: str = "Memory store with Postgres" + base_classes: list[str] = [ + "PostgresChatMessageHistory", + "BaseChatMessageHistory" + ] \ No newline at end of file From b29a54c6782f765b604d99f812d54872101e7d9f Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Wed, 28 Jun 2023 11:35:30 -0300 Subject: [PATCH 09/72] =?UTF-8?q?=F0=9F=94=A7=20fix(AccordionComponent/ind?= =?UTF-8?q?ex.tsx):=20fix=20import=20formatting=20and=20add=20missing=20se?= =?UTF-8?q?micolon=20=E2=9C=A8=20feat(AccordionComponent/index.tsx):=20add?= =?UTF-8?q?=20support=20for=20opening=20and=20closing=20accordion=20items?= =?UTF-8?q?=20on=20click=20=F0=9F=94=A7=20fix(popUpContext.tsx):=20add=20m?= =?UTF-8?q?issing=20semicolon=20and=20fix=20formatting=20=E2=9C=A8=20feat(?= =?UTF-8?q?popUpContext.tsx):=20add=20closeEdit=20state=20and=20setCloseEd?= =?UTF-8?q?it=20function=20to=20manage=20closing=20edit=20pop-up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 fix(ApiModal/index.tsx): add missing dependencies to useEffect to prevent stale data ✨ feat(ApiModal/index.tsx): add support for opening and closing accordion when there are tweaks present 🔧 chore(ApiModal/index.tsx): refactor getValue function to improve readability and maintainability 🔧 chore(ApiModal/index.tsx): refactor buildContent function to improve readability and maintainability 🔧 chore(ApiModal/index.tsx): refactor buildTweakObject function to improve readability and maintainability 🔧 chore(ApiModal/index.tsx): refactor onChange functions to improve readability and maintainability 🔧 chore(ApiModal/index.tsx): refactor value props to improve readability and maintainability 🔧 fix(codeAreaModal): add setCloseEdit function to PopUpContext to handle closing editcode 🔧 fix(promptModal): add setCloseEdit function to PopUpContext to handle closing prompt 🔧 fix(textAreaModal): add setCloseEdit function to PopUpContext to handle closing textarea 🔧 fix(components): change value prop to open prop in AccordionComponentType for better semantics --- .../components/AccordionComponent/index.tsx | 40 ++- src/frontend/src/contexts/popUpContext.tsx | 8 +- src/frontend/src/modals/ApiModal/index.tsx | 257 +++++++++++------- .../src/modals/codeAreaModal/index.tsx | 4 +- src/frontend/src/modals/promptModal/index.tsx | 3 +- .../src/modals/textAreaModal/index.tsx | 3 +- src/frontend/src/types/components/index.ts | 2 +- 7 files changed, 195 insertions(+), 122 deletions(-) diff --git a/src/frontend/src/components/AccordionComponent/index.tsx b/src/frontend/src/components/AccordionComponent/index.tsx index 19a811f87..c1174269a 100644 --- a/src/frontend/src/components/AccordionComponent/index.tsx +++ b/src/frontend/src/components/AccordionComponent/index.tsx @@ -1,5 +1,8 @@ import { ReactElement, useContext, useEffect, useRef, useState } from "react"; -import { AccordionComponentType, ProgressBarType } from "../../types/components"; +import { + AccordionComponentType, + ProgressBarType, +} from "../../types/components"; import { Progress } from "../../components/ui/progress"; import { setInterval } from "timers/promises"; import { @@ -7,22 +10,33 @@ import { AccordionContent, AccordionItem, AccordionTrigger, -} from "../../components/ui/accordion" +} from "../../components/ui/accordion"; export default function AccordionComponent({ trigger, children, + open = false, }: AccordionComponentType) { + const [value, setValue] = useState(!open ? "" : trigger); + function handleClick() { + value == "" ? setValue(trigger) : setValue(""); + } - - return <> - - - {trigger} - - {children} - - - - + return ( + <> + + + { + handleClick(); + }} + className="ml-3" + > + {trigger} + + {children} + + + + ); } diff --git a/src/frontend/src/contexts/popUpContext.tsx b/src/frontend/src/contexts/popUpContext.tsx index 371aeefce..a59eb0f9f 100644 --- a/src/frontend/src/contexts/popUpContext.tsx +++ b/src/frontend/src/contexts/popUpContext.tsx @@ -5,12 +5,15 @@ import React, { useState } from "react"; export const PopUpContext = createContext({ openPopUp: (popUpElement: JSX.Element) => {}, closePopUp: () => {}, + setCloseEdit: (value: string) => {}, + closeEdit: "", }); interface PopUpProviderProps { children: React.ReactNode; } + const PopUpProvider = ({ children }: PopUpProviderProps) => { const [popUpElements, setPopUpElements] = useState([]); @@ -22,8 +25,11 @@ const PopUpProvider = ({ children }: PopUpProviderProps) => { setPopUpElements((prevPopUps) => prevPopUps.slice(1)); }; + const [closeEdit, setCloseEdit] = useState(""); + + return ( - + {children} {popUpElements[0]} diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 27522ece8..a41b361e8 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -54,10 +54,11 @@ import { TabsContext } from "../../contexts/tabsContext"; export default function ApiModal({ flow }: { flow: FlowType }) { const [open, setOpen] = useState(true); const { dark } = useContext(darkContext); - const { closePopUp } = useContext(PopUpContext); + const { closePopUp, closeEdit, setCloseEdit } = useContext(PopUpContext); const [activeTab, setActiveTab] = useState("0"); const [isCopied, setIsCopied] = useState(false); const [enabled, setEnabled] = useState(null); + const [openAccordion, setOpenAccordion] = useState(false); const tweak = useRef([]); const { setTweak, getTweak } = useContext(TabsContext); const copyToClipboard = () => { @@ -76,10 +77,19 @@ export default function ApiModal({ flow }: { flow: FlowType }) { function setModalOpen(x: boolean) { setOpen(x); if (x === false) { + setCloseEdit(""); + setTweak([]); closePopUp(); } } - + + useEffect(() => { + if (closeEdit !== "") { + setActiveTab("3"); + setOpenAccordion(true); + } + }, [closeEdit]); + const pythonApiCode = getPythonApiCode(flow, tweak.current); const curl_code = getCurlCode(flow, tweak.current); const pythonCode = getPythonCode(flow, tweak.current); @@ -172,46 +182,42 @@ export default function ApiModal({ flow }: { flow: FlowType }) { tabs[0].code = curl_code; tabs[1].code = pythonApiCode; tabs[2].code = pythonCode; - + setTweak(tweak.current); } function buildContent(value) { const htmlContent = (
- {value != null && value != '' ? value : 'None'} + {value != null && value != "" ? value : "None"}
); return htmlContent; } - function getValue(value, node, template){ - + function getValue(value, node, template) { let returnValue = value ?? ""; - if(getTweak.length > 0){ + if (getTweak.length > 0) { for (const obj of getTweak) { // Obtém a chave do objeto interno - const key = Object.keys(obj)[0]; - // Obtém o valor do objeto interno - const value = obj[key]; - if(key == node['id']){ - Object.keys(value).forEach((key) => { - if(key == template['name']){ - returnValue = value[key]; - } - }) - } + const key = Object.keys(obj)[0]; + // Obtém o valor do objeto interno + const value = obj[key]; + if (key == node["id"]) { + Object.keys(value).forEach((key) => { + if (key == template["name"]) { + returnValue = value[key]; + } + }); } - } - else{ + } + } else { return value ?? ""; } return returnValue; } - - return ( @@ -228,9 +234,15 @@ export default function ApiModal({ flow }: { flow: FlowType }) { setActiveTab(value)} + onValueChange={(value) => { + setActiveTab(value) + + if(tweak.current.length > 0){ + setOpenAccordion(true); + } + }} >
@@ -280,7 +292,10 @@ export default function ApiModal({ flow }: { flow: FlowType }) { > {flow["data"]["nodes"].map((t: any, index) => (
- +
@@ -309,7 +324,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { "code" || t.data.node.template[n].type === "prompt" || - t.data.node.template[n].type === + t.data.node.template[n].type === "file" || t.data.node.template[n].type === "int") @@ -346,9 +361,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { : t.data.node .template[n].value } - onChange={(k) => { - - }} + onChange={(k) => {}} onAddInput={(k) => { buildTweakObject( t["data"]["id"], @@ -371,14 +384,23 @@ export default function ApiModal({ flow }: { flow: FlowType }) { )} > { + buildTweakObject( + t["data"]["id"], + k, + t.data.node + .template[n] + ); }} /> @@ -391,12 +413,12 @@ export default function ApiModal({ flow }: { flow: FlowType }) { t.data.node.template[n] .password ?? false } - value={ - - getValue(t.data.node.template[n] - .value, t.data, t.data.node.template[n]) - - } + value={getValue( + t.data.node.template[n] + .value, + t.data, + t.data.node.template[n] + )} onChange={(k) => { buildTweakObject( t["data"]["id"], @@ -433,52 +455,54 @@ export default function ApiModal({ flow }: { flow: FlowType }) { disabled={false} /> - ) - : - t.data.node.template[n] + ) : t.data.node.template[n] .type === "file" ? ( - + .value, + t.data, + t.data.node.template[n] + ) + )} + >
- { - }} - fileTypes={ - t.data.node.template[n] - .fileTypes - } - suffixes={ - t.data.node.template[n] - .suffixes - } - onFileChange={(k: any) => { - }} - > -
-
- - ) - : t.data.node.template[n] + {}} + fileTypes={ + t.data.node.template[n] + .fileTypes + } + suffixes={ + t.data.node.template[n] + .suffixes + } + onFileChange={( + k: any + ) => {}} + > + + + ) : t.data.node.template[n] .type === "float" ? (
{ buildTweakObject( t["data"]["id"], @@ -500,22 +524,19 @@ export default function ApiModal({ flow }: { flow: FlowType }) { t.data.node.template[n] .options } - onSelect={(k) =>{ - - - + onSelect={(k) => { buildTweakObject( t["data"]["id"], k, t.data.node.template[n] - ) - } - - } - value={ - getValue(t.data.node.template[n] - .value, t.data, t.data.node.template[n]) - } + ); + }} + value={getValue( + t.data.node.template[n] + .value, + t.data, + t.data.node.template[n] + )} >
) : t.data.node.template[n] @@ -524,10 +545,12 @@ export default function ApiModal({ flow }: { flow: FlowType }) { { buildTweakObject( t["data"]["id"], @@ -542,19 +565,32 @@ export default function ApiModal({ flow }: { flow: FlowType }) {
{ + buildTweakObject( + t["data"]["id"], + k, + t.data.node.template[ + n + ] + ); }} />
@@ -564,19 +600,32 @@ export default function ApiModal({ flow }: { flow: FlowType }) {
{ + buildTweakObject( + t["data"]["id"], + k, + t.data.node.template[ + n + ] + ); }} />
diff --git a/src/frontend/src/modals/codeAreaModal/index.tsx b/src/frontend/src/modals/codeAreaModal/index.tsx index f6e4b8e1c..0f9a26f33 100644 --- a/src/frontend/src/modals/codeAreaModal/index.tsx +++ b/src/frontend/src/modals/codeAreaModal/index.tsx @@ -34,13 +34,15 @@ export default function CodeAreaModal({ const [code, setCode] = useState(value); const { dark } = useContext(darkContext); const { setErrorData, setSuccessData } = useContext(alertContext); - const { closePopUp } = useContext(PopUpContext); + const { closePopUp,setCloseEdit } = useContext(PopUpContext); const ref = useRef(); function setModalOpen(x: boolean) { setOpen(x); if (x === false) { setTimeout(() => { closePopUp(); + setCloseEdit("editcode"); + }, 300); } } diff --git a/src/frontend/src/modals/promptModal/index.tsx b/src/frontend/src/modals/promptModal/index.tsx index 8a3ce4185..f051de427 100644 --- a/src/frontend/src/modals/promptModal/index.tsx +++ b/src/frontend/src/modals/promptModal/index.tsx @@ -16,12 +16,13 @@ export default function PromptAreaModal({ const [myValue, setMyValue] = useState(value); const { dark } = useContext(darkContext); const { setErrorData, setSuccessData } = useContext(alertContext); - const { closePopUp } = useContext(PopUpContext); + const { closePopUp, setCloseEdit } = useContext(PopUpContext); const ref = useRef(); function setModalOpen(x: boolean) { setOpen(x); if (x === false) { setTimeout(() => { + setCloseEdit("prompt"); closePopUp(); }, 300); } diff --git a/src/frontend/src/modals/textAreaModal/index.tsx b/src/frontend/src/modals/textAreaModal/index.tsx index a72f74643..4dee61385 100644 --- a/src/frontend/src/modals/textAreaModal/index.tsx +++ b/src/frontend/src/modals/textAreaModal/index.tsx @@ -15,12 +15,13 @@ export default function TextAreaModal({ }) { const [open, setOpen] = useState(true); const [myValue, setMyValue] = useState(value); - const { closePopUp } = useContext(PopUpContext); + const { closePopUp, setCloseEdit } = useContext(PopUpContext); const ref = useRef(); function setModalOpen(x: boolean) { setOpen(x); if (x === false) { setTimeout(() => { + setCloseEdit("textarea"); closePopUp(); }, 300); } diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts index 0adbdc1d3..4c936cabe 100644 --- a/src/frontend/src/types/components/index.ts +++ b/src/frontend/src/types/components/index.ts @@ -121,6 +121,6 @@ export type RadialProgressType = { export type AccordionComponentType = { children?: ReactElement; - value?: string; + open?: boolean; trigger?: string; }; \ No newline at end of file From dc4d1ccd65539602199f9fefd8f1357610929cbc Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Wed, 28 Jun 2023 11:43:21 -0300 Subject: [PATCH 10/72] =?UTF-8?q?=F0=9F=90=9B=20fix(ApiModal):=20remove=20?= =?UTF-8?q?unnecessary=20div=20tag=20to=20fix=20layout=20issue=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(codeAreaModal):=20fix=20closePopUp=20functio?= =?UTF-8?q?n=20call=20placement=20to=20ensure=20proper=20functionality=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(genericModal):=20set=20closeEdit=20value=20t?= =?UTF-8?q?o=20"generic"=20to=20fix=20issue=20with=20closing=20the=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/modals/ApiModal/index.tsx | 8 +++++--- src/frontend/src/modals/codeAreaModal/index.tsx | 3 +-- src/frontend/src/modals/genericModal/index.tsx | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index a41b361e8..76c07c5aa 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -374,8 +374,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { /> ) : t.data.node.template[n] .multiline ? ( -
- +
+ -
+
+ ) : ( { - closePopUp(); setCloseEdit("editcode"); - + closePopUp(); }, 300); } } diff --git a/src/frontend/src/modals/genericModal/index.tsx b/src/frontend/src/modals/genericModal/index.tsx index 6f89e24a6..8223cb3f8 100644 --- a/src/frontend/src/modals/genericModal/index.tsx +++ b/src/frontend/src/modals/genericModal/index.tsx @@ -38,11 +38,12 @@ export default function GenericModal({ const [myValue, setMyValue] = useState(value); const { dark } = useContext(darkContext); const { setErrorData, setSuccessData } = useContext(alertContext); - const { closePopUp } = useContext(PopUpContext); + const { closePopUp, setCloseEdit } = useContext(PopUpContext); const ref = useRef(); function setModalOpen(x: boolean) { setOpen(x); if (x === false) { + setCloseEdit("generic"); closePopUp(); } } From ab0fcc9cb0fa12f4e6d6610ef2aff585b5cb81e3 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Wed, 28 Jun 2023 12:16:27 -0300 Subject: [PATCH 11/72] =?UTF-8?q?=F0=9F=94=A7=20chore(ApiModal):=20add=20t?= =?UTF-8?q?weak.current=20assignment=20to=20improve=20code=20readability?= =?UTF-8?q?=20and=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/modals/ApiModal/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 76c07c5aa..b179e44b0 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -87,6 +87,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { if (closeEdit !== "") { setActiveTab("3"); setOpenAccordion(true); + tweak.current = getTweak; } }, [closeEdit]); From 9784817821683478b4d56dc77e3fae78f440c6c7 Mon Sep 17 00:00:00 2001 From: Jorge <46056498+jorgectf@users.noreply.github.com> Date: Wed, 28 Jun 2023 18:42:32 +0200 Subject: [PATCH 12/72] Add CodeQL workflow --- .github/workflows/codeql.yml | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..b480496ef --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,66 @@ +name: "CodeQL" + +on: + push: + branches: [ 'dev', 'main' ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ 'dev' ] + schedule: + - cron: '17 2 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python', 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" From 4f0d928a57a159089e0c7bda6058648266e2dcd7 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Wed, 28 Jun 2023 14:07:46 -0300 Subject: [PATCH 13/72] =?UTF-8?q?=F0=9F=90=9B=20fix(ApiModal/index.tsx):?= =?UTF-8?q?=20import=20the=20'filter'=20function=20from=20lodash=20to=20fi?= =?UTF-8?q?x=20missing=20reference=20error=20=E2=9C=A8=20feat(ApiModal/ind?= =?UTF-8?q?ex.tsx):=20add=20functionality=20to=20filter=20nodes=20and=20di?= =?UTF-8?q?splay=20only=20nodes=20with=20certain=20types=20in=20the=20twea?= =?UTF-8?q?ks=20list=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20iss?= =?UTF-8?q?ue=20with=20the=20tweaks=20list=20not=20updating=20when=20the?= =?UTF-8?q?=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20f?= =?UTF-8?q?ix=20issue=20with=20the=20tweaks=20list=20not=20updating=20when?= =?UTF-8?q?=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx?= =?UTF-8?q?):=20fix=20issue=20with=20the=20tweaks=20list=20not=20updating?= =?UTF-8?q?=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/in?= =?UTF-8?q?dex.tsx):=20fix=20issue=20with=20the=20tweaks=20list=20not=20up?= =?UTF-8?q?dating=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiMo?= =?UTF-8?q?dal/index.tsx):=20fix=20issue=20with=20the=20tweaks=20list=20no?= =?UTF-8?q?t=20updating=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix?= =?UTF-8?q?(ApiModal/index.tsx):=20fix=20issue=20with=20the=20tweaks=20lis?= =?UTF-8?q?t=20not=20updating=20when=20the=20flow=20changes=20=F0=9F=90=9B?= =?UTF-8?q?=20fix(ApiModal/index.tsx):=20fix=20issue=20with=20the=20tweaks?= =?UTF-8?q?=20list=20not=20updating=20when=20the=20flow=20changes=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20issue=20with=20?= =?UTF-8?q?the=20tweaks=20list=20not=20updating=20when=20the=20flow=20chan?= =?UTF-8?q?ges=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20issue=20w?= =?UTF-8?q?ith=20the=20tweaks=20list=20not=20updating=20when=20the=20flow?= =?UTF-8?q?=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20is?= =?UTF-8?q?sue=20with=20the=20tweaks=20list=20not=20updating=20when=20the?= =?UTF-8?q?=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20f?= =?UTF-8?q?ix=20issue=20with=20the=20tweaks=20list=20not=20updating=20when?= =?UTF-8?q?=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx?= =?UTF-8?q?):=20fix=20issue=20with=20the=20tweaks=20list=20not=20updating?= =?UTF-8?q?=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/in?= =?UTF-8?q?dex.tsx):=20fix=20issue=20with=20the=20tweaks=20list=20not=20up?= =?UTF-8?q?dating=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiMo?= =?UTF-8?q?dal/index.tsx):=20fix=20issue=20with=20the=20tweaks=20list=20no?= =?UTF-8?q?t=20updating=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix?= =?UTF-8?q?(ApiModal/index.tsx):=20fix=20issue=20with=20the=20tweaks=20lis?= =?UTF-8?q?t=20not=20updating=20when=20the=20flow=20changes=20=F0=9F=90=9B?= =?UTF-8?q?=20fix(ApiModal/index.tsx):=20fix=20issue=20with=20the=20tweaks?= =?UTF-8?q?=20list=20not=20updating=20when=20the=20flow=20changes=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20issue=20with=20?= =?UTF-8?q?the=20tweaks=20list=20not=20updating=20when=20the=20flow=20chan?= =?UTF-8?q?ges=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20issue=20w?= =?UTF-8?q?ith=20the=20tweaks=20list=20not=20updating=20when=20the=20flow?= =?UTF-8?q?=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20is?= =?UTF-8?q?sue=20with=20the=20tweaks=20list=20not=20updating=20when=20the?= =?UTF-8?q?=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20f?= =?UTF-8?q?ix=20issue=20with=20the=20tweaks=20list=20not=20updating=20when?= =?UTF-8?q?=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx?= =?UTF-8?q?):=20fix=20issue=20with=20the=20tweaks=20list=20not=20updating?= =?UTF-8?q?=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/in?= =?UTF-8?q?dex.tsx):=20fix=20issue=20with=20the=20tweaks=20list=20not=20up?= =?UTF-8?q?dating=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiMo?= =?UTF-8?q?dal/index.tsx):=20fix=20issue=20with=20the=20tweaks=20list=20no?= =?UTF-8?q?t=20updating=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix?= =?UTF-8?q?(ApiModal/index.tsx):=20fix=20issue=20with=20the=20tweaks=20lis?= =?UTF-8?q?t=20not=20updating=20when=20the=20flow=20changes=20=F0=9F=90=9B?= =?UTF-8?q?=20fix(ApiModal/index.tsx):=20fix=20issue=20with=20the=20tweaks?= =?UTF-8?q?=20list=20not=20updating=20when=20the=20flow=20changes=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20issue=20with=20?= =?UTF-8?q?the=20tweaks=20list=20not=20updating=20when=20the=20flow=20chan?= =?UTF-8?q?ges=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20issue=20w?= =?UTF-8?q?ith=20the=20tweaks=20list=20not=20updating=20when=20the=20flow?= =?UTF-8?q?=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20fix=20is?= =?UTF-8?q?sue=20with=20the=20tweaks=20list=20not=20updating=20when=20the?= =?UTF-8?q?=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx):=20f?= =?UTF-8?q?ix=20issue=20with=20the=20tweaks=20list=20not=20updating=20when?= =?UTF-8?q?=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/index.tsx?= =?UTF-8?q?):=20fix=20issue=20with=20the=20tweaks=20list=20not=20updating?= =?UTF-8?q?=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiModal/in?= =?UTF-8?q?dex.tsx):=20fix=20issue=20with=20the=20tweaks=20list=20not=20up?= =?UTF-8?q?dating=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix(ApiMo?= =?UTF-8?q?dal/index.tsx):=20fix=20issue=20with=20the=20tweaks=20list=20no?= =?UTF-8?q?t=20updating=20when=20the=20flow=20changes=20=F0=9F=90=9B=20fix?= =?UTF-8?q?(ApiModal/index.tsx):=20fix=20issue=20with=20the?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/modals/ApiModal/index.tsx | 90 ++++++++++++++++++---- 1 file changed, 73 insertions(+), 17 deletions(-) diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index b179e44b0..ee0222ce1 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -48,7 +48,7 @@ import PromptAreaComponent from "../../components/promptComponent"; import TextAreaComponent from "../../components/textAreaComponent"; import ToggleShadComponent from "../../components/toggleShadComponent"; import ShadTooltip from "../../components/ShadTooltipComponent"; -import { cloneDeep } from "lodash"; +import { cloneDeep, filter } from "lodash"; import { TabsContext } from "../../contexts/tabsContext"; export default function ApiModal({ flow }: { flow: FlowType }) { @@ -60,6 +60,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { const [enabled, setEnabled] = useState(null); const [openAccordion, setOpenAccordion] = useState(false); const tweak = useRef([]); + const tweaksList = useRef([]); const { setTweak, getTweak } = useContext(TabsContext); const copyToClipboard = () => { if (!navigator.clipboard || !navigator.clipboard.writeText) { @@ -91,11 +92,54 @@ export default function ApiModal({ flow }: { flow: FlowType }) { } }, [closeEdit]); + + const pythonApiCode = getPythonApiCode(flow, tweak.current); const curl_code = getCurlCode(flow, tweak.current); const pythonCode = getPythonCode(flow, tweak.current); const tweaksCode = buildTweaks(flow); + useEffect(() => { + filterNodes(); + + }, []) + function filterNodes(){ + + let arrNodesWithValues = []; + + flow["data"]["nodes"].forEach(t => { + + Object.keys(t['data']['node']['template']).filter( + (n) => + n.charAt(0) !== "_" && + t.data.node.template[n].show && + (t.data.node.template[n].type === + "str" || + t.data.node.template[n].type === + "bool" || + t.data.node.template[n].type === + "float" || + t.data.node.template[n].type === + "code" || + t.data.node.template[n].type === + "prompt" || + t.data.node.template[n].type === + "file" || + t.data.node.template[n].type === + "int") + ) + .map((n, i) => { + arrNodesWithValues.push(t['id']) + }) + + }) + + tweaksList.current = arrNodesWithValues.filter((value, index, self) => { + return self.indexOf(value) === index; + }); + + } + const tabs = [ { name: "cURL", @@ -238,9 +282,9 @@ export default function ApiModal({ flow }: { flow: FlowType }) { value={activeTab} className="w-full h-full overflow-hidden text-center bg-muted rounded-md border" onValueChange={(value) => { - setActiveTab(value) - - if(tweak.current.length > 0){ + setActiveTab(value); + + if (tweak.current.length > 0) { setOpenAccordion(true); } }} @@ -293,6 +337,12 @@ export default function ApiModal({ flow }: { flow: FlowType }) { > {flow["data"]["nodes"].map((t: any, index) => (
+ {( + + + tweaksList.current.includes(t["data"]["id"]) && + + { - // console.log(t.data.node.template[n]); + //console.log(t.data.node.template[n]); return ( ) : t.data.node.template[n] .multiline ? ( - -
- + +
-
+
- ) : (
+ )} + + {( + tweaksList.current.length === 0 && + <> +
No tweaks are available for this flow.
+ + )} +
))} From 1251cf70a9d093d1cc948f876e8b914ab8af8527 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Wed, 28 Jun 2023 14:20:53 -0300 Subject: [PATCH 14/72] formatting --- src/frontend/src/modals/ApiModal/index.tsx | 717 +++++++++++---------- 1 file changed, 361 insertions(+), 356 deletions(-) diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index ee0222ce1..1000a52d6 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -92,8 +92,6 @@ export default function ApiModal({ flow }: { flow: FlowType }) { } }, [closeEdit]); - - const pythonApiCode = getPythonApiCode(flow, tweak.current); const curl_code = getCurlCode(flow, tweak.current); const pythonCode = getPythonCode(flow, tweak.current); @@ -101,43 +99,32 @@ export default function ApiModal({ flow }: { flow: FlowType }) { useEffect(() => { filterNodes(); - - }, []) - function filterNodes(){ - + }, []); + function filterNodes() { let arrNodesWithValues = []; - - flow["data"]["nodes"].forEach(t => { - - Object.keys(t['data']['node']['template']).filter( - (n) => - n.charAt(0) !== "_" && - t.data.node.template[n].show && - (t.data.node.template[n].type === - "str" || - t.data.node.template[n].type === - "bool" || - t.data.node.template[n].type === - "float" || - t.data.node.template[n].type === - "code" || - t.data.node.template[n].type === - "prompt" || - t.data.node.template[n].type === - "file" || - t.data.node.template[n].type === - "int") - ) - .map((n, i) => { - arrNodesWithValues.push(t['id']) - }) - - }) + + flow["data"]["nodes"].forEach((t) => { + Object.keys(t["data"]["node"]["template"]) + .filter( + (n) => + n.charAt(0) !== "_" && + t.data.node.template[n].show && + (t.data.node.template[n].type === "str" || + t.data.node.template[n].type === "bool" || + t.data.node.template[n].type === "float" || + t.data.node.template[n].type === "code" || + t.data.node.template[n].type === "prompt" || + t.data.node.template[n].type === "file" || + t.data.node.template[n].type === "int") + ) + .map((n, i) => { + arrNodesWithValues.push(t["id"]); + }); + }); tweaksList.current = arrNodesWithValues.filter((value, index, self) => { return self.indexOf(value) === index; }); - } const tabs = [ @@ -337,329 +324,222 @@ export default function ApiModal({ flow }: { flow: FlowType }) { > {flow["data"]["nodes"].map((t: any, index) => (
- {( + {tweaksList.current.includes(t["data"]["id"]) && ( + +
+
+ + + + PARAM + + + VALUE + + + + + {Object.keys(t["data"]["node"]["template"]) + .filter( + (n) => + n.charAt(0) !== "_" && + t.data.node.template[n].show && + (t.data.node.template[n].type === + "str" || + t.data.node.template[n].type === + "bool" || + t.data.node.template[n].type === + "float" || + t.data.node.template[n].type === + "code" || + t.data.node.template[n].type === + "prompt" || + t.data.node.template[n].type === + "file" || + t.data.node.template[n].type === + "int") + ) + .map((n, i) => { + //console.log(t.data.node.template[n]); - - tweaksList.current.includes(t["data"]["id"]) && - - - -
-
- - - - PARAM - - - VALUE - - - - - {Object.keys(t["data"]["node"]["template"]) - .filter( - (n) => - n.charAt(0) !== "_" && - t.data.node.template[n].show && - (t.data.node.template[n].type === - "str" || - t.data.node.template[n].type === - "bool" || - t.data.node.template[n].type === - "float" || - t.data.node.template[n].type === - "code" || - t.data.node.template[n].type === - "prompt" || - t.data.node.template[n].type === - "file" || - t.data.node.template[n].type === - "int") - ) - .map((n, i) => { - //console.log(t.data.node.template[n]); - - return ( - - - {n} - - -
- {t.data.node.template[n].type === - "str" && - !t.data.node.template[n] - .options ? ( -
- {t.data.node.template[n] - .list ? ( - {}} - onAddInput={(k) => { - buildTweakObject( - t["data"]["id"], - k, + return ( + + + {n} + + +
+ {t.data.node.template[n] + .type === "str" && + !t.data.node.template[n] + .options ? ( +
+ {t.data.node.template[n] + .list ? ( + - ) : t.data.node.template[n] - .multiline ? ( - -
- {}} + onAddInput={(k) => { + buildTweakObject( + t["data"]["id"], + k, t.data.node .template[n] - .value, - t.data, - t.data.node - .template[n] - )} - onChange={(k) => { - buildTweakObject( - t["data"]["id"], - k, + ); + }} + /> + ) : t.data.node.template[n] + .multiline ? ( + +
+ -
-
- ) : ( - { + buildTweakObject( + t["data"]["id"], + k, + t.data.node + .template[n] + ); + }} + /> +
+
+ ) : ( + { + buildTweakObject( + t["data"]["id"], + k, + t.data.node + .template[n] + ); + }} + /> + )} +
+ ) : t.data.node.template[n] + .type === "bool" ? ( +
+ {" "} + { + setEnabled={(e) => { + t.data.node.template[ + n + ].value = e; + setEnabled(e); buildTweakObject( t["data"]["id"], - k, + e, t.data.node.template[ n ] ); }} + size="small" + disabled={false} /> - )} -
- ) : t.data.node.template[n] - .type === "bool" ? ( -
- {" "} - { - t.data.node.template[ - n - ].value = e; - setEnabled(e); - buildTweakObject( - t["data"]["id"], - e, - t.data.node.template[n] - ); - }} - size="small" - disabled={false} - /> -
- ) : t.data.node.template[n] - .type === "file" ? ( - -
- {}} - fileTypes={ - t.data.node.template[n] - .fileTypes - } - suffixes={ - t.data.node.template[n] - .suffixes - } - onFileChange={( - k: any - ) => {}} - >
-
- ) : t.data.node.template[n] - .type === "float" ? ( -
- { - buildTweakObject( - t["data"]["id"], - k, - t.data.node.template[n] - ); - }} - /> -
- ) : t.data.node.template[n] - .type === "str" && - t.data.node.template[n] - .options ? ( -
- { - buildTweakObject( - t["data"]["id"], - k, - t.data.node.template[n] - ); - }} - value={getValue( - t.data.node.template[n] - .value, - t.data, - t.data.node.template[n] - )} - > -
- ) : t.data.node.template[n] - .type === "int" ? ( -
- { - buildTweakObject( - t["data"]["id"], - k, - t.data.node.template[n] - ); - }} - /> -
- ) : t.data.node.template[n] - .type === "prompt" ? ( - -
- { - buildTweakObject( - t["data"]["id"], - k, + ) + )} + > +
+ -
- - ) : t.data.node.template[n] - .type === "code" ? ( - + ].value ?? "" + } + onChange={( + k: any + ) => {}} + fileTypes={ + t.data.node.template[ + n + ].fileTypes + } + suffixes={ + t.data.node.template[ + n + ].suffixes + } + onFileChange={( + k: any + ) => {}} + > +
+
+ ) : t.data.node.template[n] + .type === "float" ? (
-
- - ) : t.data.node.template[n] - .type === "Any" ? ( - "-" - ) : ( -
- )} -
-
-
- ); - })} - -
-
-
- )} - - {( - tweaksList.current.length === 0 && - <> -
No tweaks are available for this flow.
- - )} + ) : t.data.node.template[n] + .type === "str" && + t.data.node.template[n] + .options ? ( +
+ { + buildTweakObject( + t["data"]["id"], + k, + t.data.node.template[ + n + ] + ); + }} + value={getValue( + t.data.node.template[n] + .value, + t.data, + t.data.node.template[n] + )} + > +
+ ) : t.data.node.template[n] + .type === "int" ? ( +
+ { + buildTweakObject( + t["data"]["id"], + k, + t.data.node.template[ + n + ] + ); + }} + /> +
+ ) : t.data.node.template[n] + .type === "prompt" ? ( + +
+ { + buildTweakObject( + t["data"]["id"], + k, + t.data.node + .template[n] + ); + }} + /> +
+
+ ) : t.data.node.template[n] + .type === "code" ? ( + +
+ { + buildTweakObject( + t["data"]["id"], + k, + t.data.node + .template[n] + ); + }} + /> +
+
+ ) : t.data.node.template[n] + .type === "Any" ? ( + "-" + ) : ( +
+ )} +
+ + + ); + })} + + +
+ + )} + {tweaksList.current.length === 0 && ( + <> +
+ No tweaks are available for this flow. +
+ + )}
))} From 5da374b71364dd2367b9914b93af90e3177e656a Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 22:29:46 -0300 Subject: [PATCH 15/72] =?UTF-8?q?=E2=9C=A8=20feat(schemas.py):=20add=20Bui?= =?UTF-8?q?ldStatus=20enum=20to=20represent=20the=20status=20of=20a=20buil?= =?UTF-8?q?d=20The=20BuildStatus=20enum=20is=20added=20to=20represent=20th?= =?UTF-8?q?e=20different=20statuses=20that=20a=20build=20can=20have:=20SUC?= =?UTF-8?q?CESS,=20FAILURE,=20and=20IN=5FPROGRESS.=20This=20enum=20will=20?= =?UTF-8?q?be=20used=20to=20provide=20a=20more=20structured=20and=20consis?= =?UTF-8?q?tent=20way=20of=20handling=20build=20statuses=20in=20the=20appl?= =?UTF-8?q?ication.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/schemas.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/langflow/api/v1/schemas.py b/src/backend/langflow/api/v1/schemas.py index ed5bf8b3b..2cf62a504 100644 --- a/src/backend/langflow/api/v1/schemas.py +++ b/src/backend/langflow/api/v1/schemas.py @@ -1,3 +1,4 @@ +from enum import Enum from pathlib import Path from typing import Any, Dict, List, Optional, Union from langflow.database.models.flow import FlowCreate, FlowRead @@ -5,6 +6,14 @@ from pydantic import BaseModel, Field, validator import json +class BuildStatus(Enum): + """Status of the build.""" + + SUCCESS = "success" + FAILURE = "failure" + IN_PROGRESS = "in_progress" + + class GraphData(BaseModel): """Data inside the exported flow.""" From 48d40bfdd30abaf8c218b4c353e0d2b7f8ce819b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 22:29:56 -0300 Subject: [PATCH 16/72] =?UTF-8?q?=E2=9C=A8=20feat(chat.py):=20add=20status?= =?UTF-8?q?=20field=20to=20flow=5Fdata=5Fstore=20to=20track=20build=20stat?= =?UTF-8?q?us=20of=20flows=20The=20import=20statement=20for=20the=20BuildS?= =?UTF-8?q?tatus=20enum=20in=20the=20schemas=20module=20has=20been=20updat?= =?UTF-8?q?ed=20to=20ensure=20the=20correct=20import.=20Additionally,=20a?= =?UTF-8?q?=20new=20"status"=20field=20has=20been=20added=20to=20the=20flo?= =?UTF-8?q?w=5Fdata=5Fstore=20dictionary=20to=20track=20the=20build=20stat?= =?UTF-8?q?us=20of=20flows.=20The=20status=20is=20set=20to=20BuildStatus.I?= =?UTF-8?q?N=5FPROGRESS=20when=20a=20flow=20is=20being=20built,=20BuildSta?= =?UTF-8?q?tus.SUCCESS=20when=20the=20build=20is=20successful,=20and=20Bui?= =?UTF-8?q?ldStatus.FAILURE=20when=20there=20is=20an=20error=20during=20th?= =?UTF-8?q?e=20build=20process.=20This=20allows=20for=20better=20tracking?= =?UTF-8?q?=20and=20management=20of=20flow=20builds.=20=F0=9F=90=9B=20fix(?= =?UTF-8?q?chat.py):=20change=20import=20statement=20for=20BuildStatus=20i?= =?UTF-8?q?n=20schemas=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index a730758d2..b992afe9a 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -6,7 +6,7 @@ from fastapi import ( status, ) from fastapi.responses import StreamingResponse -from langflow.api.v1.schemas import BuiltResponse, InitResponse, StreamData +from langflow.api.v1.schemas import BuildStatus, BuiltResponse, InitResponse, StreamData from langflow.chat.manager import ChatManager from langflow.graph.graph.base import Graph @@ -49,7 +49,10 @@ async def init_build(graph_data: dict): with chat_manager.in_memory_cache._lock: chat_manager.in_memory_cache.delete(flow_id) logger.debug(f"Deleted flow {flow_id} from cache") - flow_data_store[flow_id] = {"graph_data": graph_data, "building": False} + flow_data_store[flow_id] = { + "graph_data": graph_data, + "status": BuildStatus.IN_PROGRESS, + } return InitResponse(flowId=flow_id) except Exception as exc: @@ -61,8 +64,9 @@ async def init_build(graph_data: dict): async def build_status(flow_id: str): """Check the flow_id is in the flow_data_store.""" try: - built = flow_id in flow_data_store and not isinstance( - flow_data_store[flow_id], dict + built = ( + flow_id in flow_data_store + and flow_data_store[flow_id]["status"] == BuildStatus.SUCCESS ) return BuiltResponse( @@ -86,7 +90,7 @@ async def stream_build(flow_id: str): yield str(StreamData(event="error", data={"error": error_message})) return - if flow_data_store[flow_id].get("building"): + if flow_data_store[flow_id].get("status") == BuildStatus.IN_PROGRESS: error_message = "Already building" yield str(StreamData(event="error", data={"error": error_message})) return @@ -124,6 +128,7 @@ async def stream_build(flow_id: str): except Exception as exc: params = str(exc) valid = False + flow_data_store[flow_id]["status"] = BuildStatus.FAILURE response = { "valid": valid, @@ -135,8 +140,10 @@ async def stream_build(flow_id: str): yield str(StreamData(event="message", data=response)) chat_manager.set_cache(flow_id, graph.build()) + flow_data_store[flow_id]["status"] = BuildStatus.SUCCESS except Exception as exc: logger.error("Error while building the flow: %s", exc) + flow_data_store[flow_id]["status"] = BuildStatus.FAILURE yield str(StreamData(event="error", data={"error": str(exc)})) finally: yield str(StreamData(event="message", data=final_response)) From 85b7ff1d31ef6f17c54a47c23ce2d8b7785f65b8 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 22:45:37 -0300 Subject: [PATCH 17/72] =?UTF-8?q?=F0=9F=94=A7=20chore(chat.py):=20update?= =?UTF-8?q?=20init=5Fbuild=20endpoint=20to=20include=20flow=5Fid=20as=20a?= =?UTF-8?q?=20path=20parameter=20The=20unnecessary=20imports=20have=20been?= =?UTF-8?q?=20removed=20from=20the=20chat.py=20file=20to=20improve=20code?= =?UTF-8?q?=20cleanliness=20and=20readability.=20The=20init=5Fbuild=20endp?= =?UTF-8?q?oint=20in=20the=20chat.py=20file=20has=20been=20updated=20to=20?= =?UTF-8?q?include=20the=20flow=5Fid=20as=20a=20path=20parameter=20instead?= =?UTF-8?q?=20of=20extracting=20it=20from=20the=20graph=5Fdata=20dictionar?= =?UTF-8?q?y.=20This=20change=20allows=20for=20a=20more=20explicit=20and?= =?UTF-8?q?=20consistent=20API=20design.=20=F0=9F=94=A7=20chore(chat.py):?= =?UTF-8?q?=20remove=20unnecessary=20imports=20and=20reformat=20code=20for?= =?UTF-8?q?=20better=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 18 +++++++----------- src/frontend/src/controllers/API/index.ts | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index b992afe9a..fd0232189 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -1,10 +1,4 @@ -from fastapi import ( - APIRouter, - HTTPException, - WebSocket, - WebSocketException, - status, -) +from fastapi import APIRouter, HTTPException, WebSocket, WebSocketException, status from fastapi.responses import StreamingResponse from langflow.api.v1.schemas import BuildStatus, BuiltResponse, InitResponse, StreamData @@ -32,16 +26,18 @@ async def chat(client_id: str, websocket: WebSocket): await websocket.close(code=status.WS_1011_INTERNAL_ERROR, reason=str(exc)) -@router.post("/build/init", response_model=InitResponse, status_code=201) -async def init_build(graph_data: dict): +@router.post("/build/init/{flow_id}", response_model=InitResponse, status_code=201) +async def init_build(graph_data: dict, flow_id: str): """Initialize the build by storing graph data and returning a unique session ID.""" try: - flow_id = graph_data.get("id") if flow_id is None: raise ValueError("No ID provided") # Check if already building - if flow_id in flow_data_store and flow_data_store[flow_id].get("building"): + if ( + flow_id in flow_data_store + and flow_data_store[flow_id]["status"] == BuildStatus.IN_PROGRESS + ): return InitResponse(flowId=flow_id) # Delete from cache if already exists diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index 2651a0058..cfae748d8 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -311,7 +311,7 @@ export async function getBuildStatus( export async function postBuildInit( flow: FlowType ): Promise> { - return await axios.post(`/api/v1/build/init`, flow); + return await axios.post(`/api/v1/build/init/${flow.id}`, flow); } // fetch(`/upload/${id}`, { From ce34ac4825449584bd937c72732f7cdcbff7a4d4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 22:50:55 -0300 Subject: [PATCH 18/72] =?UTF-8?q?=F0=9F=90=9B=20fix(test=5Fwebsocket.py):?= =?UTF-8?q?=20fix=20the=20endpoint=20URL=20in=20the=20test=5Finit=5Fbuild?= =?UTF-8?q?=20test=20The=20endpoint=20URL=20in=20the=20test=5Finit=5Fbuild?= =?UTF-8?q?=20test=20has=20been=20fixed=20to=20"api/v1/build/init/test"=20?= =?UTF-8?q?to=20match=20the=20correct=20URL=20pattern.=20This=20ensures=20?= =?UTF-8?q?that=20the=20test=20is=20accurately=20testing=20the=20intended?= =?UTF-8?q?=20functionality.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_websocket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_websocket.py b/tests/test_websocket.py index f571671e8..0199ff14b 100644 --- a/tests/test_websocket.py +++ b/tests/test_websocket.py @@ -7,7 +7,7 @@ import pytest def test_init_build(client): response = client.post( - "api/v1/build/init", json={"id": "test", "data": {"key": "value"}} + "api/v1/build/init/test", json={"id": "test", "data": {"key": "value"}} ) assert response.status_code == 201 assert response.json() == {"flowId": "test"} From df43dbc6bcc0776ab6e3d82f0498adeb898b479f Mon Sep 17 00:00:00 2001 From: zhenjianpeng Date: Thu, 29 Jun 2023 10:26:27 +0800 Subject: [PATCH 19/72] add custom nodes for signature, fix some problem --- src/backend/langflow/interface/memories/base.py | 3 +++ src/backend/langflow/template/frontend_node/memories.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/backend/langflow/interface/memories/base.py b/src/backend/langflow/interface/memories/base.py index f0d8f88f5..a211517f5 100644 --- a/src/backend/langflow/interface/memories/base.py +++ b/src/backend/langflow/interface/memories/base.py @@ -7,6 +7,7 @@ from langflow.template.frontend_node.base import FrontendNode from langflow.template.frontend_node.memories import MemoryFrontendNode from langflow.utils.logger import logger from langflow.utils.util import build_template_from_class +from langflow.custom.customs import get_custom_nodes class MemoryCreator(LangChainTypeCreator): @@ -26,6 +27,8 @@ class MemoryCreator(LangChainTypeCreator): def get_signature(self, name: str) -> Optional[Dict]: """Get the signature of a memory.""" try: + if name in get_custom_nodes(self.type_name).keys(): + return get_custom_nodes(self.type_name)[name] return build_template_from_class(name, memory_type_to_cls_dict) except ValueError as exc: raise ValueError("Memory not found") from exc diff --git a/src/backend/langflow/template/frontend_node/memories.py b/src/backend/langflow/template/frontend_node/memories.py index e2f533e7f..1ba0737aa 100644 --- a/src/backend/langflow/template/frontend_node/memories.py +++ b/src/backend/langflow/template/frontend_node/memories.py @@ -8,6 +8,11 @@ from langflow.template.template.base import Template class MemoryFrontendNode(FrontendNode): #! Needs testing def add_extra_fields(self) -> None: + # chat history should have another way to add common field? + # prevent adding incorect field in ChatMessageHistory + if "BaseChatMessageHistory" in self.base_classes: + pass + # add return_messages field self.template.add_field( TemplateField( @@ -65,6 +70,10 @@ class MemoryFrontendNode(FrontendNode): field.value = "" if field.name == "memory_key": field.value = "chat_history" + if field.name == "chat_memory": + field.show = True + field.advanced = False + field.required = False class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode): From d1fbbd5fffed94657aab39f0e3d2c1b686c26656 Mon Sep 17 00:00:00 2001 From: zhenjianpeng Date: Thu, 29 Jun 2023 10:38:45 +0800 Subject: [PATCH 20/72] fix bug about extra fields --- src/backend/langflow/template/frontend_node/memories.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/langflow/template/frontend_node/memories.py b/src/backend/langflow/template/frontend_node/memories.py index 1ba0737aa..7064eaa05 100644 --- a/src/backend/langflow/template/frontend_node/memories.py +++ b/src/backend/langflow/template/frontend_node/memories.py @@ -11,7 +11,7 @@ class MemoryFrontendNode(FrontendNode): # chat history should have another way to add common field? # prevent adding incorect field in ChatMessageHistory if "BaseChatMessageHistory" in self.base_classes: - pass + return # add return_messages field self.template.add_field( From 177b50695d13d49228f0ce542ea3c879f81c2ab8 Mon Sep 17 00:00:00 2001 From: zhenjianpeng Date: Thu, 29 Jun 2023 10:44:08 +0800 Subject: [PATCH 21/72] adding dependencies for langchain pg support --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index da75b0207..9c3c3d748 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,9 @@ pinecone-client = "^2.2.2" supabase = "^1.0.3" pymongo = "^4.4.0" certifi = "^2023.5.7" +psycopg = "^3.1.9" +psycopg-binary = "^3.1.9" +psycopg-c = "^3.1.9" [tool.poetry.dev-dependencies] From 281e6062f4a1231a688c05d441f51dca1a1b27c3 Mon Sep 17 00:00:00 2001 From: zhenjianpeng Date: Thu, 29 Jun 2023 11:15:09 +0800 Subject: [PATCH 22/72] remove psycopg-c --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9c3c3d748..8dea6bb60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,6 @@ pymongo = "^4.4.0" certifi = "^2023.5.7" psycopg = "^3.1.9" psycopg-binary = "^3.1.9" -psycopg-c = "^3.1.9" [tool.poetry.dev-dependencies] From ed2d4c549ed788331c642d421fcf0876a5072e01 Mon Sep 17 00:00:00 2001 From: zhenjianpeng Date: Thu, 29 Jun 2023 11:24:12 +0800 Subject: [PATCH 23/72] commit poetry lock --- poetry.lock | 104 ++++++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 2 - 2 files changed, 102 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index b13392910..add7e0732 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. [[package]] name = "aiofiles" @@ -4274,6 +4274,94 @@ files = [ [package.extras] test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"] +[[package]] +name = "psycopg" +version = "3.1.9" +description = "PostgreSQL database adapter for Python" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "psycopg-3.1.9-py3-none-any.whl", hash = "sha256:fbbac339274d8733ee70ba9822297af3e8871790a26e967b5ea53e30a4b74dcc"}, + {file = "psycopg-3.1.9.tar.gz", hash = "sha256:ab400f207a8c120bafdd8077916d8f6c0106e809401378708485b016508c30c9"}, +] + +[package.dependencies] +typing-extensions = ">=4.1" +tzdata = {version = "*", markers = "sys_platform == \"win32\""} + +[package.extras] +binary = ["psycopg-binary (==3.1.9)"] +c = ["psycopg-c (==3.1.9)"] +dev = ["black (>=23.1.0)", "dnspython (>=2.1)", "flake8 (>=4.0)", "mypy (>=1.2)", "types-setuptools (>=57.4)", "wheel (>=0.37)"] +docs = ["Sphinx (>=5.0)", "furo (==2022.6.21)", "sphinx-autobuild (>=2021.3.14)", "sphinx-autodoc-typehints (>=1.12)"] +pool = ["psycopg-pool"] +test = ["anyio (>=3.6.2)", "mypy (>=1.2)", "pproxy (>=2.7)", "pytest (>=6.2.5)", "pytest-cov (>=3.0)", "pytest-randomly (>=3.5)"] + +[[package]] +name = "psycopg-binary" +version = "3.1.9" +description = "PostgreSQL database adapter for Python -- C optimisation distribution" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "psycopg_binary-3.1.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:284038cbe3f5a0f3de417af9b5eaa2a9524a3a06211523cf245111c71b566506"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d2cea4bb0b19245c83486868d7c66f73238c4caa266b5b3c3d664d10dab2ab56"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfe5c5c31f59ccb1d1f473466baa93d800138186286e80e251f930e49c80d208"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:82704a899d57c29beba5399d41eab5ef5c238b810d7e25e2d1916d2b34c4b1a3"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:eab449e39db1c429cac79b7aa27e6827aad4995f32137e922db7254f43fed7b5"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87e0c97733b11eeca3d24e56df70f3f9d792b2abd46f48be2fb2348ffc3e7e39"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:81e34d6df54329424944d5ca91b1cc77df6b8a9130cb5480680d56f53d4e485c"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e2f463079d99568a343ed0b766150b30627e9ed41de99fd82e945e7e2bec764a"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:f2cbdef6568da21c39dfd45c2074e85eabbd00e1b721832ba94980f01f582dd4"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:53afb0cc2ebe74651f339e22d05ec082a0f44939715d9138d357852f074fcf55"}, + {file = "psycopg_binary-3.1.9-cp310-cp310-win_amd64.whl", hash = "sha256:09167f106e7685591b4cdf58eff0191fb7435d586f384133a0dd30df646cf409"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a8aaa47c1791fc05c0229ec1003dd49e13238fba9434e1fc3b879632f749c3c4"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3d91ee0d33ac7b42d0488a9be2516efa2ec00901b81d69566ff34a7a94b66c0b"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f5e36504373e5bcdc954b1da1c6fe66379007fe1e329790e8fb72b879a01e097"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c1def6c2d28e257325b3b208cf1966343b498282a0f4d390fda7b7e0577da64"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:055537a9c20efe9bf17cb72bd879602eda71de6f737ebafa1953e017c6a37fbe"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5b164355d023a91b23dcc4bb3112bc7d6e9b9c938fb5abcb6e54457d2da1f317"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:03b08545ce1c627f4d5e6384eda2946660c4ba6ceb0a09ae47de07419f725669"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:1e31bac3d2d41e6446b20b591f638943328c958f4d1ce13d6f1c5db97c3a8dee"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:a274c63c8fb9d419509bed2ef72befc1fd04243972e17e7f5afc5725cb13a560"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:98d9d156b9ada08c271a79662fc5fcc1731b4d7c1f651ef5843d818d35f15ba0"}, + {file = "psycopg_binary-3.1.9-cp311-cp311-win_amd64.whl", hash = "sha256:c3a13aa022853891cadbc7256a9804e5989def760115c82334bddf0d19783b0b"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b1a321ef3579a8de0545ade6ff1edfde0c88b8847d58c5615c03751c76054796"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5833bda4c14f24c6a8ac08d3c5712acaa4f35aab31f9ccd2265e9e9a7d0151c8"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a207d5a7f4212443b7452851c9ccd88df9c6d4d58fa2cea2ead4dd9cb328e578"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:07414daa86662f7657e9fabe49af85a32a975e92e6568337887d9c9ffedc224f"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17c5d4936c746f5125c6ef9eb43655e27d4d0c9ffe34c3073878b43c3192511d"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:5cdc13c8ec1437240801e43d07e27ff6479ac9dd8583ecf647345bfd2e8390e4"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:3836bdaf030a5648bd5f5b452e4b068b265e28f9199060c5b70dbf4a218cde6e"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:96725d9691a84a21eb3e81c884a2e043054e33e176801a57a05e9ac38d142c6e"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:dade344aa90bb0b57d1cfc13304ed83ab9a36614b8ddd671381b2de72fe1483d"}, + {file = "psycopg_binary-3.1.9-cp37-cp37m-win_amd64.whl", hash = "sha256:db866cc557d9761036771d666d17fa4176c537af7e6098f42a6bf8f64217935f"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3b62545cc64dd69ea0ae5ffe18d7c97e03660ab8244aa8c5172668a21c41daa0"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:058ab0d79be0b229338f0e61fec6f475077518cba63c22c593645a69f01c3e23"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2340ca2531f69e5ebd9d18987362ba57ed6ab6a271511d8026814a46a2a87b59"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3b816ce0e27a2a8786d34b61d3e36e01029245025879d64b88554326b794a4f0"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7b36fe4314a784fbe45c9fd71c902b9bf57341aff9b97c0cbd22f8409a271e2f"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b246fed629482b06f938b23e9281c4af592329daa3ec2cd4a6841ccbfdeb4d68"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:90787ac05b932c0fc678cbf470ccea9c385b8077583f0490136b4569ed3fb652"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:9c114f678e8f4a96530fa79cfd84f65f26358ecfc6cca70cfa2d5e3ae5ef217a"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:3a82e77400d1ef6c5bbcf3e600e8bdfacf1a554512f96c090c43ceca3d1ce3b6"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:c7d990f14a37345ca05a5192cd5ac938c9cbedca9c929872af6ae311158feb0e"}, + {file = "psycopg_binary-3.1.9-cp38-cp38-win_amd64.whl", hash = "sha256:e0ca74fd85718723bb9f08e0c6898e901a0c365aef20b3c3a4ef8709125d6210"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ce8f4dea5934aa6c4933e559c74bef4beb3413f51fbcf17f306ce890216ac33a"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f41a9e0de4db194c053bcc7c00c35422a4d19d92a8187e8065b1c560626efe35"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2f94a7985135e084e122b143956c6f589d17aef743ecd0a434a3d3a222631d5a"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3bb86d58b90faefdc0bbedf08fdea4cc2afcb1cfa4340f027d458bfd01d8b812"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6c696dc84f9ff155761df15779181d8e4af7746b98908e130add8259912e4bb7"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4213953da44324850c8f789301cf665f46fb94301ba403301e7af58546c3a428"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:25e3ce947aaaa1bd9f1920fca76d7281660646304f9ea5bc036b201dd8790655"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9c75be2a9b986139e3ff6bc0a2852081ac00811040f9b82d3aa539821311122e"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:63e8d1dbe253657c70dbfa9c59423f4654d82698fc5ed6868b8dc0765abe20b6"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:f4da4ca9b2365fc1d3fc741c3bbd3efccd892ce813444b884c8911a1acf1c932"}, + {file = "psycopg_binary-3.1.9-cp39-cp39-win_amd64.whl", hash = "sha256:c0b8d6bbeff1dba760a208d8bc205a05b745e6cee02b839f969f72cf56a8b80d"}, +] + [[package]] name = "psycopg2-binary" version = "2.9.6" @@ -6471,6 +6559,18 @@ files = [ mypy-extensions = ">=0.3.0" typing-extensions = ">=3.7.4" +[[package]] +name = "tzdata" +version = "2023.3" +description = "Provider of IANA time zone data" +category = "main" +optional = false +python-versions = ">=2" +files = [ + {file = "tzdata-2023.3-py2.py3-none-any.whl", hash = "sha256:7e65763eef3120314099b6939b5546db7adce1e7d6f2e179e3df563c70511eda"}, + {file = "tzdata-2023.3.tar.gz", hash = "sha256:11ef1e08e54acb0d4f95bdb1be05da659673de4acbd21bf9c69e94cc5e907a3a"}, +] + [[package]] name = "unstructured" version = "0.5.13" @@ -7115,4 +7215,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "2f8373e1c80ce345f39ed9247fd4759ae94b5c754c4e850d3aa72183556eb92b" +content-hash = "88f4b394eb96c8307d7734e8216304b074a9aedcc52b2299ea750fa2a76ceb4b" diff --git a/pyproject.toml b/pyproject.toml index 8dea6bb60..da75b0207 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,8 +70,6 @@ pinecone-client = "^2.2.2" supabase = "^1.0.3" pymongo = "^4.4.0" certifi = "^2023.5.7" -psycopg = "^3.1.9" -psycopg-binary = "^3.1.9" [tool.poetry.dev-dependencies] From 303c0ff5d2c87f115f1ff3fa8f28587e0e15240c Mon Sep 17 00:00:00 2001 From: zhenjianpeng Date: Thu, 29 Jun 2023 11:31:50 +0800 Subject: [PATCH 24/72] something wrong about pyproject.toml --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index da75b0207..07df52cb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,7 +70,8 @@ pinecone-client = "^2.2.2" supabase = "^1.0.3" pymongo = "^4.4.0" certifi = "^2023.5.7" - +psycopg = "^3.1.9" +psycopg-binary = "^3.1.9" [tool.poetry.dev-dependencies] black = "^23.1.0" From 78831f1051f23d4f483e48cdee96535ef54e5322 Mon Sep 17 00:00:00 2001 From: zhenjianpeng Date: Thu, 29 Jun 2023 11:54:28 +0800 Subject: [PATCH 25/72] remove memory support and make it a proposal --- src/backend/langflow/interface/initialize/loading.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index c527d745a..41867085e 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -225,7 +225,8 @@ def load_agent_executor(agent_class: type[agent_module.Agent], params, **kwargs) """Load agent executor from agent class, tools and chain""" allowed_tools: Sequence[BaseTool] = params.get("allowed_tools", []) llm_chain = params["llm_chain"] - memory = params["memory"] + # agent has hidden args for memory. might need to be support + # memory = params["memory"] # if allowed_tools is not a list or set, make it a list if not isinstance(allowed_tools, (list, set)) and isinstance( allowed_tools, BaseTool @@ -238,7 +239,7 @@ def load_agent_executor(agent_class: type[agent_module.Agent], params, **kwargs) return AgentExecutor.from_agent_and_tools( agent=agent, tools=allowed_tools, - memory=memory, + # memory=memory, **kwargs, ) From df0b3160402c8b0ef28709145bc91dca42125392 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 06:49:24 -0300 Subject: [PATCH 26/72] =?UTF-8?q?=F0=9F=94=80=20chore(pyproject.toml):=20u?= =?UTF-8?q?pdate=20dependencies=20versions=20=E2=AC=86=EF=B8=8F=20feat(pyp?= =?UTF-8?q?roject.toml):=20update=20beautifulsoup4=20to=20version=204.12.2?= =?UTF-8?q?=20=E2=AC=86=EF=B8=8F=20feat(pyproject.toml):=20update=20langch?= =?UTF-8?q?ain=20to=20version=200.0.219=20=E2=AC=86=EF=B8=8F=20feat(pyproj?= =?UTF-8?q?ect.toml):=20update=20pandas=20to=20version=202.0.0=20=E2=AC=86?= =?UTF-8?q?=EF=B8=8F=20feat(pyproject.toml):=20update=20huggingface-hub=20?= =?UTF-8?q?to=20version=200.15.0=20=E2=AC=86=EF=B8=8F=20feat(pyproject.tom?= =?UTF-8?q?l):=20update=20unstructured=20to=20version=200.7.0=20=E2=AC=86?= =?UTF-8?q?=EF=B8=8F=20feat(pyproject.toml):=20update=20pypdf=20to=20versi?= =?UTF-8?q?on=203.11.0=20=E2=AC=86=EF=B8=8F=20feat(pyproject.toml):=20upda?= =?UTF-8?q?te=20langchain-serve=20to=20version=20>0.0.47=20=E2=AC=86?= =?UTF-8?q?=EF=B8=8F=20feat(pyproject.toml):=20update=20qdrant-client=20to?= =?UTF-8?q?=20version=201.3.0=20=E2=AC=86=EF=B8=8F=20feat(pyproject.toml):?= =?UTF-8?q?=20update=20ctransformers=20to=20version=200.2.10=20=E2=AC=86?= =?UTF-8?q?=EF=B8=8F=20feat(pyproject.toml):=20update=20cohere=20to=20vers?= =?UTF-8?q?ion=204.11.0=20=E2=AC=86=EF=B8=8F=20feat(pyproject.toml):=20upd?= =?UTF-8?q?ate=20anthropic=20to=20version=200.3.0=20=E2=AC=86=EF=B8=8F=20f?= =?UTF-8?q?eat(pyproject.toml):=20update=20types-pyyaml=20to=20version=206?= =?UTF-8?q?.0.12.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dependencies in the pyproject.toml file have been updated to their latest versions. These updates include various bug fixes, performance improvements, and new features. It is important to keep the dependencies up to date to ensure compatibility and take advantage of the latest enhancements and fixes provided by the library maintainers. --- poetry.lock | 696 ++++++++++++++++++++++++++++++++++--------------- pyproject.toml | 24 +- 2 files changed, 502 insertions(+), 218 deletions(-) diff --git a/poetry.lock b/poetry.lock index 51dd06f9b..c1d7dda7e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. [[package]] name = "aiofiles" @@ -150,24 +150,23 @@ files = [ [[package]] name = "anthropic" -version = "0.2.10" -description = "Library for accessing the anthropic API" +version = "0.3.0" +description = "Client library for the anthropic API" category = "main" optional = false -python-versions = ">=3.8" +python-versions = ">=3.7,<4.0" files = [ - {file = "anthropic-0.2.10-py3-none-any.whl", hash = "sha256:a007496207fd186b0bcb9592b00ca130069d2a427f3d6f602a61dbbd1ac6316e"}, - {file = "anthropic-0.2.10.tar.gz", hash = "sha256:e4da061a86d8ffb86072c0b0feaf219a3a4f7dfddd4224df9ba769e469498c19"}, + {file = "anthropic-0.3.0-py3-none-any.whl", hash = "sha256:13d1d5eb6c835dfa79922eef66589d602c09294105a2951bc7f4284a0581090c"}, + {file = "anthropic-0.3.0.tar.gz", hash = "sha256:e239046e9276486391152f147c81d990b226facd4434ad968585912ffff4e031"}, ] [package.dependencies] -aiohttp = "*" -httpx = "*" -requests = "*" -tokenizers = "*" - -[package.extras] -dev = ["black (>=22.3.0)", "pytest"] +anyio = ">=3.5.0" +distro = ">=1.7.0" +httpx = ">=0.23.0" +pydantic = ">=1.9.0" +tokenizers = ">=0.13.0" +typing-extensions = ">=4.1.1" [[package]] name = "anyio" @@ -770,19 +769,20 @@ sqlalchemy = ["sqlalchemy (>1.3.21,<2.0)"] [[package]] name = "cohere" -version = "4.9.0" +version = "4.11.2" description = "" category = "main" optional = false python-versions = ">=3.7,<4.0" files = [ - {file = "cohere-4.9.0-py3-none-any.whl", hash = "sha256:d29affeb26e882518b0a28ee85aabb8bfbe65576228de04ec2a9aa375f582729"}, - {file = "cohere-4.9.0.tar.gz", hash = "sha256:e1df3dc7e3e0e47652532c6bc87e8eb8c30688c7de1d7417e56cb45d2fbea1b6"}, + {file = "cohere-4.11.2-py3-none-any.whl", hash = "sha256:c5032f4a2aafbcfdf1cacd5b49121c8cc4804fbd121d4a7ac0dfea499398ea28"}, + {file = "cohere-4.11.2.tar.gz", hash = "sha256:4d3e663a306e6fcb87c41cded2195257ebc6992d361a70417f6616f045c4ec47"}, ] [package.dependencies] aiohttp = ">=3.0,<4.0" backoff = ">=2.0,<3.0" +importlib_metadata = ">=6.0,<7.0" requests = ">=2.0,<3.0" [[package]] @@ -1079,6 +1079,18 @@ files = [ [package.extras] graph = ["objgraph (>=1.7.2)"] +[[package]] +name = "distro" +version = "1.8.0" +description = "Distro - an OS platform information API" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "distro-1.8.0-py3-none-any.whl", hash = "sha256:99522ca3e365cac527b44bde033f64c6945d90eb9f769703caaec52b09bbd3ff"}, + {file = "distro-1.8.0.tar.gz", hash = "sha256:02e111d1dc6a50abb8eed6bf31c3e48ed8b0830d1ea2a1b78c61765c2513fdd8"}, +] + [[package]] name = "dnspython" version = "2.3.0" @@ -1395,6 +1407,18 @@ files = [ docs = ["furo (>=2023.5.20)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] testing = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +[[package]] +name = "filetype" +version = "1.2.0" +description = "Infer file type and MIME type of any file/buffer. No external dependencies." +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "filetype-1.2.0-py2.py3-none-any.whl", hash = "sha256:7ce71b6880181241cf7ac8697a2f1eb6a8bd9b429f7ad6d27b8db9ba5f1c2d25"}, + {file = "filetype-1.2.0.tar.gz", hash = "sha256:66b56cd6474bf41d8c54660347d37afcc3f7d1970648de365c102ef77548aadb"}, +] + [[package]] name = "flatbuffers" version = "23.5.26" @@ -1491,6 +1515,42 @@ files = [ {file = "frozenlist-1.3.3.tar.gz", hash = "sha256:58bcc55721e8a90b88332d6cd441261ebb22342e238296bb330968952fbb3a6a"}, ] +[[package]] +name = "fsspec" +version = "2023.6.0" +description = "File-system specification" +category = "main" +optional = false +python-versions = ">=3.8" +files = [ + {file = "fsspec-2023.6.0-py3-none-any.whl", hash = "sha256:1cbad1faef3e391fba6dc005ae9b5bdcbf43005c9167ce78c915549c352c869a"}, + {file = "fsspec-2023.6.0.tar.gz", hash = "sha256:d0b2f935446169753e7a5c5c55681c54ea91996cc67be93c39a154fb3a2742af"}, +] + +[package.extras] +abfs = ["adlfs"] +adl = ["adlfs"] +arrow = ["pyarrow (>=1)"] +dask = ["dask", "distributed"] +devel = ["pytest", "pytest-cov"] +dropbox = ["dropbox", "dropboxdrivefs", "requests"] +full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "dask", "distributed", "dropbox", "dropboxdrivefs", "fusepy", "gcsfs", "libarchive-c", "ocifs", "panel", "paramiko", "pyarrow (>=1)", "pygit2", "requests", "s3fs", "smbprotocol", "tqdm"] +fuse = ["fusepy"] +gcs = ["gcsfs"] +git = ["pygit2"] +github = ["requests"] +gs = ["gcsfs"] +gui = ["panel"] +hdfs = ["pyarrow (>=1)"] +http = ["aiohttp (!=4.0.0a0,!=4.0.0a1)", "requests"] +libarchive = ["libarchive-c"] +oci = ["ocifs"] +s3 = ["s3fs"] +sftp = ["paramiko"] +smb = ["smbprotocol"] +ssh = ["paramiko"] +tqdm = ["tqdm"] + [[package]] name = "gitdb" version = "4.0.10" @@ -2076,18 +2136,19 @@ socks = ["socksio (>=1.0.0,<2.0.0)"] [[package]] name = "huggingface-hub" -version = "0.13.4" +version = "0.15.1" description = "Client library to download and publish models, datasets and other repos on the huggingface.co hub" category = "main" optional = false python-versions = ">=3.7.0" files = [ - {file = "huggingface_hub-0.13.4-py3-none-any.whl", hash = "sha256:4d3d40593de6673d624a4baaaf249b9bf5165bfcafd1ad58de361931f0b4fda5"}, - {file = "huggingface_hub-0.13.4.tar.gz", hash = "sha256:db83d9c2f76aed8cf49893ffadd6be24e82074da2f64b1d36b8ba40eb255e115"}, + {file = "huggingface_hub-0.15.1-py3-none-any.whl", hash = "sha256:05b0fb0abbf1f625dfee864648ac3049fe225ac4371c7bafaca0c2d3a2f83445"}, + {file = "huggingface_hub-0.15.1.tar.gz", hash = "sha256:a61b7d1a7769fe10119e730277c72ab99d95c48d86a3d6da3e9f3d0f632a4081"}, ] [package.dependencies] filelock = "*" +fsspec = "*" packaging = ">=20.9" pyyaml = ">=5.1" requests = "*" @@ -2095,13 +2156,13 @@ tqdm = ">=4.42.1" typing-extensions = ">=3.7.4.3" [package.extras] -all = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "black (>=23.1,<24.0)", "jedi", "mypy (==0.982)", "pytest", "pytest-cov", "pytest-env", "pytest-xdist", "ruff (>=0.0.241)", "soundfile", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3"] +all = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "black (>=23.1,<24.0)", "gradio", "jedi", "mypy (==0.982)", "numpy", "pytest", "pytest-cov", "pytest-env", "pytest-vcr", "pytest-xdist", "ruff (>=0.0.241)", "soundfile", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3", "urllib3 (<2.0)"] cli = ["InquirerPy (==0.3.4)"] -dev = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "black (>=23.1,<24.0)", "jedi", "mypy (==0.982)", "pytest", "pytest-cov", "pytest-env", "pytest-xdist", "ruff (>=0.0.241)", "soundfile", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3"] +dev = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "black (>=23.1,<24.0)", "gradio", "jedi", "mypy (==0.982)", "numpy", "pytest", "pytest-cov", "pytest-env", "pytest-vcr", "pytest-xdist", "ruff (>=0.0.241)", "soundfile", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3", "urllib3 (<2.0)"] fastai = ["fastai (>=2.4)", "fastcore (>=1.3.27)", "toml"] quality = ["black (>=23.1,<24.0)", "mypy (==0.982)", "ruff (>=0.0.241)"] tensorflow = ["graphviz", "pydot", "tensorflow"] -testing = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "jedi", "pytest", "pytest-cov", "pytest-env", "pytest-xdist", "soundfile"] +testing = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "gradio", "jedi", "numpy", "pytest", "pytest-cov", "pytest-env", "pytest-vcr", "pytest-xdist", "soundfile", "urllib3 (<2.0)"] torch = ["torch"] typing = ["types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3"] @@ -2146,21 +2207,21 @@ files = [ [[package]] name = "importlib-metadata" -version = "4.13.0" +version = "6.0.1" description = "Read metadata from Python packages" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "importlib_metadata-4.13.0-py3-none-any.whl", hash = "sha256:8a8a81bcf996e74fee46f0d16bd3eaa382a7eb20fd82445c3ad11f4090334116"}, - {file = "importlib_metadata-4.13.0.tar.gz", hash = "sha256:dd0173e8f150d6815e098fd354f6414b0f079af4644ddfe90c71e2fc6174346d"}, + {file = "importlib_metadata-6.0.1-py3-none-any.whl", hash = "sha256:1543daade821c89b1c4a55986c326f36e54f2e6ca3bad96be4563d0acb74dcd4"}, + {file = "importlib_metadata-6.0.1.tar.gz", hash = "sha256:950127d57e35a806d520817d3e92eec3f19fdae9f0cd99da77a407c5aabefba3"}, ] [package.dependencies] zipp = ">=0.5" [package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)"] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] perf = ["ipython"] testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"] @@ -2604,14 +2665,14 @@ testing = ["pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", [[package]] name = "langchain" -version = "0.0.218" +version = "0.0.219" description = "Building applications with LLMs through composability" category = "main" optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langchain-0.0.218-py3-none-any.whl", hash = "sha256:c78b0bd65791b80ddf132913ce2239d4cb2dca2dde0ce20a77f36af0c12d397c"}, - {file = "langchain-0.0.218.tar.gz", hash = "sha256:85a237d5b3664bf9acc87420c813df245c03ef1a68cc2424eeb0d81e60d7a0b7"}, + {file = "langchain-0.0.219-py3-none-any.whl", hash = "sha256:1f08a00e622f1c75087d6013f34e82be3f8dd1859266eb583a0fd7bc045090cf"}, + {file = "langchain-0.0.219.tar.gz", hash = "sha256:842f8212939e5ac4005906d2215574ffb3e34d2fe28f5bc0f46eb3b28fb29c5d"}, ] [package.dependencies] @@ -2629,7 +2690,7 @@ 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)", "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)"] +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)", "octoai-sdk (>=0.1.1,<0.2.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)"] @@ -2644,13 +2705,13 @@ text-helpers = ["chardet (>=5.1.0,<6.0.0)"] [[package]] name = "langchain-serve" -version = "0.0.47" +version = "0.0.48" description = "Langchain Serve - serve your langchain apps on Jina AI Cloud." category = "main" optional = true python-versions = "*" files = [ - {file = "langchain-serve-0.0.47.tar.gz", hash = "sha256:2b7827ddaffa4fe6eb8fa988fc8b9be827ded702340f1644f065200b89fdc3a9"}, + {file = "langchain-serve-0.0.48.tar.gz", hash = "sha256:4644eb7a6aa733edcd809a0becf49a2899c285a5adb0bab454f91bbb8e0be39b"}, ] [package.dependencies] @@ -2685,6 +2746,27 @@ pydantic = ">=1,<2" requests = ">=2,<3" tenacity = ">=8.1.0,<9.0.0" +[[package]] +name = "linkify-it-py" +version = "2.0.2" +description = "Links recognition library with FULL unicode support." +category = "main" +optional = true +python-versions = ">=3.7" +files = [ + {file = "linkify-it-py-2.0.2.tar.gz", hash = "sha256:19f3060727842c254c808e99d465c80c49d2c7306788140987a1a7a29b0d6ad2"}, + {file = "linkify_it_py-2.0.2-py3-none-any.whl", hash = "sha256:a3a24428f6c96f27370d7fe61d2ac0be09017be5190d68d8658233171f1b6541"}, +] + +[package.dependencies] +uc-micro-py = "*" + +[package.extras] +benchmark = ["pytest", "pytest-benchmark"] +dev = ["black", "flake8", "isort", "pre-commit", "pyproject-flake8"] +doc = ["myst-parser", "sphinx", "sphinx-book-theme"] +test = ["coverage", "pytest", "pytest-cov"] + [[package]] name = "llama-cpp-python" version = "0.1.55" @@ -2881,17 +2963,19 @@ testing = ["coverage", "pyyaml"] [[package]] name = "markdown-it-py" -version = "3.0.0" +version = "2.2.0" description = "Python port of markdown-it. Markdown parsing, done right!" category = "main" optional = false -python-versions = ">=3.8" +python-versions = ">=3.7" files = [ - {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, - {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, + {file = "markdown-it-py-2.2.0.tar.gz", hash = "sha256:7c9a5e412688bc771c67432cbfebcdd686c93ce6484913dccf06cb5a0bea35a1"}, + {file = "markdown_it_py-2.2.0-py3-none-any.whl", hash = "sha256:5a35f8d1870171d9acc47b99612dc146129b631baf04970128b568f190d0cc30"}, ] [package.dependencies] +linkify-it-py = {version = ">=1,<3", optional = true, markers = "extra == \"linkify\""} +mdit-py-plugins = {version = "*", optional = true, markers = "extra == \"plugins\""} mdurl = ">=0.1,<1.0" [package.extras] @@ -2901,7 +2985,7 @@ compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0 linkify = ["linkify-it-py (>=1,<3)"] plugins = ["mdit-py-plugins"] profiling = ["gprof2dot"] -rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +rtd = ["attrs", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] [[package]] @@ -3015,6 +3099,26 @@ files = [ [package.dependencies] traitlets = "*" +[[package]] +name = "mdit-py-plugins" +version = "0.4.0" +description = "Collection of plugins for markdown-it-py" +category = "main" +optional = true +python-versions = ">=3.8" +files = [ + {file = "mdit_py_plugins-0.4.0-py3-none-any.whl", hash = "sha256:b51b3bb70691f57f974e257e367107857a93b36f322a9e6d44ca5bf28ec2def9"}, + {file = "mdit_py_plugins-0.4.0.tar.gz", hash = "sha256:d8ab27e9aed6c38aa716819fedfde15ca275715955f8a185a8e1cf90fb1d2c1b"}, +] + +[package.dependencies] +markdown-it-py = ">=1.0.0,<4.0.0" + +[package.extras] +code-style = ["pre-commit"] +rtd = ["myst-parser", "sphinx-book-theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + [[package]] name = "mdurl" version = "0.1.2" @@ -3257,18 +3361,6 @@ files = [ {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, ] -[[package]] -name = "nanoid" -version = "2.0.0" -description = "A tiny, secure, URL-friendly, unique string ID generator for Python" -category = "main" -optional = true -python-versions = "*" -files = [ - {file = "nanoid-2.0.0-py3-none-any.whl", hash = "sha256:90aefa650e328cffb0893bbd4c236cfd44c48bc1f2d0b525ecc53c3187b653bb"}, - {file = "nanoid-2.0.0.tar.gz", hash = "sha256:5a80cad5e9c6e9ae3a41fa2fb34ae189f7cb420b2a5d8f82bd9d23466e4efa68"}, -] - [[package]] name = "nest-asyncio" version = "1.5.6" @@ -3512,77 +3604,97 @@ et-xmlfile = "*" [[package]] name = "opentelemetry-api" -version = "1.16.0" +version = "1.18.0" description = "OpenTelemetry Python API" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_api-1.16.0-py3-none-any.whl", hash = "sha256:79e8f0cf88dbdd36b6abf175d2092af1efcaa2e71552d0d2b3b181a9707bf4bc"}, - {file = "opentelemetry_api-1.16.0.tar.gz", hash = "sha256:4b0e895a3b1f5e1908043ebe492d33e33f9ccdbe6d02d3994c2f8721a63ddddb"}, + {file = "opentelemetry_api-1.18.0-py3-none-any.whl", hash = "sha256:d05bcc94ec239fd76fd90d784c5e3ad081a8a1ac2ffc8a2c83a49ace052d1492"}, + {file = "opentelemetry_api-1.18.0.tar.gz", hash = "sha256:2bbf29739fcef268c419e3bf1735566c2e7f81026c14bcc78b62a0b97f8ecf2f"}, ] [package.dependencies] deprecated = ">=1.2.6" +importlib-metadata = ">=6.0.0,<6.1.0" setuptools = ">=16.0" [[package]] name = "opentelemetry-exporter-otlp" -version = "1.16.0" +version = "1.18.0" description = "OpenTelemetry Collector Exporters" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_exporter_otlp-1.16.0-py3-none-any.whl", hash = "sha256:e1a91a267afb7ae0196cb25ed0bc0a991ff5d9f3d6b3a7ff7c0bce57be2d72d5"}, - {file = "opentelemetry_exporter_otlp-1.16.0.tar.gz", hash = "sha256:5d76b4a44aa5c11e93b9280eaf93ae497557cf01046485ec1c7bfb2c492dabc4"}, + {file = "opentelemetry_exporter_otlp-1.18.0-py3-none-any.whl", hash = "sha256:2b8d18aa3f8fa360df2fe6c274132cf38939a02f8aa621d6ed060a920aa9e4c6"}, + {file = "opentelemetry_exporter_otlp-1.18.0.tar.gz", hash = "sha256:cafcf7f28debbcc22e06d52cdc4f65a118f17b730dabe8f9d4b87587e95b1481"}, ] [package.dependencies] -opentelemetry-exporter-otlp-proto-grpc = "1.16.0" -opentelemetry-exporter-otlp-proto-http = "1.16.0" +opentelemetry-exporter-otlp-proto-grpc = "1.18.0" +opentelemetry-exporter-otlp-proto-http = "1.18.0" + +[[package]] +name = "opentelemetry-exporter-otlp-proto-common" +version = "1.18.0" +description = "OpenTelemetry Protobuf encoding" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "opentelemetry_exporter_otlp_proto_common-1.18.0-py3-none-any.whl", hash = "sha256:276073ccc8c6e6570fe05ca8ca0de77d662bc89bc614ec8bfbc855112f7e25e3"}, + {file = "opentelemetry_exporter_otlp_proto_common-1.18.0.tar.gz", hash = "sha256:4d9883d6929aabe75e485950bbe8b149a14d95e50b1570426832daa6913b0871"}, +] + +[package.dependencies] +opentelemetry-proto = "1.18.0" [[package]] name = "opentelemetry-exporter-otlp-proto-grpc" -version = "1.16.0" +version = "1.18.0" description = "OpenTelemetry Collector Protobuf over gRPC Exporter" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_exporter_otlp_proto_grpc-1.16.0-py3-none-any.whl", hash = "sha256:ace2cedc43bc30e1b2475b14f72acf1a1528716965209d31fb0a72c59f0f4fe4"}, - {file = "opentelemetry_exporter_otlp_proto_grpc-1.16.0.tar.gz", hash = "sha256:0853ea1e566c1fab5633e7f7bca2a650ba445b04ba02f93173920b0f5c561f63"}, + {file = "opentelemetry_exporter_otlp_proto_grpc-1.18.0-py3-none-any.whl", hash = "sha256:c773bc9df2c9d6464f0d5936963399b2fc440f0616c1277f29512d540ad7e0a2"}, + {file = "opentelemetry_exporter_otlp_proto_grpc-1.18.0.tar.gz", hash = "sha256:8eddfde4267da876871e62f1b58369986bdb7e47e43032c498f1ea807d7191c4"}, ] [package.dependencies] backoff = {version = ">=1.10.0,<3.0.0", markers = "python_version >= \"3.7\""} +deprecated = ">=1.2.6" googleapis-common-protos = ">=1.52,<2.0" grpcio = ">=1.0.0,<2.0.0" opentelemetry-api = ">=1.15,<2.0" -opentelemetry-proto = "1.16.0" -opentelemetry-sdk = ">=1.16.0,<1.17.0" +opentelemetry-exporter-otlp-proto-common = "1.18.0" +opentelemetry-proto = "1.18.0" +opentelemetry-sdk = ">=1.18.0,<1.19.0" [package.extras] test = ["pytest-grpc"] [[package]] name = "opentelemetry-exporter-otlp-proto-http" -version = "1.16.0" +version = "1.18.0" description = "OpenTelemetry Collector Protobuf over HTTP Exporter" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_exporter_otlp_proto_http-1.16.0-py3-none-any.whl", hash = "sha256:f27cabd0e071fb8cc258bcaaad51b0c228fef1156bf6e6b1f9ae738881d9bf51"}, - {file = "opentelemetry_exporter_otlp_proto_http-1.16.0.tar.gz", hash = "sha256:d7f14ae8b41b3606ee3e4ab12d42cb48610d8419f1d8b92c7d3ff5813c7a10d7"}, + {file = "opentelemetry_exporter_otlp_proto_http-1.18.0-py3-none-any.whl", hash = "sha256:c22110705473f1c61bd4d74ded3b8bd3fac66ffbe7d9ba376267d8539919ed90"}, + {file = "opentelemetry_exporter_otlp_proto_http-1.18.0.tar.gz", hash = "sha256:d9a2118558decf9e9a2d6573ad9d33876f3a44d7dc43f10d38a900d5a6f867d6"}, ] [package.dependencies] backoff = {version = ">=1.10.0,<3.0.0", markers = "python_version >= \"3.7\""} +deprecated = ">=1.2.6" googleapis-common-protos = ">=1.52,<2.0" opentelemetry-api = ">=1.15,<2.0" -opentelemetry-proto = "1.16.0" -opentelemetry-sdk = ">=1.16.0,<1.17.0" +opentelemetry-exporter-otlp-proto-common = "1.18.0" +opentelemetry-proto = "1.18.0" +opentelemetry-sdk = ">=1.18.0,<1.19.0" requests = ">=2.7,<3.0" [package.extras] @@ -3607,14 +3719,14 @@ prometheus-client = ">=0.5.0,<1.0.0" [[package]] name = "opentelemetry-instrumentation" -version = "0.37b0" +version = "0.39b0" description = "Instrumentation Tools & Auto Instrumentation for OpenTelemetry Python" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_instrumentation-0.37b0-py3-none-any.whl", hash = "sha256:0dbd4d869608667b9dfaf39914312c5979370d5fc5faa36678f5e25fa54f045b"}, - {file = "opentelemetry_instrumentation-0.37b0.tar.gz", hash = "sha256:2a172a7ef8d35332f24a97caf6b7b62fe418a48cf841ae2bcdaed338fea37b41"}, + {file = "opentelemetry_instrumentation-0.39b0-py3-none-any.whl", hash = "sha256:fcfd74413159fe797e343104f7e85a3f8146713634debcac10a057ac7f1eb011"}, + {file = "opentelemetry_instrumentation-0.39b0.tar.gz", hash = "sha256:2a6d1f386aa769dc763e6f2c6b483f50c4024f1bc76a78b57f05ae05970ce5f4"}, ] [package.dependencies] @@ -3624,21 +3736,21 @@ wrapt = ">=1.0.0,<2.0.0" [[package]] name = "opentelemetry-instrumentation-aiohttp-client" -version = "0.37b0" +version = "0.39b0" description = "OpenTelemetry aiohttp client instrumentation" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_instrumentation_aiohttp_client-0.37b0-py3-none-any.whl", hash = "sha256:d047c711dff98e35b31ed5b6c801fc59ee5f79cb3d2a6217761a366894d73269"}, - {file = "opentelemetry_instrumentation_aiohttp_client-0.37b0.tar.gz", hash = "sha256:eb21d618aa810ad72764d02b5a6da3d578116ddcb5213c84feba721f0dff7060"}, + {file = "opentelemetry_instrumentation_aiohttp_client-0.39b0-py3-none-any.whl", hash = "sha256:315adf314f35532677b7ae2abd9a663ec86df7183594605592f0e89e599d86ca"}, + {file = "opentelemetry_instrumentation_aiohttp_client-0.39b0.tar.gz", hash = "sha256:20fd66f4aa757728e48efae1351d9eed98d6e352595933f47ca042df9d83fc78"}, ] [package.dependencies] opentelemetry-api = ">=1.12,<2.0" -opentelemetry-instrumentation = "0.37b0" -opentelemetry-semantic-conventions = "0.37b0" -opentelemetry-util-http = "0.37b0" +opentelemetry-instrumentation = "0.39b0" +opentelemetry-semantic-conventions = "0.39b0" +opentelemetry-util-http = "0.39b0" wrapt = ">=1.0.0,<2.0.0" [package.extras] @@ -3647,83 +3759,83 @@ test = ["opentelemetry-instrumentation-aiohttp-client[instruments]"] [[package]] name = "opentelemetry-instrumentation-asgi" -version = "0.37b0" +version = "0.39b0" description = "ASGI instrumentation for OpenTelemetry" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_instrumentation_asgi-0.37b0-py3-none-any.whl", hash = "sha256:71ded26c8425b2f44573a2a1ef0b41941436e0b4d1e91067d84ef6ebc1bba49f"}, - {file = "opentelemetry_instrumentation_asgi-0.37b0.tar.gz", hash = "sha256:b8557d8823a04e083aae18f285a4c2ed75746acf9f2e63e44778f2aa8942af02"}, + {file = "opentelemetry_instrumentation_asgi-0.39b0-py3-none-any.whl", hash = "sha256:cb9cbf56e32be12b0e5e70c21cf27999f10920afc73110457f4e4b0ec4078c5f"}, + {file = "opentelemetry_instrumentation_asgi-0.39b0.tar.gz", hash = "sha256:28b76aa6b9fe41fcfa52214c2e554a79cc371927d13c40b22e7a02aff35760eb"}, ] [package.dependencies] asgiref = ">=3.0,<4.0" opentelemetry-api = ">=1.12,<2.0" -opentelemetry-instrumentation = "0.37b0" -opentelemetry-semantic-conventions = "0.37b0" -opentelemetry-util-http = "0.37b0" +opentelemetry-instrumentation = "0.39b0" +opentelemetry-semantic-conventions = "0.39b0" +opentelemetry-util-http = "0.39b0" [package.extras] instruments = ["asgiref (>=3.0,<4.0)"] -test = ["opentelemetry-instrumentation-asgi[instruments]", "opentelemetry-test-utils (==0.37b0)"] +test = ["opentelemetry-instrumentation-asgi[instruments]", "opentelemetry-test-utils (==0.39b0)"] [[package]] name = "opentelemetry-instrumentation-fastapi" -version = "0.37b0" +version = "0.39b0" description = "OpenTelemetry FastAPI Instrumentation" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_instrumentation_fastapi-0.37b0-py3-none-any.whl", hash = "sha256:dc983910d9c582addb934f051848158cf0155f4ccca83b5cc10904991c4d429c"}, - {file = "opentelemetry_instrumentation_fastapi-0.37b0.tar.gz", hash = "sha256:84e50dc92b3ae65f4e18d0cad6538db267690361a55644553a5f3b32f64e2de9"}, + {file = "opentelemetry_instrumentation_fastapi-0.39b0-py3-none-any.whl", hash = "sha256:33223b46393ef63229d35c4e0903e900674d3dfc65ada49fbfd51db8742295cb"}, + {file = "opentelemetry_instrumentation_fastapi-0.39b0.tar.gz", hash = "sha256:02d4d583a0a62efc9a94d489f1a736ca2905fb6f7d445ac686608de51d7e375b"}, ] [package.dependencies] opentelemetry-api = ">=1.12,<2.0" -opentelemetry-instrumentation = "0.37b0" -opentelemetry-instrumentation-asgi = "0.37b0" -opentelemetry-semantic-conventions = "0.37b0" -opentelemetry-util-http = "0.37b0" +opentelemetry-instrumentation = "0.39b0" +opentelemetry-instrumentation-asgi = "0.39b0" +opentelemetry-semantic-conventions = "0.39b0" +opentelemetry-util-http = "0.39b0" [package.extras] -instruments = ["fastapi (<=0.90.1)"] -test = ["httpx (>=0.22,<1.0)", "opentelemetry-instrumentation-fastapi[instruments]", "opentelemetry-test-utils (==0.37b0)", "requests (>=2.23,<3.0)"] +instruments = ["fastapi (>=0.58,<1.0)"] +test = ["httpx (>=0.22,<1.0)", "opentelemetry-instrumentation-fastapi[instruments]", "opentelemetry-test-utils (==0.39b0)", "requests (>=2.23,<3.0)"] [[package]] name = "opentelemetry-instrumentation-grpc" -version = "0.37b0" +version = "0.39b0" description = "OpenTelemetry gRPC instrumentation" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_instrumentation_grpc-0.37b0-py3-none-any.whl", hash = "sha256:a40ceb2b744b182b9956dd365f9978b2ec24ad01a3ee3945ae000ff5119215d8"}, - {file = "opentelemetry_instrumentation_grpc-0.37b0.tar.gz", hash = "sha256:80d6d3084e0402849a2f5a1fc9bbbcc6821c3dc12b05834765bf4882aa36fe67"}, + {file = "opentelemetry_instrumentation_grpc-0.39b0-py3-none-any.whl", hash = "sha256:1ab7a1e4a43efd8e827d1666065253fdc4dca76ca7bcf43417fe7523999e3145"}, + {file = "opentelemetry_instrumentation_grpc-0.39b0.tar.gz", hash = "sha256:766ea59ff2677301e5354d2113a635c20e462611ecd4b5fb764121759d945bb2"}, ] [package.dependencies] opentelemetry-api = ">=1.12,<2.0" -opentelemetry-instrumentation = "0.37b0" +opentelemetry-instrumentation = "0.39b0" opentelemetry-sdk = ">=1.12,<2.0" -opentelemetry-semantic-conventions = "0.37b0" +opentelemetry-semantic-conventions = "0.39b0" wrapt = ">=1.0.0,<2.0.0" [package.extras] instruments = ["grpcio (>=1.27,<2.0)"] -test = ["opentelemetry-instrumentation-grpc[instruments]", "opentelemetry-sdk (>=1.12,<2.0)", "opentelemetry-test-utils (==0.37b0)", "protobuf (>=3.13,<4.0)"] +test = ["opentelemetry-instrumentation-grpc[instruments]", "opentelemetry-sdk (>=1.12,<2.0)", "opentelemetry-test-utils (==0.39b0)", "protobuf (>=3.13,<4.0)"] [[package]] name = "opentelemetry-proto" -version = "1.16.0" +version = "1.18.0" description = "OpenTelemetry Python Proto" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_proto-1.16.0-py3-none-any.whl", hash = "sha256:160326d300faf43c3f72c4a916516ee5b63289ceb9828294b698ef943697cbd5"}, - {file = "opentelemetry_proto-1.16.0.tar.gz", hash = "sha256:e58832dfec64621972a9836f8ae163fb3063946eb02bdf43fae0f76f8cf46d0a"}, + {file = "opentelemetry_proto-1.18.0-py3-none-any.whl", hash = "sha256:34d1c49283f0246a58761d9322d5a79702a09afda0bb181bb6378ed26862e446"}, + {file = "opentelemetry_proto-1.18.0.tar.gz", hash = "sha256:4f38d01049c3926b9fd09833574bfb5e172d84c8ca85e2ab7f4b5a198d75aeef"}, ] [package.dependencies] @@ -3731,44 +3843,44 @@ protobuf = ">=3.19,<5.0" [[package]] name = "opentelemetry-sdk" -version = "1.16.0" +version = "1.18.0" description = "OpenTelemetry Python SDK" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_sdk-1.16.0-py3-none-any.whl", hash = "sha256:15f03915eec4839f885a5e6ed959cde59b8690c8c012d07c95b4b138c98dc43f"}, - {file = "opentelemetry_sdk-1.16.0.tar.gz", hash = "sha256:4d3bb91e9e209dbeea773b5565d901da4f76a29bf9dbc1c9500be3cabb239a4e"}, + {file = "opentelemetry_sdk-1.18.0-py3-none-any.whl", hash = "sha256:a097cc1e0db6ff33b4d250a9350dc17975d24a22aa667fca2866e60c51306723"}, + {file = "opentelemetry_sdk-1.18.0.tar.gz", hash = "sha256:cd3230930a2ab288b1df149d261e9cd2bd48dee54ad18465a777831cb6779e90"}, ] [package.dependencies] -opentelemetry-api = "1.16.0" -opentelemetry-semantic-conventions = "0.37b0" +opentelemetry-api = "1.18.0" +opentelemetry-semantic-conventions = "0.39b0" setuptools = ">=16.0" typing-extensions = ">=3.7.4" [[package]] name = "opentelemetry-semantic-conventions" -version = "0.37b0" +version = "0.39b0" description = "OpenTelemetry Semantic Conventions" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_semantic_conventions-0.37b0-py3-none-any.whl", hash = "sha256:462982278a42dab01f68641cd89f8460fe1f93e87c68a012a76fb426dcdba5ee"}, - {file = "opentelemetry_semantic_conventions-0.37b0.tar.gz", hash = "sha256:087ce2e248e42f3ffe4d9fa2303111de72bb93baa06a0f4655980bc1557c4228"}, + {file = "opentelemetry_semantic_conventions-0.39b0-py3-none-any.whl", hash = "sha256:0dd7a9dc0dfde2335f643705bba8f7c44182c797bc208b7601f0b8e8211cfd5c"}, + {file = "opentelemetry_semantic_conventions-0.39b0.tar.gz", hash = "sha256:06a9f198574e0dab6ebc072b59d89092cf9f115638a8a02157586769b6b7a69a"}, ] [[package]] name = "opentelemetry-util-http" -version = "0.37b0" +version = "0.39b0" description = "Web util for OpenTelemetry" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "opentelemetry_util_http-0.37b0-py3-none-any.whl", hash = "sha256:6d3ddba5429918dc3a3e250858a819dad617a4a415f16b6ca6531065501f342a"}, - {file = "opentelemetry_util_http-0.37b0.tar.gz", hash = "sha256:591a5332db31bb6056ef2741c435e38ad4979d3c595b20b4c4dd62cbf1693524"}, + {file = "opentelemetry_util_http-0.39b0-py3-none-any.whl", hash = "sha256:587c3f8931b8a1e910a04fd736e8ff1386fe25c09dc92dc85104679112221483"}, + {file = "opentelemetry_util_http-0.39b0.tar.gz", hash = "sha256:1a78e53e97c8f0b05216dbe4d93836ae5f5f94ba877003e56d065f089373f0ce"}, ] [[package]] @@ -3853,39 +3965,37 @@ files = [ [[package]] name = "pandas" -version = "1.5.3" +version = "2.0.3" description = "Powerful data structures for data analysis, time series, and statistics" category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "pandas-1.5.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3749077d86e3a2f0ed51367f30bf5b82e131cc0f14260c4d3e499186fccc4406"}, - {file = "pandas-1.5.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:972d8a45395f2a2d26733eb8d0f629b2f90bebe8e8eddbb8829b180c09639572"}, - {file = "pandas-1.5.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:50869a35cbb0f2e0cd5ec04b191e7b12ed688874bd05dd777c19b28cbea90996"}, - {file = "pandas-1.5.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c3ac844a0fe00bfaeb2c9b51ab1424e5c8744f89860b138434a363b1f620f354"}, - {file = "pandas-1.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a0a56cef15fd1586726dace5616db75ebcfec9179a3a55e78f72c5639fa2a23"}, - {file = "pandas-1.5.3-cp310-cp310-win_amd64.whl", hash = "sha256:478ff646ca42b20376e4ed3fa2e8d7341e8a63105586efe54fa2508ee087f328"}, - {file = "pandas-1.5.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6973549c01ca91ec96199e940495219c887ea815b2083722821f1d7abfa2b4dc"}, - {file = "pandas-1.5.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c39a8da13cede5adcd3be1182883aea1c925476f4e84b2807a46e2775306305d"}, - {file = "pandas-1.5.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f76d097d12c82a535fda9dfe5e8dd4127952b45fea9b0276cb30cca5ea313fbc"}, - {file = "pandas-1.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e474390e60ed609cec869b0da796ad94f420bb057d86784191eefc62b65819ae"}, - {file = "pandas-1.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5f2b952406a1588ad4cad5b3f55f520e82e902388a6d5a4a91baa8d38d23c7f6"}, - {file = "pandas-1.5.3-cp311-cp311-win_amd64.whl", hash = "sha256:bc4c368f42b551bf72fac35c5128963a171b40dce866fb066540eeaf46faa003"}, - {file = "pandas-1.5.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:14e45300521902689a81f3f41386dc86f19b8ba8dd5ac5a3c7010ef8d2932813"}, - {file = "pandas-1.5.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9842b6f4b8479e41968eced654487258ed81df7d1c9b7b870ceea24ed9459b31"}, - {file = "pandas-1.5.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:26d9c71772c7afb9d5046e6e9cf42d83dd147b5cf5bcb9d97252077118543792"}, - {file = "pandas-1.5.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5fbcb19d6fceb9e946b3e23258757c7b225ba450990d9ed63ccceeb8cae609f7"}, - {file = "pandas-1.5.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:565fa34a5434d38e9d250af3c12ff931abaf88050551d9fbcdfafca50d62babf"}, - {file = "pandas-1.5.3-cp38-cp38-win32.whl", hash = "sha256:87bd9c03da1ac870a6d2c8902a0e1fd4267ca00f13bc494c9e5a9020920e1d51"}, - {file = "pandas-1.5.3-cp38-cp38-win_amd64.whl", hash = "sha256:41179ce559943d83a9b4bbacb736b04c928b095b5f25dd2b7389eda08f46f373"}, - {file = "pandas-1.5.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c74a62747864ed568f5a82a49a23a8d7fe171d0c69038b38cedf0976831296fa"}, - {file = "pandas-1.5.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c4c00e0b0597c8e4f59e8d461f797e5d70b4d025880516a8261b2817c47759ee"}, - {file = "pandas-1.5.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a50d9a4336a9621cab7b8eb3fb11adb82de58f9b91d84c2cd526576b881a0c5a"}, - {file = "pandas-1.5.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd05f7783b3274aa206a1af06f0ceed3f9b412cf665b7247eacd83be41cf7bf0"}, - {file = "pandas-1.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f69c4029613de47816b1bb30ff5ac778686688751a5e9c99ad8c7031f6508e5"}, - {file = "pandas-1.5.3-cp39-cp39-win32.whl", hash = "sha256:7cec0bee9f294e5de5bbfc14d0573f65526071029d036b753ee6507d2a21480a"}, - {file = "pandas-1.5.3-cp39-cp39-win_amd64.whl", hash = "sha256:dfd681c5dc216037e0b0a2c821f5ed99ba9f03ebcf119c7dac0e9a7b960b9ec9"}, - {file = "pandas-1.5.3.tar.gz", hash = "sha256:74a3fd7e5a7ec052f183273dc7b0acd3a863edf7520f5d3a1765c04ffdb3b0b1"}, + {file = "pandas-2.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e4c7c9f27a4185304c7caf96dc7d91bc60bc162221152de697c98eb0b2648dd8"}, + {file = "pandas-2.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f167beed68918d62bffb6ec64f2e1d8a7d297a038f86d4aed056b9493fca407f"}, + {file = "pandas-2.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce0c6f76a0f1ba361551f3e6dceaff06bde7514a374aa43e33b588ec10420183"}, + {file = "pandas-2.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba619e410a21d8c387a1ea6e8a0e49bb42216474436245718d7f2e88a2f8d7c0"}, + {file = "pandas-2.0.3-cp310-cp310-win32.whl", hash = "sha256:3ef285093b4fe5058eefd756100a367f27029913760773c8bf1d2d8bebe5d210"}, + {file = "pandas-2.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:9ee1a69328d5c36c98d8e74db06f4ad518a1840e8ccb94a4ba86920986bb617e"}, + {file = "pandas-2.0.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b084b91d8d66ab19f5bb3256cbd5ea661848338301940e17f4492b2ce0801fe8"}, + {file = "pandas-2.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:37673e3bdf1551b95bf5d4ce372b37770f9529743d2498032439371fc7b7eb26"}, + {file = "pandas-2.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b9cb1e14fdb546396b7e1b923ffaeeac24e4cedd14266c3497216dd4448e4f2d"}, + {file = "pandas-2.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d9cd88488cceb7635aebb84809d087468eb33551097d600c6dad13602029c2df"}, + {file = "pandas-2.0.3-cp311-cp311-win32.whl", hash = "sha256:694888a81198786f0e164ee3a581df7d505024fbb1f15202fc7db88a71d84ebd"}, + {file = "pandas-2.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:6a21ab5c89dcbd57f78d0ae16630b090eec626360085a4148693def5452d8a6b"}, + {file = "pandas-2.0.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9e4da0d45e7f34c069fe4d522359df7d23badf83abc1d1cef398895822d11061"}, + {file = "pandas-2.0.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:32fca2ee1b0d93dd71d979726b12b61faa06aeb93cf77468776287f41ff8fdc5"}, + {file = "pandas-2.0.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:258d3624b3ae734490e4d63c430256e716f488c4fcb7c8e9bde2d3aa46c29089"}, + {file = "pandas-2.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eae3dc34fa1aa7772dd3fc60270d13ced7346fcbcfee017d3132ec625e23bb0"}, + {file = "pandas-2.0.3-cp38-cp38-win32.whl", hash = "sha256:f3421a7afb1a43f7e38e82e844e2bca9a6d793d66c1a7f9f0ff39a795bbc5e02"}, + {file = "pandas-2.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:69d7f3884c95da3a31ef82b7618af5710dba95bb885ffab339aad925c3e8ce78"}, + {file = "pandas-2.0.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5247fb1ba347c1261cbbf0fcfba4a3121fbb4029d95d9ef4dc45406620b25c8b"}, + {file = "pandas-2.0.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:81af086f4543c9d8bb128328b5d32e9986e0c84d3ee673a2ac6fb57fd14f755e"}, + {file = "pandas-2.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1994c789bf12a7c5098277fb43836ce090f1073858c10f9220998ac74f37c69b"}, + {file = "pandas-2.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5ec591c48e29226bcbb316e0c1e9423622bc7a4eaf1ef7c3c9fa1a3981f89641"}, + {file = "pandas-2.0.3-cp39-cp39-win32.whl", hash = "sha256:04dbdbaf2e4d46ca8da896e1805bc04eb85caa9a82e259e8eed00254d5e0c682"}, + {file = "pandas-2.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:1168574b036cd8b93abc746171c9b4f1b83467438a5e45909fed645cf8692dbc"}, + {file = "pandas-2.0.3.tar.gz", hash = "sha256:c02f372a88e0d17f36d3093a644c73cfc1788e876a7c4bcb4020a77512e2043c"}, ] [package.dependencies] @@ -3894,11 +4004,32 @@ numpy = [ {version = ">=1.21.0", markers = "python_version >= \"3.10\""}, {version = ">=1.23.2", markers = "python_version >= \"3.11\""}, ] -python-dateutil = ">=2.8.1" +python-dateutil = ">=2.8.2" pytz = ">=2020.1" +tzdata = ">=2022.1" [package.extras] -test = ["hypothesis (>=5.5.3)", "pytest (>=6.0)", "pytest-xdist (>=1.31)"] +all = ["PyQt5 (>=5.15.1)", "SQLAlchemy (>=1.4.16)", "beautifulsoup4 (>=4.9.3)", "bottleneck (>=1.3.2)", "brotlipy (>=0.7.0)", "fastparquet (>=0.6.3)", "fsspec (>=2021.07.0)", "gcsfs (>=2021.07.0)", "html5lib (>=1.1)", "hypothesis (>=6.34.2)", "jinja2 (>=3.0.0)", "lxml (>=4.6.3)", "matplotlib (>=3.6.1)", "numba (>=0.53.1)", "numexpr (>=2.7.3)", "odfpy (>=1.4.1)", "openpyxl (>=3.0.7)", "pandas-gbq (>=0.15.0)", "psycopg2 (>=2.8.6)", "pyarrow (>=7.0.0)", "pymysql (>=1.0.2)", "pyreadstat (>=1.1.2)", "pytest (>=7.3.2)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)", "python-snappy (>=0.6.0)", "pyxlsb (>=1.0.8)", "qtpy (>=2.2.0)", "s3fs (>=2021.08.0)", "scipy (>=1.7.1)", "tables (>=3.6.1)", "tabulate (>=0.8.9)", "xarray (>=0.21.0)", "xlrd (>=2.0.1)", "xlsxwriter (>=1.4.3)", "zstandard (>=0.15.2)"] +aws = ["s3fs (>=2021.08.0)"] +clipboard = ["PyQt5 (>=5.15.1)", "qtpy (>=2.2.0)"] +compression = ["brotlipy (>=0.7.0)", "python-snappy (>=0.6.0)", "zstandard (>=0.15.2)"] +computation = ["scipy (>=1.7.1)", "xarray (>=0.21.0)"] +excel = ["odfpy (>=1.4.1)", "openpyxl (>=3.0.7)", "pyxlsb (>=1.0.8)", "xlrd (>=2.0.1)", "xlsxwriter (>=1.4.3)"] +feather = ["pyarrow (>=7.0.0)"] +fss = ["fsspec (>=2021.07.0)"] +gcp = ["gcsfs (>=2021.07.0)", "pandas-gbq (>=0.15.0)"] +hdf5 = ["tables (>=3.6.1)"] +html = ["beautifulsoup4 (>=4.9.3)", "html5lib (>=1.1)", "lxml (>=4.6.3)"] +mysql = ["SQLAlchemy (>=1.4.16)", "pymysql (>=1.0.2)"] +output-formatting = ["jinja2 (>=3.0.0)", "tabulate (>=0.8.9)"] +parquet = ["pyarrow (>=7.0.0)"] +performance = ["bottleneck (>=1.3.2)", "numba (>=0.53.1)", "numexpr (>=2.7.1)"] +plot = ["matplotlib (>=3.6.1)"] +postgresql = ["SQLAlchemy (>=1.4.16)", "psycopg2 (>=2.8.6)"] +spss = ["pyreadstat (>=1.1.2)"] +sql-other = ["SQLAlchemy (>=1.4.16)"] +test = ["hypothesis (>=6.34.2)", "pytest (>=7.3.2)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)"] +xml = ["lxml (>=4.6.3)"] [[package]] name = "pandas-stubs" @@ -3944,6 +4075,42 @@ files = [ {file = "pathspec-0.11.1.tar.gz", hash = "sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687"}, ] +[[package]] +name = "pdf2image" +version = "1.16.3" +description = "A wrapper around the pdftoppm and pdftocairo command line tools to convert PDF to a PIL Image list." +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "pdf2image-1.16.3-py3-none-any.whl", hash = "sha256:b6154164af3677211c22cbb38b2bd778b43aca02758e962fe1e231f6d3b0e380"}, + {file = "pdf2image-1.16.3.tar.gz", hash = "sha256:74208810c2cef4d9e347769b8e62a52303982ddb4f2dfd744c7ab4b940ae287e"}, +] + +[package.dependencies] +pillow = "*" + +[[package]] +name = "pdfminer-six" +version = "20221105" +description = "PDF parser and analyzer" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pdfminer.six-20221105-py3-none-any.whl", hash = "sha256:1eaddd712d5b2732f8ac8486824533514f8ba12a0787b3d5fe1e686cd826532d"}, + {file = "pdfminer.six-20221105.tar.gz", hash = "sha256:8448ab7b939d18b64820478ecac5394f482d7a79f5f7eaa7703c6c959c175e1d"}, +] + +[package.dependencies] +charset-normalizer = ">=2.0.0" +cryptography = ">=36.0.0" + +[package.extras] +dev = ["black", "mypy (==0.931)", "nox", "pytest"] +docs = ["sphinx", "sphinx-argparse"] +image = ["Pillow"] + [[package]] name = "pexpect" version = "4.8.0" @@ -5489,6 +5656,67 @@ files = [ {file = "ruff-0.0.254.tar.gz", hash = "sha256:0eb66c9520151d3bd950ea43b3a088618a8e4e10a5014a72687881e6f3606312"}, ] +[[package]] +name = "safetensors" +version = "0.3.1" +description = "Fast and Safe Tensor serialization" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "safetensors-0.3.1-cp310-cp310-macosx_10_11_x86_64.whl", hash = "sha256:2ae9b7dd268b4bae6624729dac86deb82104820e9786429b0583e5168db2f770"}, + {file = "safetensors-0.3.1-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:08c85c1934682f1e2cd904d38433b53cd2a98245a7cc31f5689f9322a2320bbf"}, + {file = "safetensors-0.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ba625c7af9e1c5d0d91cb83d2fba97d29ea69d4db2015d9714d24c7f6d488e15"}, + {file = "safetensors-0.3.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b57d5890c619ec10d9f1b6426b8690d0c9c2868a90dc52f13fae6f6407ac141f"}, + {file = "safetensors-0.3.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5c9f562ea696d50b95cadbeb1716dc476714a87792ffe374280c0835312cbfe2"}, + {file = "safetensors-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5c115951b3a865ece8d98ee43882f2fd0a999c0200d6e6fec24134715ebe3b57"}, + {file = "safetensors-0.3.1-cp310-cp310-win32.whl", hash = "sha256:118f8f7503ea312fc7af27e934088a1b589fb1eff5a7dea2cd1de6c71ee33391"}, + {file = "safetensors-0.3.1-cp310-cp310-win_amd64.whl", hash = "sha256:54846eaae25fded28a7bebbb66be563cad221b4c80daee39e2f55df5e5e0266f"}, + {file = "safetensors-0.3.1-cp311-cp311-macosx_10_11_universal2.whl", hash = "sha256:5af82e10946c4822506db0f29269f43147e889054704dde994d4e22f0c37377b"}, + {file = "safetensors-0.3.1-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:626c86dd1d930963c8ea7f953a3787ae85322551e3a5203ac731d6e6f3e18f44"}, + {file = "safetensors-0.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:12e30677e6af1f4cc4f2832546e91dbb3b0aa7d575bfa473d2899d524e1ace08"}, + {file = "safetensors-0.3.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d534b80bc8d39945bb902f34b0454773971fe9e5e1f2142af451759d7e52b356"}, + {file = "safetensors-0.3.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ddd0ddd502cf219666e7d30f23f196cb87e829439b52b39f3e7da7918c3416df"}, + {file = "safetensors-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:997a2cc14023713f423e6d16536d55cb16a3d72850f142e05f82f0d4c76d383b"}, + {file = "safetensors-0.3.1-cp311-cp311-win32.whl", hash = "sha256:6ae9ca63d9e22f71ec40550207bd284a60a6b4916ae6ca12c85a8d86bf49e0c3"}, + {file = "safetensors-0.3.1-cp311-cp311-win_amd64.whl", hash = "sha256:62aa7421ca455418423e35029524489480adda53e3f702453580180ecfebe476"}, + {file = "safetensors-0.3.1-cp37-cp37m-macosx_10_11_x86_64.whl", hash = "sha256:6d54b3ed367b6898baab75dfd057c24f36ec64d3938ffff2af981d56bfba2f42"}, + {file = "safetensors-0.3.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:262423aeda91117010f8c607889066028f680fbb667f50cfe6eae96f22f9d150"}, + {file = "safetensors-0.3.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:10efe2513a8327fd628cea13167089588acc23093ba132aecfc536eb9a4560fe"}, + {file = "safetensors-0.3.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:689b3d6a7ebce70ee9438267ee55ea89b575c19923876645e927d08757b552fe"}, + {file = "safetensors-0.3.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14cd9a87bc73ce06903e9f8ee8b05b056af6f3c9f37a6bd74997a16ed36ff5f4"}, + {file = "safetensors-0.3.1-cp37-cp37m-win32.whl", hash = "sha256:a77cb39624480d5f143c1cc272184f65a296f573d61629eff5d495d2e0541d3e"}, + {file = "safetensors-0.3.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9eff3190bfbbb52eef729911345c643f875ca4dbb374aa6c559675cfd0ab73db"}, + {file = "safetensors-0.3.1-cp38-cp38-macosx_10_11_x86_64.whl", hash = "sha256:05cbfef76e4daa14796db1bbb52072d4b72a44050c368b2b1f6fd3e610669a89"}, + {file = "safetensors-0.3.1-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:c49061461f4a81e5ec3415070a3f135530834c89cbd6a7db7cd49e3cb9d9864b"}, + {file = "safetensors-0.3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22cf7e73ca42974f098ce0cf4dd8918983700b6b07a4c6827d50c8daefca776e"}, + {file = "safetensors-0.3.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:04f909442d6223ff0016cd2e1b2a95ef8039b92a558014627363a2e267213f62"}, + {file = "safetensors-0.3.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2c573c5a0d5d45791ae8c179e26d74aff86e719056591aa7edb3ca7be55bc961"}, + {file = "safetensors-0.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6994043b12e717cf2a6ba69077ac41f0d3675b2819734f07f61819e854c622c7"}, + {file = "safetensors-0.3.1-cp38-cp38-win32.whl", hash = "sha256:158ede81694180a0dbba59422bc304a78c054b305df993c0c6e39c6330fa9348"}, + {file = "safetensors-0.3.1-cp38-cp38-win_amd64.whl", hash = "sha256:afdc725beff7121ea8d39a7339f5a6abcb01daa189ea56290b67fe262d56e20f"}, + {file = "safetensors-0.3.1-cp39-cp39-macosx_10_11_x86_64.whl", hash = "sha256:cba910fcc9e5e64d32d62b837388721165e9c7e45d23bc3a38ad57694b77f40d"}, + {file = "safetensors-0.3.1-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:a4f7dbfe7285573cdaddd85ef6fa84ebbed995d3703ab72d71257944e384612f"}, + {file = "safetensors-0.3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54aed0802f9eaa83ca7b1cbb986bfb90b8e2c67b6a4bcfe245627e17dad565d4"}, + {file = "safetensors-0.3.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:34b75a766f3cfc99fd4c33e329b76deae63f5f388e455d863a5d6e99472fca8e"}, + {file = "safetensors-0.3.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1a0f31904f35dc14919a145b2d7a2d8842a43a18a629affe678233c4ea90b4af"}, + {file = "safetensors-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcf527ecc5f58907fd9031510378105487f318cc91ecdc5aee3c7cc8f46030a8"}, + {file = "safetensors-0.3.1-cp39-cp39-win32.whl", hash = "sha256:e2f083112cf97aa9611e2a05cc170a2795eccec5f6ff837f4565f950670a9d83"}, + {file = "safetensors-0.3.1-cp39-cp39-win_amd64.whl", hash = "sha256:5f4f614b8e8161cd8a9ca19c765d176a82b122fa3d3387b77862145bfe9b4e93"}, + {file = "safetensors-0.3.1.tar.gz", hash = "sha256:571da56ff8d0bec8ae54923b621cda98d36dcef10feb36fd492c4d0c2cd0e869"}, +] + +[package.extras] +all = ["black (==22.3)", "click (==8.0.4)", "flake8 (>=3.8.3)", "flax (>=0.6.3)", "h5py (>=3.7.0)", "huggingface-hub (>=0.12.1)", "isort (>=5.5.4)", "jax (>=0.3.25)", "jaxlib (>=0.3.25)", "numpy (>=1.21.6)", "paddlepaddle (>=2.4.1)", "pytest (>=7.2.0)", "pytest-benchmark (>=4.0.0)", "setuptools-rust (>=1.5.2)", "tensorflow (>=2.11.0)", "torch (>=1.10)"] +dev = ["black (==22.3)", "click (==8.0.4)", "flake8 (>=3.8.3)", "flax (>=0.6.3)", "h5py (>=3.7.0)", "huggingface-hub (>=0.12.1)", "isort (>=5.5.4)", "jax (>=0.3.25)", "jaxlib (>=0.3.25)", "numpy (>=1.21.6)", "paddlepaddle (>=2.4.1)", "pytest (>=7.2.0)", "pytest-benchmark (>=4.0.0)", "setuptools-rust (>=1.5.2)", "tensorflow (>=2.11.0)", "torch (>=1.10)"] +jax = ["flax (>=0.6.3)", "jax (>=0.3.25)", "jaxlib (>=0.3.25)"] +numpy = ["numpy (>=1.21.6)"] +paddlepaddle = ["paddlepaddle (>=2.4.1)"] +quality = ["black (==22.3)", "click (==8.0.4)", "flake8 (>=3.8.3)", "isort (>=5.5.4)"] +tensorflow = ["tensorflow (>=2.11.0)"] +testing = ["h5py (>=3.7.0)", "huggingface-hub (>=0.12.1)", "numpy (>=1.21.6)", "pytest (>=7.2.0)", "pytest-benchmark (>=4.0.0)", "setuptools-rust (>=1.5.2)"] +torch = ["torch (>=1.10)"] + [[package]] name = "scikit-learn" version = "1.2.2" @@ -5534,31 +5762,31 @@ tests = ["black (>=22.3.0)", "flake8 (>=3.8.2)", "matplotlib (>=3.1.3)", "mypy ( [[package]] name = "scipy" -version = "1.11.0" +version = "1.11.1" description = "Fundamental algorithms for scientific computing in Python" category = "main" optional = false python-versions = "<3.13,>=3.9" files = [ - {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"}, + {file = "scipy-1.11.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:aec8c62fbe52914f9cf28d846cf0401dd80ab80788bbab909434eb336ed07c04"}, + {file = "scipy-1.11.1-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:3b9963798df1d8a52db41a6fc0e6fa65b1c60e85d73da27ae8bb754de4792481"}, + {file = "scipy-1.11.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e8eb42db36526b130dfbc417609498a6192381abc1975b91e3eb238e0b41c1a"}, + {file = "scipy-1.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:366a6a937110d80dca4f63b3f5b00cc89d36f678b2d124a01067b154e692bab1"}, + {file = "scipy-1.11.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:08d957ca82d3535b3b9ba6c8ff355d78fe975271874e2af267cb5add5bd78625"}, + {file = "scipy-1.11.1-cp310-cp310-win_amd64.whl", hash = "sha256:e866514bc2d660608447b6ba95c8900d591f2865c07cca0aa4f7ff3c4ca70f30"}, + {file = "scipy-1.11.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ba94eeef3c9caa4cea7b402a35bb02a5714ee1ee77eb98aca1eed4543beb0f4c"}, + {file = "scipy-1.11.1-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:512fdc18c65f76dadaca139348e525646d440220d8d05f6d21965b8d4466bccd"}, + {file = "scipy-1.11.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cce154372f0ebe88556ed06d7b196e9c2e0c13080ecb58d0f35062dc7cc28b47"}, + {file = "scipy-1.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b4bb943010203465ac81efa392e4645265077b4d9e99b66cf3ed33ae12254173"}, + {file = "scipy-1.11.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:249cfa465c379c9bb2c20123001e151ff5e29b351cbb7f9c91587260602c58d0"}, + {file = "scipy-1.11.1-cp311-cp311-win_amd64.whl", hash = "sha256:ffb28e3fa31b9c376d0fb1f74c1f13911c8c154a760312fbee87a21eb21efe31"}, + {file = "scipy-1.11.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:39154437654260a52871dfde852adf1b93b1d1bc5dc0ffa70068f16ec0be2624"}, + {file = "scipy-1.11.1-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:b588311875c58d1acd4ef17c983b9f1ab5391755a47c3d70b6bd503a45bfaf71"}, + {file = "scipy-1.11.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d51565560565a0307ed06fa0ec4c6f21ff094947d4844d6068ed04400c72d0c3"}, + {file = "scipy-1.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b41a0f322b4eb51b078cb3441e950ad661ede490c3aca66edef66f4b37ab1877"}, + {file = "scipy-1.11.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:396fae3f8c12ad14c5f3eb40499fd06a6fef8393a6baa352a652ecd51e74e029"}, + {file = "scipy-1.11.1-cp39-cp39-win_amd64.whl", hash = "sha256:be8c962a821957fdde8c4044efdab7a140c13294997a407eaee777acf63cbf0c"}, + {file = "scipy-1.11.1.tar.gz", hash = "sha256:fb5b492fa035334fd249f0973cc79ecad8b09c604b42a127a677b45a9a3d4289"}, ] [package.dependencies] @@ -5943,14 +6171,14 @@ typing-extensions = ">=4.2.0,<5.0.0" [[package]] name = "strenum" -version = "0.4.10" +version = "0.4.12" description = "An Enum that inherits from str." category = "main" optional = false python-versions = "*" files = [ - {file = "StrEnum-0.4.10-py3-none-any.whl", hash = "sha256:aebf04bba8e5af435937c452d69a86798b6f8d5ca5f20ba18561dbfad571ccdd"}, - {file = "StrEnum-0.4.10.tar.gz", hash = "sha256:898cc0ebb5054ee07400341ac1d75fdfee489d76d6df3fbc1c2eaf95971e3916"}, + {file = "StrEnum-0.4.12-py3-none-any.whl", hash = "sha256:d75cdebe07e2537989a925089a248673a34e8a6e9d8fe6846fd04b1aa2e1f44f"}, + {file = "StrEnum-0.4.12.tar.gz", hash = "sha256:75e234fea070aabae9b03b63385880e286defdcdf6fb2933cde4f964f7763544"}, ] [package.extras] @@ -6009,6 +6237,21 @@ files = [ [package.dependencies] mpmath = ">=0.19" +[[package]] +name = "tabulate" +version = "0.9.0" +description = "Pretty-print tabular data" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tabulate-0.9.0-py3-none-any.whl", hash = "sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f"}, + {file = "tabulate-0.9.0.tar.gz", hash = "sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c"}, +] + +[package.extras] +widechars = ["wcwidth"] + [[package]] name = "tenacity" version = "8.2.2" @@ -6026,21 +6269,21 @@ doc = ["reno", "sphinx", "tornado (>=4.5)"] [[package]] name = "textual" -version = "0.10.1" +version = "0.28.1" description = "Modern Text User Interface framework" category = "main" optional = true python-versions = ">=3.7,<4.0" files = [ - {file = "textual-0.10.1-py3-none-any.whl", hash = "sha256:dd9a5b38a74cf42364a0f247e8f57e3ded7d69d44a63ee664af333f986c48e81"}, - {file = "textual-0.10.1.tar.gz", hash = "sha256:928cfeec37c60b212963f484e806b25380afdddb5a2aecd888ce8c9b46f93553"}, + {file = "textual-0.28.1-py3-none-any.whl", hash = "sha256:cb6f6230fea390178f8e727d2f9e542337a655549ea44331e22336da799a900f"}, + {file = "textual-0.28.1.tar.gz", hash = "sha256:f63a873d810b5d01f7318d8eb8f706d530550f3a90a6892628d17d47ecefcd41"}, ] [package.dependencies] -importlib-metadata = ">=4.11.3,<5.0.0" -nanoid = ">=2.0.0" -rich = ">12.6.0" -typing-extensions = {version = ">=4.0.0,<5.0.0", markers = "python_version < \"3.10\""} +importlib-metadata = ">=4.11.3" +markdown-it-py = {version = ">=2.1.0,<3.0.0", extras = ["linkify", "plugins"]} +rich = ">=13.3.3" +typing-extensions = ">=4.4.0,<5.0.0" [package.extras] dev = ["aiohttp (>=3.8.1)", "click (>=8.1.2)", "msgpack (>=1.0.3)"] @@ -6333,45 +6576,47 @@ test = ["argcomplete (>=2.0)", "pre-commit", "pytest", "pytest-mock"] [[package]] name = "transformers" -version = "4.29.0" +version = "4.30.2" description = "State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow" category = "main" optional = false python-versions = ">=3.7.0" files = [ - {file = "transformers-4.29.0-py3-none-any.whl", hash = "sha256:51f89cbdd515dffac38c002277511d004e1a12a284ab852a4d5641430a409d1f"}, - {file = "transformers-4.29.0.tar.gz", hash = "sha256:b5dff9ce3708dc6639d892435fa69c51dee5c89870f888fa59ef0fc3baa3d8c7"}, + {file = "transformers-4.30.2-py3-none-any.whl", hash = "sha256:c332e3a3097f9ed89ce556b403251235931c00237b8bc2d7adaa19d226c13f1d"}, + {file = "transformers-4.30.2.tar.gz", hash = "sha256:f4a8aac4e1baffab4033f4a345b0d7dc7957d12a4f1ba969afea08205a513045"}, ] [package.dependencies] filelock = "*" -huggingface-hub = ">=0.11.0,<1.0" +huggingface-hub = ">=0.14.1,<1.0" numpy = ">=1.17" packaging = ">=20.0" pyyaml = ">=5.1" regex = "!=2019.12.17" requests = "*" +safetensors = ">=0.3.1" tokenizers = ">=0.11.1,<0.11.3 || >0.11.3,<0.14" tqdm = ">=4.27" [package.extras] -accelerate = ["accelerate (>=0.19.0)"] -all = ["Pillow", "accelerate (>=0.19.0)", "av (==9.2.0)", "codecarbon (==1.2.0)", "decord (==0.6.0)", "flax (>=0.4.1,<=0.6.9)", "jax (>=0.2.8,!=0.3.2,<=0.3.6)", "jaxlib (>=0.1.65,<=0.3.6)", "kenlm", "keras-nlp (>=0.3.1)", "librosa", "numba (<0.57.0)", "onnxconverter-common", "optax (>=0.0.8,<=0.1.4)", "optuna", "phonemizer", "protobuf (<=3.20.2)", "pyctcdecode (>=0.4.0)", "ray[tune]", "sentencepiece (>=0.1.91,!=0.1.92)", "sigopt", "tensorflow (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx", "timm", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "torchaudio", "torchvision"] -audio = ["kenlm", "librosa", "numba (<0.57.0)", "phonemizer", "pyctcdecode (>=0.4.0)"] +accelerate = ["accelerate (>=0.20.2)"] +agents = ["Pillow", "accelerate (>=0.20.2)", "datasets (!=2.5.0)", "diffusers", "opencv-python", "sentencepiece (>=0.1.91,!=0.1.92)", "torch (>=1.9,!=1.12.0)"] +all = ["Pillow", "accelerate (>=0.20.2)", "av (==9.2.0)", "codecarbon (==1.2.0)", "decord (==0.6.0)", "flax (>=0.4.1,<=0.6.9)", "jax (>=0.2.8,!=0.3.2,<=0.3.6)", "jaxlib (>=0.1.65,<=0.3.6)", "kenlm", "keras-nlp (>=0.3.1)", "librosa", "onnxconverter-common", "optax (>=0.0.8,<=0.1.4)", "optuna", "phonemizer", "protobuf (<=3.20.3)", "pyctcdecode (>=0.4.0)", "ray[tune]", "sentencepiece (>=0.1.91,!=0.1.92)", "sigopt", "tensorflow (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx", "timm", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "torchaudio", "torchvision"] +audio = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)"] codecarbon = ["codecarbon (==1.2.0)"] -deepspeed = ["accelerate (>=0.19.0)", "deepspeed (>=0.8.3)"] -deepspeed-testing = ["GitPython (<3.1.19)", "accelerate (>=0.19.0)", "beautifulsoup4", "black (>=23.1,<24.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "deepspeed (>=0.8.3)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "hf-doc-builder (>=0.3.0)", "nltk", "optuna", "parameterized", "protobuf (<=3.20.2)", "psutil", "pytest", "pytest-timeout", "pytest-xdist", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "safetensors (>=0.2.1)", "sentencepiece (>=0.1.91,!=0.1.92)", "timeout-decorator"] -dev = ["GitPython (<3.1.19)", "Pillow", "accelerate (>=0.19.0)", "av (==9.2.0)", "beautifulsoup4", "black (>=23.1,<24.0)", "codecarbon (==1.2.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "decord (==0.6.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "flax (>=0.4.1,<=0.6.9)", "fugashi (>=1.0)", "hf-doc-builder", "hf-doc-builder (>=0.3.0)", "ipadic (>=1.0.0,<2.0)", "isort (>=5.5.4)", "jax (>=0.2.8,!=0.3.2,<=0.3.6)", "jaxlib (>=0.1.65,<=0.3.6)", "kenlm", "keras-nlp (>=0.3.1)", "librosa", "nltk", "numba (<0.57.0)", "onnxconverter-common", "optax (>=0.0.8,<=0.1.4)", "optuna", "parameterized", "phonemizer", "protobuf (<=3.20.2)", "psutil", "pyctcdecode (>=0.4.0)", "pytest", "pytest-timeout", "pytest-xdist", "ray[tune]", "rhoknp (>=1.1.0)", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (>=0.0.241,<=0.0.259)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "safetensors (>=0.2.1)", "scikit-learn", "sentencepiece (>=0.1.91,!=0.1.92)", "sigopt", "sudachidict-core (>=20220729)", "sudachipy (>=0.6.6)", "tensorflow (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx", "timeout-decorator", "timm", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "torchaudio", "torchvision", "unidic (>=1.0.2)", "unidic-lite (>=1.0.7)", "urllib3 (<2.0.0)"] -dev-tensorflow = ["GitPython (<3.1.19)", "Pillow", "beautifulsoup4", "black (>=23.1,<24.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "hf-doc-builder", "hf-doc-builder (>=0.3.0)", "isort (>=5.5.4)", "kenlm", "keras-nlp (>=0.3.1)", "librosa", "nltk", "numba (<0.57.0)", "onnxconverter-common", "onnxruntime (>=1.4.0)", "onnxruntime-tools (>=1.4.2)", "parameterized", "phonemizer", "protobuf (<=3.20.2)", "psutil", "pyctcdecode (>=0.4.0)", "pytest", "pytest-timeout", "pytest-xdist", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (>=0.0.241,<=0.0.259)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "safetensors (>=0.2.1)", "scikit-learn", "sentencepiece (>=0.1.91,!=0.1.92)", "tensorflow (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx", "timeout-decorator", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "urllib3 (<2.0.0)"] -dev-torch = ["GitPython (<3.1.19)", "Pillow", "accelerate (>=0.19.0)", "beautifulsoup4", "black (>=23.1,<24.0)", "codecarbon (==1.2.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "fugashi (>=1.0)", "hf-doc-builder", "hf-doc-builder (>=0.3.0)", "ipadic (>=1.0.0,<2.0)", "isort (>=5.5.4)", "kenlm", "librosa", "nltk", "numba (<0.57.0)", "onnxruntime (>=1.4.0)", "onnxruntime-tools (>=1.4.2)", "optuna", "parameterized", "phonemizer", "protobuf (<=3.20.2)", "psutil", "pyctcdecode (>=0.4.0)", "pytest", "pytest-timeout", "pytest-xdist", "ray[tune]", "rhoknp (>=1.1.0)", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (>=0.0.241,<=0.0.259)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "safetensors (>=0.2.1)", "scikit-learn", "sentencepiece (>=0.1.91,!=0.1.92)", "sigopt", "sudachidict-core (>=20220729)", "sudachipy (>=0.6.6)", "timeout-decorator", "timm", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "torchaudio", "torchvision", "unidic (>=1.0.2)", "unidic-lite (>=1.0.7)", "urllib3 (<2.0.0)"] -docs = ["Pillow", "accelerate (>=0.19.0)", "av (==9.2.0)", "codecarbon (==1.2.0)", "decord (==0.6.0)", "flax (>=0.4.1,<=0.6.9)", "hf-doc-builder", "jax (>=0.2.8,!=0.3.2,<=0.3.6)", "jaxlib (>=0.1.65,<=0.3.6)", "kenlm", "keras-nlp (>=0.3.1)", "librosa", "numba (<0.57.0)", "onnxconverter-common", "optax (>=0.0.8,<=0.1.4)", "optuna", "phonemizer", "protobuf (<=3.20.2)", "pyctcdecode (>=0.4.0)", "ray[tune]", "sentencepiece (>=0.1.91,!=0.1.92)", "sigopt", "tensorflow (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx", "timm", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "torchaudio", "torchvision"] +deepspeed = ["accelerate (>=0.20.2)", "deepspeed (>=0.8.3)"] +deepspeed-testing = ["GitPython (<3.1.19)", "accelerate (>=0.20.2)", "beautifulsoup4", "black (>=23.1,<24.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "deepspeed (>=0.8.3)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "hf-doc-builder (>=0.3.0)", "nltk", "optuna", "parameterized", "protobuf (<=3.20.3)", "psutil", "pytest (>=7.2.0)", "pytest-timeout", "pytest-xdist", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "sentencepiece (>=0.1.91,!=0.1.92)", "timeout-decorator"] +dev = ["GitPython (<3.1.19)", "Pillow", "accelerate (>=0.20.2)", "av (==9.2.0)", "beautifulsoup4", "black (>=23.1,<24.0)", "codecarbon (==1.2.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "decord (==0.6.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "flax (>=0.4.1,<=0.6.9)", "fugashi (>=1.0)", "hf-doc-builder", "hf-doc-builder (>=0.3.0)", "ipadic (>=1.0.0,<2.0)", "isort (>=5.5.4)", "jax (>=0.2.8,!=0.3.2,<=0.3.6)", "jaxlib (>=0.1.65,<=0.3.6)", "kenlm", "keras-nlp (>=0.3.1)", "librosa", "nltk", "onnxconverter-common", "optax (>=0.0.8,<=0.1.4)", "optuna", "parameterized", "phonemizer", "protobuf (<=3.20.3)", "psutil", "pyctcdecode (>=0.4.0)", "pytest (>=7.2.0)", "pytest-timeout", "pytest-xdist", "ray[tune]", "rhoknp (>=1.1.0,<1.3.1)", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (>=0.0.241,<=0.0.259)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "scikit-learn", "sentencepiece (>=0.1.91,!=0.1.92)", "sigopt", "sudachidict-core (>=20220729)", "sudachipy (>=0.6.6)", "tensorflow (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx", "timeout-decorator", "timm", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "torchaudio", "torchvision", "unidic (>=1.0.2)", "unidic-lite (>=1.0.7)", "urllib3 (<2.0.0)"] +dev-tensorflow = ["GitPython (<3.1.19)", "Pillow", "beautifulsoup4", "black (>=23.1,<24.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "hf-doc-builder", "hf-doc-builder (>=0.3.0)", "isort (>=5.5.4)", "kenlm", "keras-nlp (>=0.3.1)", "librosa", "nltk", "onnxconverter-common", "onnxruntime (>=1.4.0)", "onnxruntime-tools (>=1.4.2)", "parameterized", "phonemizer", "protobuf (<=3.20.3)", "psutil", "pyctcdecode (>=0.4.0)", "pytest (>=7.2.0)", "pytest-timeout", "pytest-xdist", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (>=0.0.241,<=0.0.259)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "scikit-learn", "sentencepiece (>=0.1.91,!=0.1.92)", "tensorflow (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx", "timeout-decorator", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "urllib3 (<2.0.0)"] +dev-torch = ["GitPython (<3.1.19)", "Pillow", "accelerate (>=0.20.2)", "beautifulsoup4", "black (>=23.1,<24.0)", "codecarbon (==1.2.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "fugashi (>=1.0)", "hf-doc-builder", "hf-doc-builder (>=0.3.0)", "ipadic (>=1.0.0,<2.0)", "isort (>=5.5.4)", "kenlm", "librosa", "nltk", "onnxruntime (>=1.4.0)", "onnxruntime-tools (>=1.4.2)", "optuna", "parameterized", "phonemizer", "protobuf (<=3.20.3)", "psutil", "pyctcdecode (>=0.4.0)", "pytest (>=7.2.0)", "pytest-timeout", "pytest-xdist", "ray[tune]", "rhoknp (>=1.1.0,<1.3.1)", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (>=0.0.241,<=0.0.259)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "scikit-learn", "sentencepiece (>=0.1.91,!=0.1.92)", "sigopt", "sudachidict-core (>=20220729)", "sudachipy (>=0.6.6)", "timeout-decorator", "timm", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "torchaudio", "torchvision", "unidic (>=1.0.2)", "unidic-lite (>=1.0.7)", "urllib3 (<2.0.0)"] +docs = ["Pillow", "accelerate (>=0.20.2)", "av (==9.2.0)", "codecarbon (==1.2.0)", "decord (==0.6.0)", "flax (>=0.4.1,<=0.6.9)", "hf-doc-builder", "jax (>=0.2.8,!=0.3.2,<=0.3.6)", "jaxlib (>=0.1.65,<=0.3.6)", "kenlm", "keras-nlp (>=0.3.1)", "librosa", "onnxconverter-common", "optax (>=0.0.8,<=0.1.4)", "optuna", "phonemizer", "protobuf (<=3.20.3)", "pyctcdecode (>=0.4.0)", "ray[tune]", "sentencepiece (>=0.1.91,!=0.1.92)", "sigopt", "tensorflow (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx", "timm", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "torchaudio", "torchvision"] docs-specific = ["hf-doc-builder"] fairscale = ["fairscale (>0.3)"] flax = ["flax (>=0.4.1,<=0.6.9)", "jax (>=0.2.8,!=0.3.2,<=0.3.6)", "jaxlib (>=0.1.65,<=0.3.6)", "optax (>=0.0.8,<=0.1.4)"] -flax-speech = ["kenlm", "librosa", "numba (<0.57.0)", "phonemizer", "pyctcdecode (>=0.4.0)"] +flax-speech = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)"] ftfy = ["ftfy"] integrations = ["optuna", "ray[tune]", "sigopt"] -ja = ["fugashi (>=1.0)", "ipadic (>=1.0.0,<2.0)", "rhoknp (>=1.1.0)", "sudachidict-core (>=20220729)", "sudachipy (>=0.6.6)", "unidic (>=1.0.2)", "unidic-lite (>=1.0.7)"] +ja = ["fugashi (>=1.0)", "ipadic (>=1.0.0,<2.0)", "rhoknp (>=1.1.0,<1.3.1)", "sudachidict-core (>=20220729)", "sudachipy (>=0.6.6)", "unidic (>=1.0.2)", "unidic-lite (>=1.0.7)"] modelcreation = ["cookiecutter (==1.7.3)"] natten = ["natten (>=0.14.6)"] onnx = ["onnxconverter-common", "onnxruntime (>=1.4.0)", "onnxruntime-tools (>=1.4.2)", "tf2onnx"] @@ -6381,21 +6626,21 @@ quality = ["GitPython (<3.1.19)", "black (>=23.1,<24.0)", "datasets (!=2.5.0)", ray = ["ray[tune]"] retrieval = ["datasets (!=2.5.0)", "faiss-cpu"] sagemaker = ["sagemaker (>=2.31.0)"] -sentencepiece = ["protobuf (<=3.20.2)", "sentencepiece (>=0.1.91,!=0.1.92)"] +sentencepiece = ["protobuf (<=3.20.3)", "sentencepiece (>=0.1.91,!=0.1.92)"] serving = ["fastapi", "pydantic", "starlette", "uvicorn"] sigopt = ["sigopt"] sklearn = ["scikit-learn"] -speech = ["kenlm", "librosa", "numba (<0.57.0)", "phonemizer", "pyctcdecode (>=0.4.0)", "torchaudio"] -testing = ["GitPython (<3.1.19)", "beautifulsoup4", "black (>=23.1,<24.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "hf-doc-builder (>=0.3.0)", "nltk", "parameterized", "protobuf (<=3.20.2)", "psutil", "pytest", "pytest-timeout", "pytest-xdist", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "safetensors (>=0.2.1)", "timeout-decorator"] +speech = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)", "torchaudio"] +testing = ["GitPython (<3.1.19)", "beautifulsoup4", "black (>=23.1,<24.0)", "cookiecutter (==1.7.3)", "datasets (!=2.5.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "hf-doc-builder (>=0.3.0)", "nltk", "parameterized", "protobuf (<=3.20.3)", "psutil", "pytest (>=7.2.0)", "pytest-timeout", "pytest-xdist", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "timeout-decorator"] tf = ["keras-nlp (>=0.3.1)", "onnxconverter-common", "tensorflow (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx"] tf-cpu = ["keras-nlp (>=0.3.1)", "onnxconverter-common", "tensorflow-cpu (>=2.4,<2.13)", "tensorflow-text (<2.13)", "tf2onnx"] -tf-speech = ["kenlm", "librosa", "numba (<0.57.0)", "phonemizer", "pyctcdecode (>=0.4.0)"] +tf-speech = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)"] timm = ["timm"] tokenizers = ["tokenizers (>=0.11.1,!=0.11.3,<0.14)"] -torch = ["accelerate (>=0.19.0)", "torch (>=1.9,!=1.12.0)"] -torch-speech = ["kenlm", "librosa", "numba (<0.57.0)", "phonemizer", "pyctcdecode (>=0.4.0)", "torchaudio"] +torch = ["accelerate (>=0.20.2)", "torch (>=1.9,!=1.12.0)"] +torch-speech = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)", "torchaudio"] torch-vision = ["Pillow", "torchvision"] -torchhub = ["filelock", "huggingface-hub (>=0.11.0,<1.0)", "importlib-metadata", "numpy (>=1.17)", "packaging (>=20.0)", "protobuf (<=3.20.2)", "regex (!=2019.12.17)", "requests", "sentencepiece (>=0.1.91,!=0.1.92)", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "tqdm (>=4.27)"] +torchhub = ["filelock", "huggingface-hub (>=0.14.1,<1.0)", "importlib-metadata", "numpy (>=1.17)", "packaging (>=20.0)", "protobuf (<=3.20.3)", "regex (!=2019.12.17)", "requests", "sentencepiece (>=0.1.91,!=0.1.92)", "tokenizers (>=0.11.1,!=0.11.3,<0.14)", "torch (>=1.9,!=1.12.0)", "tqdm (>=4.27)"] video = ["av (==9.2.0)", "decord (==0.6.0)"] vision = ["Pillow"] @@ -6471,14 +6716,14 @@ files = [ [[package]] name = "types-pillow" -version = "9.5.0.4" +version = "9.5.0.5" description = "Typing stubs for Pillow" category = "dev" optional = false python-versions = "*" files = [ - {file = "types-Pillow-9.5.0.4.tar.gz", hash = "sha256:f1b6af47abd151847ee25911ffeba784899bc7dc7f9eba8ca6a5aac522b012ef"}, - {file = "types_Pillow-9.5.0.4-py3-none-any.whl", hash = "sha256:69427d9fa4320ff6e30f00fb9c0dd71185dc0a16de4757774220104759483466"}, + {file = "types-Pillow-9.5.0.5.tar.gz", hash = "sha256:de9877aa1e6226b6479459ca84df02fd7e999b970c79cfee3b8298840336e77c"}, + {file = "types_Pillow-9.5.0.5-py3-none-any.whl", hash = "sha256:2b17f95c5c16e4962e4032bdb95494766a85569fa278ee21e5fcbbd318e9ccd2"}, ] [[package]] @@ -6497,7 +6742,7 @@ files = [ name = "types-pyyaml" version = "6.0.12.10" description = "Typing stubs for PyYAML" -category = "main" +category = "dev" optional = false python-versions = "*" files = [ @@ -6572,41 +6817,63 @@ files = [ {file = "tzdata-2023.3.tar.gz", hash = "sha256:11ef1e08e54acb0d4f95bdb1be05da659673de4acbd21bf9c69e94cc5e907a3a"}, ] +[[package]] +name = "uc-micro-py" +version = "1.0.2" +description = "Micro subset of unicode data files for linkify-it-py projects." +category = "main" +optional = true +python-versions = ">=3.7" +files = [ + {file = "uc-micro-py-1.0.2.tar.gz", hash = "sha256:30ae2ac9c49f39ac6dce743bd187fcd2b574b16ca095fa74cd9396795c954c54"}, + {file = "uc_micro_py-1.0.2-py3-none-any.whl", hash = "sha256:8c9110c309db9d9e87302e2f4ad2c3152770930d88ab385cd544e7a7e75f3de0"}, +] + +[package.extras] +test = ["coverage", "pytest", "pytest-cov"] + [[package]] name = "unstructured" -version = "0.5.13" +version = "0.7.10" description = "A library that prepares raw documents for downstream ML tasks." category = "main" optional = false python-versions = ">=3.7.0" files = [ - {file = "unstructured-0.5.13-py3-none-any.whl", hash = "sha256:44ddc2848f1009fd64ced91a9b52d0e9dd15dee837f34a898ecd95863236b880"}, - {file = "unstructured-0.5.13.tar.gz", hash = "sha256:b25443a47353297bda5eec64615215111e07c2507771cf8ad5471d04ac9026b1"}, + {file = "unstructured-0.7.10-py3-none-any.whl", hash = "sha256:d36ae0b59bcf95751b4304a6f44864ec3187f584cf80ee66a68e99537e0e4a0d"}, + {file = "unstructured-0.7.10.tar.gz", hash = "sha256:93d65dd746151703c6873d69156d2a4bc9f9f1507044cdd617b1645373528d74"}, ] [package.dependencies] argilla = "*" -certifi = ">=2022.12.07" +chardet = "*" +filetype = "*" lxml = "*" markdown = "*" msg-parser = "*" nltk = "*" openpyxl = "*" pandas = "*" +pdf2image = "*" +"pdfminer.six" = "*" pillow = "*" pypandoc = "*" python-docx = "*" python-magic = "*" python-pptx = "*" requests = "*" +tabulate = "*" +xlrd = "*" [package.extras] azure = ["adlfs", "fsspec"] -github = ["pygithub (==1.57.0)"] +discord = ["discord-py"] +gcs = ["fsspec", "gcsfs"] +github = ["pygithub (==1.58.2)"] gitlab = ["python-gitlab"] -google-drive = ["google-api-python-client", "protobuf (<3.21)"] +google-drive = ["google-api-python-client"] huggingface = ["langdetect", "sacremoses", "sentencepiece", "torch", "transformers"] -local-inference = ["unstructured-inference (==0.3.2)"] +local-inference = ["unstructured-inference (==0.5.1)"] reddit = ["praw"] s3 = ["fsspec", "s3fs"] slack = ["slack-sdk"] @@ -7035,6 +7302,23 @@ files = [ {file = "wrapt-1.15.0.tar.gz", hash = "sha256:d06730c6aed78cee4126234cf2d071e01b44b915e725a6cb439a879ec9754a3a"}, ] +[[package]] +name = "xlrd" +version = "2.0.1" +description = "Library for developers to extract data from Microsoft Excel (tm) .xls spreadsheet files" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +files = [ + {file = "xlrd-2.0.1-py2.py3-none-any.whl", hash = "sha256:6a33ee89877bd9abc1158129f6e94be74e2679636b8a205b43b85206c3f0bbdd"}, + {file = "xlrd-2.0.1.tar.gz", hash = "sha256:f72f148f54442c6b056bf931dbc34f986fd0c3b0b6b5a58d013c9aef274d0c88"}, +] + +[package.extras] +build = ["twine", "wheel"] +docs = ["sphinx"] +test = ["pytest", "pytest-cov"] + [[package]] name = "xlsxwriter" version = "3.1.2" @@ -7216,4 +7500,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "88f4b394eb96c8307d7734e8216304b074a9aedcc52b2299ea750fa2a76ceb4b" +content-hash = "3875f61e1228dfac1574076a6c3755703463fa6ed1fe737d064a171be94259d4" diff --git a/pyproject.toml b/pyproject.toml index 4b4a281c2..764948765 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,22 +25,21 @@ langflow = "langflow.__main__:main" python = ">=3.9,<3.12" fastapi = "^0.98.0" uvicorn = "^0.22.0" -beautifulsoup4 = "^4.11.2" +beautifulsoup4 = "^4.12.2" google-search-results = "^2.4.1" google-api-python-client = "^2.79.0" typer = "^0.9.0" gunicorn = "^20.1.0" -langchain = "^0.0.218" +langchain = "^0.0.219" openai = "^0.27.8" -types-pyyaml = "^6.0.12.8" -pandas = "^1.5.3" +pandas = "^2.0.0" chromadb = "^0.3.21" -huggingface-hub = "^0.13.3" +huggingface-hub = "^0.15.0" rich = "^13.4.2" llama-cpp-python = "~0.1.0" networkx = "^3.1" -unstructured = "^0.5.11" -pypdf = "^3.7.1" +unstructured = "^0.7.0" +pypdf = "^3.11.0" lxml = "^4.9.2" pysrt = "^1.1.2" fake-useragent = "^1.1.3" @@ -49,18 +48,18 @@ psycopg2-binary = "^2.9.6" pyarrow = "^12.0.0" tiktoken = "~0.4.0" wikipedia = "^1.4.0" -langchain-serve = { version = ">0.0.39", optional = true } -qdrant-client = "^1.2.0" +langchain-serve = { version = ">0.0.47", optional = true } +qdrant-client = "^1.3.0" websockets = "^10.3" weaviate-client = "^3.21.0" jina = "3.15.2" sentence-transformers = "^2.2.2" -ctransformers = "^0.2.2" -cohere = "^4.6.0" +ctransformers = "^0.2.10" +cohere = "^4.11.0" python-multipart = "^0.0.6" sqlmodel = "^0.0.8" faiss-cpu = "^1.7.4" -anthropic = "^0.2.10" +anthropic = "^0.3.0" orjson = "^3.9.1" multiprocess = "^0.70.14" cachetools = "^5.3.1" @@ -86,6 +85,7 @@ pytest-cov = "^4.0.0" pandas-stubs = "^2.0.0.230412" types-pillow = "^9.5.0.2" types-appdirs = "^1.4.3.5" +types-pyyaml = "^6.0.12.8" [tool.poetry.extras] From d272a682be9c75e35c4b31910eb3149611897bd0 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 08:26:23 -0300 Subject: [PATCH 27/72] =?UTF-8?q?=F0=9F=94=A7=20chore(chains.py):=20update?= =?UTF-8?q?=20field=20properties=20for=20"RetrievalQA"=20memory=20field=20?= =?UTF-8?q?The=20"RetrievalQA"=20memory=20field=20in=20the=20template=20fr?= =?UTF-8?q?ontend=20node=20is=20updated=20to=20have=20the=20"show"=20and?= =?UTF-8?q?=20"required"=20properties=20set=20to=20False.=20This=20change?= =?UTF-8?q?=20is=20made=20to=20hide=20the=20memory=20field=20and=20make=20?= =?UTF-8?q?it=20optional.=20Additionally,=20the=20"advanced"=20property=20?= =?UTF-8?q?is=20set=20to=20False=20for=20all=20fields,=20and=20the=20"pass?= =?UTF-8?q?word"=20property=20is=20set=20to=20False=20for=20fields=20conta?= =?UTF-8?q?ining=20the=20word=20"key"=20in=20their=20name.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/chains.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/langflow/template/frontend_node/chains.py b/src/backend/langflow/template/frontend_node/chains.py index f29aa2065..ce8c1c62c 100644 --- a/src/backend/langflow/template/frontend_node/chains.py +++ b/src/backend/langflow/template/frontend_node/chains.py @@ -49,6 +49,10 @@ class ChainFrontendNode(FrontendNode): def format_field(field: TemplateField, name: Optional[str] = None) -> None: FrontendNode.format_field(field, name) + if "name" == "RetrievalQA" and field.name == "memory": + field.show = False + field.required = False + field.advanced = False if "key" in field.name: field.password = False From 75f0a80ded45d0cbb32cc19b35e7a8f6e744481c Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 08:52:21 -0300 Subject: [PATCH 28/72] =?UTF-8?q?=F0=9F=8E=89=20feat(formatter):=20add=20b?= =?UTF-8?q?ase=20FieldFormatter=20class=20for=20formatting=20template=20fi?= =?UTF-8?q?elds=20The=20base.py=20file=20is=20a=20new=20addition=20to=20th?= =?UTF-8?q?e=20project.=20It=20introduces=20the=20FieldFormatter=20class,?= =?UTF-8?q?=20which=20is=20an=20abstract=20base=20class=20(ABC)=20for=20fo?= =?UTF-8?q?rmatting=20template=20fields.=20This=20class=20provides=20a=20f?= =?UTF-8?q?ormat()=20method=20that=20takes=20a=20TemplateField=20object=20?= =?UTF-8?q?as=20input=20and=20is=20meant=20to=20be=20implemented=20by=20su?= =?UTF-8?q?bclasses.=20This=20addition=20allows=20for=20the=20creation=20o?= =?UTF-8?q?f=20custom=20field=20formatters=20in=20the=20project.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/frontend_node/formatter/__init__.py | 0 .../langflow/template/frontend_node/formatter/base.py | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 src/backend/langflow/template/frontend_node/formatter/__init__.py create mode 100644 src/backend/langflow/template/frontend_node/formatter/base.py diff --git a/src/backend/langflow/template/frontend_node/formatter/__init__.py b/src/backend/langflow/template/frontend_node/formatter/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/backend/langflow/template/frontend_node/formatter/base.py b/src/backend/langflow/template/frontend_node/formatter/base.py new file mode 100644 index 000000000..653480e03 --- /dev/null +++ b/src/backend/langflow/template/frontend_node/formatter/base.py @@ -0,0 +1,9 @@ +from abc import ABC, abstractmethod + +from langflow.template.field.base import TemplateField + + +class FieldFormatter(ABC): + @abstractmethod + def format(self, field: TemplateField): + pass From 5924aa444249dbd10ec6e2d13a006a9dbfa2cde5 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 08:52:26 -0300 Subject: [PATCH 29/72] =?UTF-8?q?=F0=9F=93=A6=20chore(field=5Fformatters.p?= =?UTF-8?q?y):=20add=20field=20formatters=20for=20template=20frontend=5Fno?= =?UTF-8?q?de=20=F0=9F=94=A7=20refactor(field=5Fformatters.py):=20refactor?= =?UTF-8?q?=20field=20formatters=20for=20template=20frontend=5Fnode=20The?= =?UTF-8?q?=20commit=20adds=20a=20new=20file=20`field=5Fformatters.py`=20t?= =?UTF-8?q?o=20the=20`frontend=5Fnode/formatter`=20directory=20in=20the=20?= =?UTF-8?q?`langflow/template`=20backend.=20This=20file=20contains=20multi?= =?UTF-8?q?ple=20field=20formatters=20for=20the=20template=20frontend=5Fno?= =?UTF-8?q?de.=20The=20formatters=20handle=20various=20formatting=20tasks?= =?UTF-8?q?=20such=20as=20formatting=20field=20names,=20setting=20field=20?= =?UTF-8?q?options,=20handling=20special=20fields,=20and=20formatting=20fi?= =?UTF-8?q?eld=20types.=20The=20commit=20aims=20to=20improve=20the=20code?= =?UTF-8?q?=20organization=20and=20maintainability=20by=20separating=20the?= =?UTF-8?q?=20field=20formatting=20logic=20into=20dedicated=20formatters.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formatter/field_formatters.py | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 src/backend/langflow/template/frontend_node/formatter/field_formatters.py diff --git a/src/backend/langflow/template/frontend_node/formatter/field_formatters.py b/src/backend/langflow/template/frontend_node/formatter/field_formatters.py new file mode 100644 index 000000000..7987b134a --- /dev/null +++ b/src/backend/langflow/template/frontend_node/formatter/field_formatters.py @@ -0,0 +1,162 @@ +from typing import Optional +from langflow.template.field.base import TemplateField +from langflow.template.frontend_node.constants import FORCE_SHOW_FIELDS +from langflow.template.frontend_node.formatter.base import FieldFormatter +import re + +from langflow.utils.constants import ( + ANTHROPIC_MODELS, + CHAT_OPENAI_MODELS, + OPENAI_MODELS, +) + + +class OpenAIAPIKeyFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + if "api_key" in field.name and "OpenAI" in str(name): + field.display_name = "OpenAI API Key" + field.required = False + if field.value is None: + field.value = "" + + +class ModelSpecificFieldFormatter(FieldFormatter): + MODEL_DICT = { + "OpenAI": OPENAI_MODELS, + "ChatOpenAI": CHAT_OPENAI_MODELS, + "Anthropic": ANTHROPIC_MODELS, + "ChatAnthropic": ANTHROPIC_MODELS, + } + + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + if name in self.MODEL_DICT and field.name == "model_name": + field.options = self.MODEL_DICT[name] + field.is_list = True + + +class KwargsFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + if "kwargs" in field.name.lower(): + field.advanced = True + field.required = False + field.show = False + + +class APIKeyFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + if "api" in field.name.lower() and "key" in field.name.lower(): + field.required = False + field.advanced = False + + field.display_name = field.name.replace("_", " ").title() + field.display_name = field.display_name.replace("Api", "API") + + +class RemoveOptionalFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + _type = field.field_type + field.field_type = re.sub(r"Optional\[(.*)\]", r"\1", _type) + + +class ListTypeFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + _type = field.field_type + is_list = "List" in _type or "Sequence" in _type + if is_list: + _type = re.sub(r"(List|Sequence)\[(.*)\]", r"\2", _type) + field.is_list = True + field.field_type = _type + + +class DictTypeFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + _type = field.field_type + _type = _type.replace("Mapping", "dict") + field.field_type = _type + + +class UnionTypeFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + _type = field.field_type + if "Union" in _type: + _type = _type.replace("Union[", "")[:-1] + _type = _type.split(",")[0] + _type = _type.replace("]", "").replace("[", "") + field.field_type = _type + + +class SpecialFieldFormatter(FieldFormatter): + SPECIAL_FIELD_HANDLERS = { + "allowed_tools": lambda field: "Tool", + "max_value_length": lambda field: "int", + } + + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + handler = self.SPECIAL_FIELD_HANDLERS.get(field.name) + field.field_type = handler(field) if handler else field.field_type + + +class ShowFieldFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + key = field.name + required = field.required + field.show = ( + (required and key not in ["input_variables"]) + or key in FORCE_SHOW_FIELDS + or "api" in key + or ("key" in key and "input" not in key and "output" not in key) + ) + + +class PasswordFieldFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + key = field.name + show = field.show + if ( + any(text in key.lower() for text in {"password", "token", "api", "key"}) + and show + ): + field.password = True + + +class MultilineFieldFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + key = field.name + if key in { + "suffix", + "prefix", + "template", + "examples", + "code", + "headers", + "description", + }: + field.multiline = True + + +class DefaultValueFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + value = field.to_dict() + if "default" in value: + field.value = value["default"] + + +class HeadersDefaultValueFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + key = field.name + if key == "headers": + field.value = """{'Authorization': 'Bearer '}""" + + +class DictCodeFileFormatter(FieldFormatter): + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + key = field.name + value = field.to_dict() + _type = value["type"] + if "dict" in _type.lower(): + if key == "dict_": + field.field_type = "file" + field.suffixes = [".json", ".yaml", ".yml"] + field.file_types = ["json", "yaml", "yml"] + else: + field.field_type = "code" From 3845a60bcfda2684fac62cab88b2e2e6f7fd442e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 08:52:45 -0300 Subject: [PATCH 30/72] =?UTF-8?q?=F0=9F=9A=80=20feat(memories.py):=20add?= =?UTF-8?q?=20default=20value=20for=20connection=5Fstring=20field=20in=20P?= =?UTF-8?q?ostgresChatMessageHistoryFrontendNode=20The=20trailing=20whites?= =?UTF-8?q?pace=20has=20been=20removed=20for=20consistency=20and=20readabi?= =?UTF-8?q?lity.=20The=20unused=20import=20of=20`DEFAULT=5FCONNECTION=5FST?= =?UTF-8?q?RING`=20from=20`langchain.memory.chat=5Fmessage=5Fhistories.pos?= =?UTF-8?q?tgres`=20has=20been=20removed.=20The=20`PostgresChatMessageHist?= =?UTF-8?q?oryFrontendNode`=20now=20has=20a=20default=20value=20for=20the?= =?UTF-8?q?=20`connection=5Fstring`=20field,=20which=20is=20set=20to=20`DE?= =?UTF-8?q?FAULT=5FCONNECTION=5FSTRING`.=20This=20ensures=20that=20the=20f?= =?UTF-8?q?ield=20has=20a=20default=20value=20when=20creating=20instances?= =?UTF-8?q?=20of=20the=20class.=20=F0=9F=94=A7=20chore(memories.py):=20rem?= =?UTF-8?q?ove=20trailing=20whitespace=20and=20unused=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/memories.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/backend/langflow/template/frontend_node/memories.py b/src/backend/langflow/template/frontend_node/memories.py index 7064eaa05..936bdb8f4 100644 --- a/src/backend/langflow/template/frontend_node/memories.py +++ b/src/backend/langflow/template/frontend_node/memories.py @@ -3,6 +3,7 @@ from typing import Optional from langflow.template.field.base import TemplateField from langflow.template.frontend_node.base import FrontendNode from langflow.template.template.base import Template +from langchain.memory.chat_message_histories.postgres import DEFAULT_CONNECTION_STRING class MemoryFrontendNode(FrontendNode): @@ -10,7 +11,7 @@ class MemoryFrontendNode(FrontendNode): def add_extra_fields(self) -> None: # chat history should have another way to add common field? # prevent adding incorect field in ChatMessageHistory - if "BaseChatMessageHistory" in self.base_classes: + if "BaseChatMessageHistory" in self.base_classes: return # add return_messages field @@ -95,6 +96,7 @@ class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode): required=True, show=True, name="connection_string", + value=DEFAULT_CONNECTION_STRING, ), TemplateField( field_type="str", @@ -109,7 +111,4 @@ class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode): ], ) description: str = "Memory store with Postgres" - base_classes: list[str] = [ - "PostgresChatMessageHistory", - "BaseChatMessageHistory" - ] \ No newline at end of file + base_classes: list[str] = ["PostgresChatMessageHistory", "BaseChatMessageHistory"] From 8ed5287ac4c78d538938577856d0798411520711 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 09:01:28 -0300 Subject: [PATCH 31/72] =?UTF-8?q?=F0=9F=94=A7=20chore(base.py):=20refactor?= =?UTF-8?q?=20field=20formatting=20logic=20into=20a=20separate=20class=20?= =?UTF-8?q?=F0=9F=92=A1=20refactor(base.py):=20The=20field=20formatting=20?= =?UTF-8?q?logic=20in=20the=20FrontendNode=20class=20has=20been=20refactor?= =?UTF-8?q?ed=20into=20a=20separate=20class=20called=20FieldFormatters.=20?= =?UTF-8?q?This=20improves=20code=20organization=20and=20separation=20of?= =?UTF-8?q?=20concerns,=20making=20it=20easier=20to=20maintain=20and=20ext?= =?UTF-8?q?end=20the=20field=20formatting=20functionality=20in=20the=20fut?= =?UTF-8?q?ure.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../langflow/template/frontend_node/base.py | 65 +++++++++++-------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/src/backend/langflow/template/frontend_node/base.py b/src/backend/langflow/template/frontend_node/base.py index 751ecb709..0c0c1e06a 100644 --- a/src/backend/langflow/template/frontend_node/base.py +++ b/src/backend/langflow/template/frontend_node/base.py @@ -1,12 +1,41 @@ import re from typing import List, Optional -from pydantic import BaseModel +from pydantic import BaseModel, Field from langflow.template.frontend_node.constants import FORCE_SHOW_FIELDS from langflow.template.field.base import TemplateField from langflow.template.template.base import Template from langflow.utils import constants +from langflow.template.frontend_node.formatter import field_formatters + + +class FieldFormatters(BaseModel): + formatters = { + "openai_api_key": field_formatters.OpenAIAPIKeyFormatter(), + } + base_formatters = { + "kwargs": field_formatters.KwargsFormatter(), + "optional": field_formatters.RemoveOptionalFormatter(), + "list": field_formatters.ListTypeFormatter(), + "dict": field_formatters.DictTypeFormatter(), + "union": field_formatters.UnionTypeFormatter(), + "multiline": field_formatters.MultilineFieldFormatter(), + "show": field_formatters.ShowFieldFormatter(), + "password": field_formatters.PasswordFieldFormatter(), + "default": field_formatters.DefaultValueFormatter(), + "headers": field_formatters.HeadersDefaultValueFormatter(), + "dict_code_file": field_formatters.DictCodeFileFormatter(), + "model_fields": field_formatters.ModelSpecificFieldFormatter(), + } + + def format(self, field: TemplateField, name: Optional[str] = None) -> None: + for key, formatter in self.base_formatters.items(): + formatter.format(field, name) + + for key, formatter in self.formatters.items(): + if key == field.name: + formatter.format(field, name) class FrontendNode(BaseModel): @@ -16,6 +45,13 @@ class FrontendNode(BaseModel): name: str = "" display_name: str = "" documentation: str = "" + field_formatters: FieldFormatters = Field(default_factory=FieldFormatters) + + # field formatters is an instance attribute but it is not used in the class + # so we need to create a method to get it + @staticmethod + def get_field_formatters() -> FieldFormatters: + return FieldFormatters() def set_documentation(self, documentation: str) -> None: """Sets the documentation of the frontend node.""" @@ -42,33 +78,8 @@ class FrontendNode(BaseModel): @staticmethod def format_field(field: TemplateField, name: Optional[str] = None) -> None: """Formats a given field based on its attributes and value.""" - SPECIAL_FIELD_HANDLERS = { - "allowed_tools": lambda field: "Tool", - "max_value_length": lambda field: "int", - } - key = field.name - value = field.to_dict() - _type = value["type"] - - _type = FrontendNode.remove_optional(_type) - _type, is_list = FrontendNode.check_for_list_type(_type) - field.is_list = is_list or field.is_list - _type = FrontendNode.replace_mapping_with_dict(_type) - _type = FrontendNode.handle_union_type(_type) - - field.field_type = FrontendNode.handle_special_field( - field, key, _type, SPECIAL_FIELD_HANDLERS - ) - field.field_type = FrontendNode.handle_dict_type(field, _type) - field.show = FrontendNode.should_show_field(key, field.required) - field.password = FrontendNode.should_be_password(key, field.show) - field.multiline = FrontendNode.should_be_multiline(key) - - FrontendNode.replace_default_value(field, value) - FrontendNode.handle_specific_field_values(field, key, name) - FrontendNode.handle_kwargs_field(field) - FrontendNode.handle_api_key_field(field, key) + FrontendNode.get_field_formatters().format(field, name) @staticmethod def remove_optional(_type: str) -> str: From 197f1f9e71b2a105547edad1ad59284c8acc4c5d Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 09:34:01 -0300 Subject: [PATCH 32/72] =?UTF-8?q?=F0=9F=94=A5=20refactor(utils.ts):=20remo?= =?UTF-8?q?ve=20unused=20imports=20and=20icons=20to=20improve=20code=20cle?= =?UTF-8?q?anliness=20and=20reduce=20bundle=20size=20=F0=9F=8E=A8=20style(?= =?UTF-8?q?utils.ts):=20reorganize=20nodeColors=20and=20nodeNames=20object?= =?UTF-8?q?s=20to=20improve=20readability=20and=20maintainability=20The=20?= =?UTF-8?q?changes=20in=20this=20commit=20remove=20unused=20imports=20and?= =?UTF-8?q?=20icons=20from=20the=20`utils.ts`=20file,=20which=20helps=20im?= =?UTF-8?q?prove=20code=20cleanliness=20and=20reduces=20the=20bundle=20siz?= =?UTF-8?q?e.=20Additionally,=20the=20`nodeColors`=20and=20`nodeNames`=20o?= =?UTF-8?q?bjects=20have=20been=20reorganized=20to=20improve=20readability?= =?UTF-8?q?=20and=20maintainability.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/utils.ts | 86 +++------------------------------------ 1 file changed, 6 insertions(+), 80 deletions(-) diff --git a/src/frontend/src/utils.ts b/src/frontend/src/utils.ts index af75b2cdf..d89fe8a00 100644 --- a/src/frontend/src/utils.ts +++ b/src/frontend/src/utils.ts @@ -1,21 +1,3 @@ -import { - RocketLaunchIcon, - LinkIcon, - CpuChipIcon, - LightBulbIcon, - CommandLineIcon, - WrenchScrewdriverIcon, - WrenchIcon, - ComputerDesktopIcon, - GiftIcon, - PaperClipIcon, - QuestionMarkCircleIcon, - FingerPrintIcon, - ScissorsIcon, - CircleStackIcon, - Squares2X2Icon, - Bars3CenterLeftIcon, -} from "@heroicons/react/24/outline"; import { Connection, Edge, Node, ReactFlowInstance } from "reactflow"; import { FlowType, NodeType } from "./types/flow"; import { APITemplateType } from "./types/api"; @@ -58,6 +40,7 @@ import { Paperclip, Rocket, Scissors, + Search, TerminalSquare, Wand2, Wrench, @@ -139,6 +122,7 @@ export const nodeColors: { [char: string]: string } = { toolkits: "#DB2C2C", wrappers: "#E6277A", utilities: "#31A3CC", + retrievers: "#F5B85A", unknown: "#9CA3AF", }; @@ -157,72 +141,11 @@ export const nodeNames: { [char: string]: string } = { toolkits: "Toolkits", wrappers: "Wrappers", textsplitters: "Text Splitters", + retrievers: "Retrievers", utilities: "Utilities", unknown: "Unknown", }; -export const nodeIcons: { - [char: string]: React.ForwardRefExoticComponent< - React.SVGProps - >; -} = { - Chroma: ChromaIcon, - AirbyteJSONLoader: AirbyteIcon, - // SerpAPIWrapper: SerperIcon, - // AZLyricsLoader: AzIcon, - Anthropic: AnthropicIcon, - ChatAnthropic: AnthropicIcon, - BingSearchAPIWrapper: BingIcon, - BingSearchRun: BingIcon, - Cohere: CohereIcon, - CohereEmbeddings: CohereIcon, - EverNoteLoader: EvernoteIcon, - FacebookChatLoader: FBIcon, - GitbookLoader: GitBookIcon, - GoogleSearchAPIWrapper: GoogleIcon, - GoogleSearchResults: GoogleIcon, - GoogleSearchRun: GoogleIcon, - HNLoader: HackerNewsIcon, - HuggingFaceHub: HugginFaceIcon, - HuggingFaceEmbeddings: HugginFaceIcon, - IFixitLoader: IFixIcon, - Meta: MetaIcon, - Midjourney: MidjourneyIcon, - NotionDirectoryLoader: NotionIcon, - ChatOpenAI: OpenAiIcon, - OpenAI: OpenAiIcon, - OpenAIEmbeddings: OpenAiIcon, - Pinecone: PineconeIcon, - SupabaseVectorStore: SupabaseIcon, - MongoDBAtlasVectorSearch: MongoDBIcon, - // UnstructuredPowerPointLoader: PowerPointIcon, // word and powerpoint have differente styles - Qdrant: QDrantIcon, - // ReadTheDocsLoader: ReadTheDocsIcon, // does not work - Searx: SearxIcon, - SlackDirectoryLoader: SlackIcon, - // Weaviate: WeaviateIcon, // does not work - // WikipediaAPIWrapper: WikipediaIcon, - // WolframAlphaQueryRun: WolframIcon, - // WolframAlphaAPIWrapper: WolframIcon, - // UnstructuredWordDocumentLoader: WordIcon, // word and powerpoint have differente styles - agents: RocketLaunchIcon, - chains: LinkIcon, - memories: CpuChipIcon, - llms: LightBulbIcon, - prompts: CommandLineIcon, - tools: WrenchIcon, - advanced: ComputerDesktopIcon, - chat: Bars3CenterLeftIcon, - embeddings: FingerPrintIcon, - documentloaders: PaperClipIcon, - vectorstores: CircleStackIcon, - toolkits: WrenchScrewdriverIcon, - textsplitters: ScissorsIcon, - wrappers: GiftIcon, - utilities: Squares2X2Icon, - unknown: QuestionMarkCircleIcon, -}; - export const nodeIconsLucide: { [char: string]: React.ForwardRefExoticComponent< ComponentType> @@ -363,6 +286,9 @@ export const nodeIconsLucide: { utilities: Wand2 as React.ForwardRefExoticComponent< ComponentType> >, + retrievers: Search as React.ForwardRefExoticComponent< + ComponentType> + >, unknown: HelpCircle as React.ForwardRefExoticComponent< ComponentType> >, From c9f8a27983ebd1113f417b204ed0ef54d8654219 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 09:34:19 -0300 Subject: [PATCH 33/72] =?UTF-8?q?=F0=9F=94=80=20chore(NodeModal):=20update?= =?UTF-8?q?=20import=20and=20variable=20name=20for=20nodeIconsLucide=20to?= =?UTF-8?q?=20improve=20code=20readability=20=F0=9F=92=84=20style(NodeModa?= =?UTF-8?q?l):=20remove=20unused=20import=20and=20variable=20to=20clean=20?= =?UTF-8?q?up=20code=20The=20import=20and=20variable=20name=20for=20`nodeI?= =?UTF-8?q?consLucide`=20has=20been=20updated=20to=20improve=20code=20read?= =?UTF-8?q?ability.=20The=20unused=20import=20and=20variable=20`nodeIcons`?= =?UTF-8?q?=20and=20`toNormalCase`=20have=20been=20removed=20to=20clean=20?= =?UTF-8?q?up=20the=20code.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/modals/NodeModal/index.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/modals/NodeModal/index.tsx b/src/frontend/src/modals/NodeModal/index.tsx index 2065b1720..add842096 100644 --- a/src/frontend/src/modals/NodeModal/index.tsx +++ b/src/frontend/src/modals/NodeModal/index.tsx @@ -6,8 +6,7 @@ import { classNames, limitScrollFieldsModal, nodeColors, - nodeIcons, - toNormalCase, + nodeIconsLucide, toTitleCase, } from "../../utils"; import { typesContext } from "../../contexts/typesContext"; @@ -28,7 +27,7 @@ export default function NodeModal({ data }: { data: NodeDataType }) { } } // any to avoid type conflict - const Icon: any = nodeIcons[types[data.type]]; + const Icon: any = nodeIconsLucide[types[data.type]]; return ( Date: Thu, 29 Jun 2023 09:54:38 -0300 Subject: [PATCH 34/72] =?UTF-8?q?=F0=9F=93=9D=20docs(config.yaml):=20add?= =?UTF-8?q?=20documentation=20link=20for=20MultiQueryRetriever=20?= =?UTF-8?q?=F0=9F=94=A7=20chore(settings.py):=20add=20retrievers=20attribu?= =?UTF-8?q?te=20to=20Settings=20class=20The=20config.yaml=20file=20now=20i?= =?UTF-8?q?ncludes=20a=20documentation=20link=20for=20the=20MultiQueryRetr?= =?UTF-8?q?iever=20in=20the=20retrievers=20section.=20This=20link=20provid?= =?UTF-8?q?es=20additional=20information=20on=20how=20to=20use=20the=20Mul?= =?UTF-8?q?tiQueryRetriever.=20In=20the=20settings.py=20file,=20the=20Sett?= =?UTF-8?q?ings=20class=20now=20includes=20a=20retrievers=20attribute=20to?= =?UTF-8?q?=20store=20retriever-related=20settings.=20This=20allows=20for?= =?UTF-8?q?=20easier=20management=20and=20configuration=20of=20retrievers?= =?UTF-8?q?=20in=20the=20application.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/config.yaml | 3 +++ src/backend/langflow/settings.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index 14d81308a..4bb93680f 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -230,6 +230,9 @@ utilities: documentation: "" WolframAlphaAPIWrapper: documentation: "" +retrievers: + MultiQueryRetriever: + documentation: "https://python.langchain.com/docs/modules/data_connection/retrievers/how_to/MultiQueryRetriever" vectorstores: Chroma: documentation: "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/chroma" diff --git a/src/backend/langflow/settings.py b/src/backend/langflow/settings.py index f153ba706..d2de4f671 100644 --- a/src/backend/langflow/settings.py +++ b/src/backend/langflow/settings.py @@ -15,6 +15,7 @@ class Settings(BaseSettings): vectorstores: dict = {} documentloaders: dict = {} wrappers: dict = {} + retrievers: dict = {} toolkits: dict = {} textsplitters: dict = {} utilities: dict = {} @@ -47,6 +48,11 @@ class Settings(BaseSettings): self.toolkits = new_settings.toolkits or {} self.textsplitters = new_settings.textsplitters or {} self.utilities = new_settings.utilities or {} + self.embeddings = new_settings.embeddings or {} + self.vectorstores = new_settings.vectorstores or {} + self.documentloaders = new_settings.documentloaders or {} + self.retrievers = new_settings.retrievers or {} + self.dev = dev def update_settings(self, **kwargs): From f427e171662cfaa799e52ab056b82f4da8d6d800 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 09:55:59 -0300 Subject: [PATCH 35/72] =?UTF-8?q?=F0=9F=94=80=20refactor(endpoints.py):=20?= =?UTF-8?q?rename=20import=20of=20build=5Flangchain=5Ftypes=5Fdict=20to=20?= =?UTF-8?q?langchain=5Ftypes=5Fdict=20for=20consistency=20=F0=9F=94=80=20r?= =?UTF-8?q?efactor(types.py):=20add=20langchain=5Ftypes=5Fdict=20as=20a=20?= =?UTF-8?q?separate=20variable=20to=20improve=20code=20readability=20and?= =?UTF-8?q?=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The import statement in `endpoints.py` has been updated to import `langchain_types_dict` instead of `build_langchain_types_dict` for consistency with the variable name. This change improves code readability and maintainability. In `types.py`, a new variable `langchain_types_dict` has been added as a separate variable to store the result of `build_langchain_types_dict()`. This change improves code readability and makes it easier to understand the purpose of the variable. --- src/backend/langflow/api/v1/endpoints.py | 4 ++-- src/backend/langflow/interface/types.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/api/v1/endpoints.py b/src/backend/langflow/api/v1/endpoints.py index f18e3056d..13cba6c2c 100644 --- a/src/backend/langflow/api/v1/endpoints.py +++ b/src/backend/langflow/api/v1/endpoints.py @@ -11,7 +11,7 @@ from langflow.api.v1.schemas import ( UploadFileResponse, ) -from langflow.interface.types import build_langchain_types_dict +from langflow.interface.types import langchain_types_dict from langflow.database.base import get_session from sqlmodel import Session @@ -21,7 +21,7 @@ router = APIRouter(tags=["Base"]) @router.get("/all") def get_all(): - return build_langchain_types_dict() + return langchain_types_dict # For backwards compatibility we will keep the old endpoint diff --git a/src/backend/langflow/interface/types.py b/src/backend/langflow/interface/types.py index 085537756..6b1ecb3e2 100644 --- a/src/backend/langflow/interface/types.py +++ b/src/backend/langflow/interface/types.py @@ -11,6 +11,7 @@ from langflow.interface.tools.base import tool_creator from langflow.interface.utilities.base import utility_creator from langflow.interface.vector_store.base import vectorstore_creator from langflow.interface.wrappers.base import wrapper_creator +from langflow.interface.retrievers.base import retriever_creator def get_type_list(): @@ -44,6 +45,7 @@ def build_langchain_types_dict(): # sourcery skip: dict-assign-update-to-union documentloader_creator, textsplitter_creator, utility_creator, + retriever_creator, ] all_types = {} @@ -52,3 +54,6 @@ def build_langchain_types_dict(): # sourcery skip: dict-assign-update-to-union if created_types[creator.type_name].values(): all_types.update(created_types) return all_types + + +langchain_types_dict = build_langchain_types_dict() From 28e770992b89ca3f226878c30ffcaa1b7ef6bbce Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 09:56:17 -0300 Subject: [PATCH 36/72] =?UTF-8?q?=F0=9F=9A=80=20feat(listing.py):=20add=20?= =?UTF-8?q?support=20for=20retrievers=20in=20the=20type=20dictionary=20The?= =?UTF-8?q?=20type=20dictionary=20in=20the=20listing.py=20file=20now=20inc?= =?UTF-8?q?ludes=20a=20"retrievers"=20key,=20which=20contains=20a=20list?= =?UTF-8?q?=20of=20retriever=20creators.=20This=20allows=20for=20the=20inc?= =?UTF-8?q?lusion=20of=20retrievers=20as=20a=20supported=20type=20in=20the?= =?UTF-8?q?=20application.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/listing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/langflow/interface/listing.py b/src/backend/langflow/interface/listing.py index 3d73105c2..1e1421d32 100644 --- a/src/backend/langflow/interface/listing.py +++ b/src/backend/langflow/interface/listing.py @@ -11,6 +11,7 @@ from langflow.interface.tools.base import tool_creator from langflow.interface.utilities.base import utility_creator from langflow.interface.vector_store.base import vectorstore_creator from langflow.interface.wrappers.base import wrapper_creator +from langflow.interface.retrievers.base import retriever_creator def get_type_dict(): @@ -28,6 +29,7 @@ def get_type_dict(): "embeddings": embedding_creator.to_list(), "textSplitters": textsplitter_creator.to_list(), "utilities": utility_creator.to_list(), + "retrievers": retriever_creator.to_list(), } From 302efa103a1ad1960365e488a0edc94d7c755887 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 09:56:26 -0300 Subject: [PATCH 37/72] =?UTF-8?q?=E2=9C=A8=20feat(retrievers):=20add=20=5F?= =?UTF-8?q?=5Finit=5F=5F.py=20file=20to=20retrievers=20directory=20The=20?= =?UTF-8?q?=5F=5Finit=5F=5F.py=20file=20is=20added=20to=20the=20retrievers?= =?UTF-8?q?=20directory=20to=20make=20it=20a=20Python=20package.=20This=20?= =?UTF-8?q?allows=20the=20directory=20to=20be=20recognized=20as=20a=20modu?= =?UTF-8?q?le=20and=20enables=20importing=20of=20modules=20and=20submodule?= =?UTF-8?q?s=20within=20the=20retrievers=20directory.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/retrievers/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/backend/langflow/interface/retrievers/__init__.py diff --git a/src/backend/langflow/interface/retrievers/__init__.py b/src/backend/langflow/interface/retrievers/__init__.py new file mode 100644 index 000000000..e69de29bb From 894fd16e8ed99b3b0aba621ae13cec06ed83cb88 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 09:56:59 -0300 Subject: [PATCH 38/72] =?UTF-8?q?=E2=9C=A8=20feat(retrievers):=20add=20bas?= =?UTF-8?q?e=20retriever=20class=20and=20frontend=20node=20class=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(util.py):=20handle=20non-string=20types=20in?= =?UTF-8?q?=20format=5Fdict=20function=20The=20base=20retriever=20class=20?= =?UTF-8?q?is=20added=20to=20provide=20a=20common=20interface=20for=20all?= =?UTF-8?q?=20retrievers=20in=20the=20language=20chain.=20The=20frontend?= =?UTF-8?q?=20node=20class=20for=20retrievers=20is=20also=20added=20to=20h?= =?UTF-8?q?andle=20the=20formatting=20of=20fields=20specific=20to=20retrie?= =?UTF-8?q?vers.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the util.py file, a fix is made to handle non-string types in the format_dict function. Previously, if the type of a field was not a string, an error would occur. This fix ensures that the type is converted to a string before further processing. --- .../langflow/interface/retrievers/base.py | 49 +++++++++++++++++++ .../template/frontend_node/retrievers.py | 15 ++++++ src/backend/langflow/utils/util.py | 3 ++ 3 files changed, 67 insertions(+) create mode 100644 src/backend/langflow/interface/retrievers/base.py create mode 100644 src/backend/langflow/template/frontend_node/retrievers.py diff --git a/src/backend/langflow/interface/retrievers/base.py b/src/backend/langflow/interface/retrievers/base.py new file mode 100644 index 000000000..3eb38861e --- /dev/null +++ b/src/backend/langflow/interface/retrievers/base.py @@ -0,0 +1,49 @@ +from typing import Any, Dict, List, Optional, Type + +from langchain import retrievers + +from langflow.interface.base import LangChainTypeCreator +from langflow.interface.importing.utils import import_class +from langflow.settings import settings +from langflow.template.frontend_node.retrievers import RetrieverFrontendNode +from langflow.utils.logger import logger +from langflow.utils.util import build_template_from_method + + +class RetrieverCreator(LangChainTypeCreator): + type_name: str = "retrievers" + + @property + def frontend_node_class(self) -> Type[RetrieverFrontendNode]: + return RetrieverFrontendNode + + @property + def type_to_loader_dict(self) -> Dict: + if self.type_dict is None: + self.type_dict: dict[str, Any] = { + retriever_name: import_class(f"langchain.retrievers.{retriever_name}") + for retriever_name in retrievers.__all__ + } + return self.type_dict + + def get_signature(self, name: str) -> Optional[Dict]: + """Get the signature of an embedding.""" + try: + return build_template_from_method( + name, type_to_cls_dict=self.type_to_loader_dict, method_name="from_llm" + ) + except ValueError as exc: + raise ValueError(f"Retriever {name} not found") from exc + except AttributeError as exc: + logger.error(f"Retriever {name} not loaded: {exc}") + return None + + def to_list(self) -> List[str]: + return [ + retriever + for retriever in self.type_to_loader_dict.keys() + if retriever in settings.retrievers or settings.dev + ] + + +retriever_creator = RetrieverCreator() diff --git a/src/backend/langflow/template/frontend_node/retrievers.py b/src/backend/langflow/template/frontend_node/retrievers.py new file mode 100644 index 000000000..b482c8b84 --- /dev/null +++ b/src/backend/langflow/template/frontend_node/retrievers.py @@ -0,0 +1,15 @@ +from typing import Optional + +from langflow.template.field.base import TemplateField +from langflow.template.frontend_node.base import FrontendNode + + +class RetrieverFrontendNode(FrontendNode): + @staticmethod + def format_field(field: TemplateField, name: Optional[str] = None) -> None: + FrontendNode.format_field(field, name) + # Define common field attributes + field.show = True + if field.name == "parser_key": + field.display_name = "Parser Key" + field.password = False diff --git a/src/backend/langflow/utils/util.py b/src/backend/langflow/utils/util.py index 7fcf1f4d4..02a9520b4 100644 --- a/src/backend/langflow/utils/util.py +++ b/src/backend/langflow/utils/util.py @@ -233,6 +233,9 @@ def format_dict(d, name: Optional[str] = None): _type = value["type"] + if not isinstance(_type, str): + _type = _type.__name__ + # Remove 'Optional' wrapper if "Optional" in _type: _type = _type.replace("Optional[", "")[:-1] From 19828da83041b28eb7837f350d81805b7943156e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 09:57:09 -0300 Subject: [PATCH 39/72] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.ts):=20rename=20?= =?UTF-8?q?Search=20icon=20to=20FileSearch=20for=20better=20clarity=20and?= =?UTF-8?q?=20accuracy=20The=20Search=20icon=20has=20been=20renamed=20to?= =?UTF-8?q?=20FileSearch=20to=20provide=20a=20more=20accurate=20representa?= =?UTF-8?q?tion=20of=20its=20purpose.=20This=20change=20improves=20clarity?= =?UTF-8?q?=20and=20ensures=20that=20the=20icon=20name=20aligns=20with=20i?= =?UTF-8?q?ts=20actual=20functionality.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/utils.ts b/src/frontend/src/utils.ts index d89fe8a00..d8198ec3d 100644 --- a/src/frontend/src/utils.ts +++ b/src/frontend/src/utils.ts @@ -40,7 +40,7 @@ import { Paperclip, Rocket, Scissors, - Search, + FileSearch, TerminalSquare, Wand2, Wrench, @@ -286,7 +286,7 @@ export const nodeIconsLucide: { utilities: Wand2 as React.ForwardRefExoticComponent< ComponentType> >, - retrievers: Search as React.ForwardRefExoticComponent< + retrievers: FileSearch as React.ForwardRefExoticComponent< ComponentType> >, unknown: HelpCircle as React.ForwardRefExoticComponent< From e1bf25a4ff28d3769a4a6fc29b0e9f428712530d Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 09:59:31 -0300 Subject: [PATCH 40/72] =?UTF-8?q?=F0=9F=93=A6=20chore(frontend):=20add=20d?= =?UTF-8?q?ompurify=20package=20as=20a=20dependency=20The=20dompurify=20pa?= =?UTF-8?q?ckage=20is=20added=20as=20a=20dependency=20to=20the=20frontend?= =?UTF-8?q?=20package.json=20file.=20This=20package=20is=20needed=20for=20?= =?UTF-8?q?sanitizing=20HTML=20to=20prevent=20cross-site=20scripting=20(XS?= =?UTF-8?q?S)=20attacks.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/package-lock.json | 9 +++++++-- src/frontend/package.json | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json index 0edd88d0d..5ff5c4e58 100644 --- a/src/frontend/package-lock.json +++ b/src/frontend/package-lock.json @@ -34,6 +34,7 @@ "base64-js": "^1.5.1", "class-variance-authority": "^0.6.0", "clsx": "^1.2.1", + "dompurify": "^3.0.3", "esbuild": "^0.17.18", "lodash": "^4.17.21", "lucide-react": "^0.233.0", @@ -3444,7 +3445,7 @@ "version": "16.18.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.12.tgz", "integrity": "sha512-vzLe5NaNMjIE3mcddFVGlAXN1LEWueUsMsOJWaT6wWMJGyljHAWHznqfnKUQWGzu7TLPrGvWdNAsvQYW+C0xtw==", - "dev": true + "devOptional": true }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -5009,6 +5010,11 @@ "node": ">=12" } }, + "node_modules/dompurify": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.3.tgz", + "integrity": "sha512-axQ9zieHLnAnHh0sfAamKYiqXMJAVwu+LM/alQ7WDagoWessyWvMSFyW65CqF3owufNu8HBcE4cM2Vflu7YWcQ==" + }, "node_modules/electron-to-chromium": { "version": "1.4.440", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.440.tgz", @@ -5504,7 +5510,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ diff --git a/src/frontend/package.json b/src/frontend/package.json index 95e826736..ba0e6304d 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -29,6 +29,7 @@ "base64-js": "^1.5.1", "class-variance-authority": "^0.6.0", "clsx": "^1.2.1", + "dompurify": "^3.0.3", "esbuild": "^0.17.18", "lodash": "^4.17.21", "lucide-react": "^0.233.0", From 3faf5f5b9624c4648b1cb0bba19d3000cc293532 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 10:02:28 -0300 Subject: [PATCH 41/72] =?UTF-8?q?=F0=9F=90=9B=20fix(chatMessage):=20saniti?= =?UTF-8?q?ze=20HTML=20content=20to=20prevent=20potential=20XSS=20attacks?= =?UTF-8?q?=20=E2=9C=A8=20feat(chatMessage):=20improve=20rendering=20of=20?= =?UTF-8?q?multi-line=20messages=20The=20`convert`=20variable=20is=20now?= =?UTF-8?q?=20imported=20before=20being=20used=20to=20convert=20ANSI=20to?= =?UTF-8?q?=20HTML.=20Additionally,=20the=20`DOMPurify`=20library=20is=20i?= =?UTF-8?q?mported=20and=20used=20to=20sanitize=20the=20HTML=20content=20b?= =?UTF-8?q?efore=20rendering=20it,=20preventing=20potential=20XSS=20attack?= =?UTF-8?q?s.=20The=20rendering=20of=20multi-line=20messages=20has=20been?= =?UTF-8?q?=20improved=20by=20splitting=20the=20message=20by=20newline=20c?= =?UTF-8?q?haracters=20and=20rendering=20each=20line=20separately=20with?= =?UTF-8?q?=20a=20line=20break.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chatComponent/chatMessage/index.tsx | 9 +++++---- .../modals/chatModal/chatMessage/index.tsx | 19 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/frontend/src/components/chatComponent/chatMessage/index.tsx b/src/frontend/src/components/chatComponent/chatMessage/index.tsx index ee11d69cb..5bb4e8b33 100644 --- a/src/frontend/src/components/chatComponent/chatMessage/index.tsx +++ b/src/frontend/src/components/chatComponent/chatMessage/index.tsx @@ -2,9 +2,9 @@ import { useState } from "react"; import { ChatMessageType } from "../../../types/chat"; import { nodeColors } from "../../../utils"; import Convert from "ansi-to-html"; -const convert = new Convert({ newline: true }); import { MessageCircle } from "lucide-react"; - +import DOMPurify from "dompurify"; +const convert = new Convert({ newline: true }); export default function ChatMessage({ chat }: { chat: ChatMessageType }) { const [hidden, setHidden] = useState(true); return ( @@ -23,13 +23,14 @@ export default function ChatMessage({ chat }: { chat: ChatMessageType }) { )} + {chat.thought && chat.thought !== "" && !hidden && (
setHidden((prev) => !prev)} style={{ backgroundColor: nodeColors["thought"] }} - className=" text-start inline-block w-full pb-3 pt-3 px-5 cursor-pointer" + className="text-start inline-block w-full pb-3 pt-3 px-5 cursor-pointer" dangerouslySetInnerHTML={{ - __html: convert.toHtml(chat.thought), + __html: DOMPurify.sanitize(convert.toHtml(chat.thought)), }} >
)} diff --git a/src/frontend/src/modals/chatModal/chatMessage/index.tsx b/src/frontend/src/modals/chatModal/chatMessage/index.tsx index 3d4ce0b44..3b44ffe6f 100644 --- a/src/frontend/src/modals/chatModal/chatMessage/index.tsx +++ b/src/frontend/src/modals/chatModal/chatMessage/index.tsx @@ -11,7 +11,7 @@ import remarkMath from "remark-math"; import { CodeBlock } from "./codeBlock"; import Convert from "ansi-to-html"; import { User2, MessageCircle } from "lucide-react"; - +import DOMPurify from "dompurify"; export default function ChatMessage({ chat, lockChat, @@ -78,10 +78,9 @@ export default function ChatMessage({ {chat.thought && chat.thought !== "" && !hidden && (
setHidden((prev) => !prev)} - className=" text-start inline-block rounded-md text-gray-600 dark:text-gray-200 h-full border border-gray-300 dark:border-gray-500 - bg-muted dark:bg-gray-800 w-[95%] pb-3 pt-3 px-2 ml-3 cursor-pointer scrollbar-hide overflow-scroll" + className="text-start inline-block rounded-md text-gray-600 dark:text-gray-200 h-full border border-gray-300 dark:border-gray-500 bg-muted dark:bg-gray-800 w-[95%] pb-3 pt-3 px-2 ml-3 cursor-pointer scrollbar-hide overflow-scroll" dangerouslySetInnerHTML={{ - __html: convert.toHtml(chat.thought), + __html: DOMPurify.sanitize(convert.toHtml(chat.thought)), }} >
)} @@ -152,12 +151,12 @@ export default function ChatMessage({ ) : (
- "), - }} - > + {message.split("\n").map((line, index) => ( + + {line} +
+
+ ))}
)} From c954f8d33800fcbe1361a498a7d3ba15c44a0b12 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Thu, 29 Jun 2023 10:44:32 -0300 Subject: [PATCH 42/72] =?UTF-8?q?=F0=9F=90=9B=20fix(AccordionComponent):?= =?UTF-8?q?=20fix=20the=20logic=20to=20set=20the=20initial=20value=20of=20?= =?UTF-8?q?the=20accordion=20based=20on=20the=20open=20prop=20array=20?= =?UTF-8?q?=E2=9C=A8=20feat(AccordionComponent):=20add=20support=20for=20m?= =?UTF-8?q?ultiple=20open=20accordions=20by=20changing=20the=20open=20prop?= =?UTF-8?q?=20from=20boolean=20to=20string=20array=20=F0=9F=90=9B=20fix(co?= =?UTF-8?q?nstants.tsx):=20remove=20escape=20characters=20from=20the=20JSO?= =?UTF-8?q?N=20stringified=20tweaks=20to=20fix=20parsing=20issues=20?= =?UTF-8?q?=E2=9C=A8=20feat(constants.tsx):=20add=20support=20for=20tweaks?= =?UTF-8?q?=20dictionary=20in=20the=20getCurlCode=20and=20getPythonCode=20?= =?UTF-8?q?functions=20=F0=9F=90=9B=20fix(ApiModal):=20fix=20the=20logic?= =?UTF-8?q?=20to=20set=20the=20initial=20value=20of=20the=20openAccordion?= =?UTF-8?q?=20state=20based=20on=20the=20getTweak=20array=20=E2=9C=A8=20fe?= =?UTF-8?q?at(ApiModal):=20add=20support=20for=20opening=20accordions=20ba?= =?UTF-8?q?sed=20on=20the=20getTweak=20array=20when=20switching=20to=20the?= =?UTF-8?q?=20Tweak=20tab=20=F0=9F=90=9B=20fix(ApiModal):=20fix=20the=20lo?= =?UTF-8?q?gic=20to=20filter=20and=20remove=20empty=20tweaks=20from=20the?= =?UTF-8?q?=20tweak.current=20array=20=E2=9C=A8=20feat(ApiModal):=20add=20?= =?UTF-8?q?support=20for=20adding=20new=20tweaks=20to=20the=20tweak.curren?= =?UTF-8?q?t=20array=20and=20generating=20Python=20API=20code=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(ApiModal):=20fix=20the=20logic=20to=20get=20?= =?UTF-8?q?the=20value=20of=20a=20specific=20tweak=20template=20based=20on?= =?UTF-8?q?=20the=20node=20id=20and=20template=20name=20=E2=9C=A8=20feat(A?= =?UTF-8?q?piModal):=20add=20support=20for=20opening=20accordions=20based?= =?UTF-8?q?=20on=20the=20tweak.current=20array=20when=20switching=20to=20t?= =?UTF-8?q?he=20Tweak=20tab=20=F0=9F=90=9B=20fix(types):=20add=20missing?= =?UTF-8?q?=20newline=20at=20the=20end=20of=20the=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/package-lock.json | 15 ++--- .../components/AccordionComponent/index.tsx | 16 ++++- src/frontend/src/constants.tsx | 6 +- src/frontend/src/modals/ApiModal/index.tsx | 63 ++++++++++--------- src/frontend/src/types/components/index.ts | 2 +- 5 files changed, 61 insertions(+), 41 deletions(-) diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json index 1c185a3b9..a4128b48e 100644 --- a/src/frontend/package-lock.json +++ b/src/frontend/package-lock.json @@ -3563,7 +3563,7 @@ "version": "16.18.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.12.tgz", "integrity": "sha512-vzLe5NaNMjIE3mcddFVGlAXN1LEWueUsMsOJWaT6wWMJGyljHAWHznqfnKUQWGzu7TLPrGvWdNAsvQYW+C0xtw==", - "devOptional": true + "dev": true }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -5633,6 +5633,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -6992,9 +6993,9 @@ } }, "node_modules/log-symbols/node_modules/chalk": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", - "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" }, @@ -8262,9 +8263,9 @@ } }, "node_modules/ora/node_modules/chalk": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", - "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" }, diff --git a/src/frontend/src/components/AccordionComponent/index.tsx b/src/frontend/src/components/AccordionComponent/index.tsx index c1174269a..825a2c19d 100644 --- a/src/frontend/src/components/AccordionComponent/index.tsx +++ b/src/frontend/src/components/AccordionComponent/index.tsx @@ -15,9 +15,21 @@ import { export default function AccordionComponent({ trigger, children, - open = false, + open = [], }: AccordionComponentType) { - const [value, setValue] = useState(!open ? "" : trigger); + const [value, setValue] = useState(open.length == 0 ? "" : getOpenAccordion()); + + function getOpenAccordion(){ + let value = ""; + open.forEach(el => { + if(el == trigger){ + value = trigger; + } + }) + + return value; + } + function handleClick() { value == "" ? setValue(trigger) : setValue(""); } diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index 4aee27d83..9bfb4bcd5 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -71,7 +71,7 @@ FLOW_ID = "${flowId}" # You can tweak the flow by adding a tweaks dictionary # e.g {"OpenAI-XXXXX": {"model_name": "gpt-4"}} TWEAKS = ${ - tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2).replace(/\\/g, '') : JSON.stringify(tweaks, null, 2) } def run_flow(message: str, flow_id: str, tweaks: dict = None) -> dict: @@ -111,7 +111,7 @@ export const getCurlCode = (flow: FlowType, tweak?): string => { }/api/v1/process/${flowId} \\ -H 'Content-Type: application/json' \\ -d '{"inputs": {"input": message}, "tweaks": ${ - tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2).replace(/\\/g, '') : JSON.stringify(tweaks, null, 2) }}'`; }; /** @@ -124,7 +124,7 @@ export const getPythonCode = (flow: FlowType, tweak?): string => { const tweaks = buildTweaks(flow); return `from langflow import load_flow_from_json TWEAKS = ${ - tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2) : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2).replace(/\\/g, '') : JSON.stringify(tweaks, null, 2) } flow = load_flow_from_json("${flowName}.json", tweaks=TWEAKS) # Now you can use it like any chain diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 1000a52d6..6f0014f33 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -58,7 +58,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { const [activeTab, setActiveTab] = useState("0"); const [isCopied, setIsCopied] = useState(false); const [enabled, setEnabled] = useState(null); - const [openAccordion, setOpenAccordion] = useState(false); + const [openAccordion, setOpenAccordion] = useState([]); const tweak = useRef([]); const tweaksList = useRef([]); const { setTweak, getTweak } = useContext(TabsContext); @@ -87,8 +87,11 @@ export default function ApiModal({ flow }: { flow: FlowType }) { useEffect(() => { if (closeEdit !== "") { setActiveTab("3"); - setOpenAccordion(true); tweak.current = getTweak; + openAccordions(); + } + else{ + startTweaks(); } }, [closeEdit]); @@ -100,6 +103,11 @@ export default function ApiModal({ flow }: { flow: FlowType }) { useEffect(() => { filterNodes(); }, []); + + function startTweaks() { + tweak.current.push(buildTweaks(flow)); + } + function filterNodes() { let arrNodesWithValues = []; @@ -176,25 +184,13 @@ export default function ApiModal({ flow }: { flow: FlowType }) { if (existingTweak) { existingTweak[tw][template["name"]] = changes; - if (template.list === true) { - if (changes.length === 0) { - if (existingTweak[tw] && existingTweak[tw][template["name"]]) { - delete existingTweak[tw][template["name"]]; - } - } - } - if (existingTweak[tw][template["name"]] == template.value) { tweak.current.forEach((element) => { - if (element[tw] && element[tw][template["name"]]) { - delete element[tw][template["name"]]; - } if (element[tw] && Object.keys(element[tw])?.length === 0) { tweak.current = tweak.current.filter((obj) => { const prop = obj[Object.keys(obj)[0]].prop; return prop !== undefined && prop !== null && prop !== ""; }); - delete element[tw]; } }); } @@ -205,6 +201,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { }, }; tweak.current.push(newTweak); + } const pythonApiCode = getPythonApiCode(flow, tweak.current); @@ -232,17 +229,16 @@ export default function ApiModal({ flow }: { flow: FlowType }) { if (getTweak.length > 0) { for (const obj of getTweak) { - // Obtém a chave do objeto interno - const key = Object.keys(obj)[0]; - // Obtém o valor do objeto interno - const value = obj[key]; - if (key == node["id"]) { - Object.keys(value).forEach((key) => { - if (key == template["name"]) { - returnValue = value[key]; - } - }); - } + Object.keys(obj).forEach(key =>{ + const value = obj[key]; + if (key == node["id"]) { + Object.keys(value).forEach((key) => { + if (key == template["name"]) { + returnValue = value[key]; + } + }); + } + }) } } else { return value ?? ""; @@ -250,6 +246,18 @@ export default function ApiModal({ flow }: { flow: FlowType }) { return returnValue; } + function openAccordions(){ + let accordionsToOpen = []; + tweak.current.forEach((el) => { + Object.keys(el).forEach((key) => { + if (Object.keys(el[key]).length > 0) { + accordionsToOpen.push(key) + setOpenAccordion(accordionsToOpen); + } + }); + }); + } + return ( @@ -270,9 +278,8 @@ export default function ApiModal({ flow }: { flow: FlowType }) { className="w-full h-full overflow-hidden text-center bg-muted rounded-md border" onValueChange={(value) => { setActiveTab(value); - - if (tweak.current.length > 0) { - setOpenAccordion(true); + if(value === "3"){ + openAccordions() } }} > diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts index 4c936cabe..347554682 100644 --- a/src/frontend/src/types/components/index.ts +++ b/src/frontend/src/types/components/index.ts @@ -121,6 +121,6 @@ export type RadialProgressType = { export type AccordionComponentType = { children?: ReactElement; - open?: boolean; + open?: string[]; trigger?: string; }; \ No newline at end of file From f1e2bbb69c26a3f563a01b597c1535e0db20dcad Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 10:54:27 -0300 Subject: [PATCH 43/72] =?UTF-8?q?=F0=9F=90=9B=20fix(chat.py):=20change=20B?= =?UTF-8?q?uildStatus.IN=5FPROGRESS=20to=20BuildStatus.STARTED=20for=20bet?= =?UTF-8?q?ter=20clarity=20=F0=9F=90=9B=20fix(chat.py):=20fix=20incorrect?= =?UTF-8?q?=20key=20used=20to=20retrieve=20graph=5Fdata=20from=20flow=5Fda?= =?UTF-8?q?ta=5Fstore=20The=20BuildStatus.IN=5FPROGRESS=20constant=20is=20?= =?UTF-8?q?changed=20to=20BuildStatus.STARTED=20to=20provide=20a=20more=20?= =?UTF-8?q?accurate=20representation=20of=20the=20flow=20status.=20Additio?= =?UTF-8?q?nally,=20the=20incorrect=20key=20"data"=20is=20replaced=20with?= =?UTF-8?q?=20"graph=5Fdata"=20when=20retrieving=20the=20graph=20data=20fr?= =?UTF-8?q?om=20the=20flow=5Fdata=5Fstore=20dictionary.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 5 +++-- src/backend/langflow/api/v1/schemas.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index fd0232189..25be65dbb 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -47,7 +47,7 @@ async def init_build(graph_data: dict, flow_id: str): logger.debug(f"Deleted flow {flow_id} from cache") flow_data_store[flow_id] = { "graph_data": graph_data, - "status": BuildStatus.IN_PROGRESS, + "status": BuildStatus.STARTED, } return InitResponse(flowId=flow_id) @@ -91,7 +91,7 @@ async def stream_build(flow_id: str): yield str(StreamData(event="error", data={"error": error_message})) return - graph_data = flow_data_store[flow_id].get("data") + graph_data = flow_data_store[flow_id].get("graph_data") if not graph_data: error_message = "No data provided" @@ -109,6 +109,7 @@ async def stream_build(flow_id: str): return number_of_nodes = len(graph.nodes) + flow_data_store[flow_id]["status"] = BuildStatus.IN_PROGRESS for i, vertex in enumerate(graph.generator_build(), 1): try: log_dict = { diff --git a/src/backend/langflow/api/v1/schemas.py b/src/backend/langflow/api/v1/schemas.py index 2cf62a504..f5f1f9ccf 100644 --- a/src/backend/langflow/api/v1/schemas.py +++ b/src/backend/langflow/api/v1/schemas.py @@ -11,6 +11,7 @@ class BuildStatus(Enum): SUCCESS = "success" FAILURE = "failure" + STARTED = "started" IN_PROGRESS = "in_progress" From f1de9a554da3f2f46be85ae55fb0cde08be78e30 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 11:15:51 -0300 Subject: [PATCH 44/72] =?UTF-8?q?=F0=9F=94=80=20refactor(constants.py):=20?= =?UTF-8?q?import=20vertex=20types=20from=20langflow.graph.vertex.types=20?= =?UTF-8?q?as=20types=20for=20improved=20readability=20and=20maintainabili?= =?UTF-8?q?ty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The import statements for vertex types in the constants.py file have been refactored to import from langflow.graph.vertex.types as types. This change improves the readability and maintainability of the code by making it clear where the vertex types are coming from. --- src/backend/langflow/graph/graph/constants.py | 42 +++++++------------ 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/src/backend/langflow/graph/graph/constants.py b/src/backend/langflow/graph/graph/constants.py index 3398f253f..9474e311e 100644 --- a/src/backend/langflow/graph/graph/constants.py +++ b/src/backend/langflow/graph/graph/constants.py @@ -1,18 +1,5 @@ from langflow.graph.vertex.base import Vertex -from langflow.graph.vertex.types import ( - AgentVertex, - ChainVertex, - DocumentLoaderVertex, - EmbeddingVertex, - LLMVertex, - MemoryVertex, - PromptVertex, - TextSplitterVertex, - ToolVertex, - ToolkitVertex, - VectorStoreVertex, - WrapperVertex, -) +from langflow.graph.vertex import types from langflow.interface.agents.base import agent_creator from langflow.interface.chains.base import chain_creator from langflow.interface.document_loaders.base import documentloader_creator @@ -25,22 +12,23 @@ from langflow.interface.toolkits.base import toolkits_creator from langflow.interface.tools.base import tool_creator from langflow.interface.vector_store.base import vectorstore_creator from langflow.interface.wrappers.base import wrapper_creator - +from langflow.interface.retrievers.base import retriever_creator from typing import Dict, Type VERTEX_TYPE_MAP: Dict[str, Type[Vertex]] = { - **{t: PromptVertex for t in prompt_creator.to_list()}, - **{t: AgentVertex for t in agent_creator.to_list()}, - **{t: ChainVertex for t in chain_creator.to_list()}, - **{t: ToolVertex for t in tool_creator.to_list()}, - **{t: ToolkitVertex for t in toolkits_creator.to_list()}, - **{t: WrapperVertex for t in wrapper_creator.to_list()}, - **{t: LLMVertex for t in llm_creator.to_list()}, - **{t: MemoryVertex for t in memory_creator.to_list()}, - **{t: EmbeddingVertex for t in embedding_creator.to_list()}, - **{t: VectorStoreVertex for t in vectorstore_creator.to_list()}, - **{t: DocumentLoaderVertex for t in documentloader_creator.to_list()}, - **{t: TextSplitterVertex for t in textsplitter_creator.to_list()}, + **{t: types.PromptVertex for t in prompt_creator.to_list()}, + **{t: types.AgentVertex for t in agent_creator.to_list()}, + **{t: types.ChainVertex for t in chain_creator.to_list()}, + **{t: types.ToolVertex for t in tool_creator.to_list()}, + **{t: types.ToolkitVertex for t in toolkits_creator.to_list()}, + **{t: types.WrapperVertex for t in wrapper_creator.to_list()}, + **{t: types.LLMVertex for t in llm_creator.to_list()}, + **{t: types.MemoryVertex for t in memory_creator.to_list()}, + **{t: types.EmbeddingVertex for t in embedding_creator.to_list()}, + **{t: types.VectorStoreVertex for t in vectorstore_creator.to_list()}, + **{t: types.DocumentLoaderVertex for t in documentloader_creator.to_list()}, + **{t: types.TextSplitterVertex for t in textsplitter_creator.to_list()}, + **{t: types.RetrieverVertex for t in retriever_creator.to_list()}, } From 6ef5e56c5cedbfe8455ee1e0f4ba60bd8dfa433d Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 11:16:05 -0300 Subject: [PATCH 45/72] =?UTF-8?q?=E2=9C=A8=20feat(graph):=20add=20Retrieve?= =?UTF-8?q?rVertex=20to=20the=20list=20of=20available=20vertex=20types=20T?= =?UTF-8?q?he=20RetrieverVertex=20class=20is=20added=20to=20the=20list=20o?= =?UTF-8?q?f=20available=20vertex=20types=20in=20the=20langflow.graph.vert?= =?UTF-8?q?ex.types=20module.=20This=20allows=20for=20the=20creation=20of?= =?UTF-8?q?=20vertices=20that=20represent=20retrievers=20in=20the=20graph.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/graph/__init__.py | 2 ++ src/backend/langflow/graph/vertex/types.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/backend/langflow/graph/__init__.py b/src/backend/langflow/graph/__init__.py index a68e844ee..e63b9dcc0 100644 --- a/src/backend/langflow/graph/__init__.py +++ b/src/backend/langflow/graph/__init__.py @@ -14,6 +14,7 @@ from langflow.graph.vertex.types import ( ToolkitVertex, VectorStoreVertex, WrapperVertex, + RetrieverVertex, ) __all__ = [ @@ -32,4 +33,5 @@ __all__ = [ "ToolkitVertex", "VectorStoreVertex", "WrapperVertex", + "RetrieverVertex", ] diff --git a/src/backend/langflow/graph/vertex/types.py b/src/backend/langflow/graph/vertex/types.py index b6a8f9a91..846b79bc0 100644 --- a/src/backend/langflow/graph/vertex/types.py +++ b/src/backend/langflow/graph/vertex/types.py @@ -112,6 +112,11 @@ class MemoryVertex(Vertex): super().__init__(data, base_type="memory") +class RetrieverVertex(Vertex): + def __init__(self, data: Dict): + super().__init__(data, base_type="retrievers") + + class TextSplitterVertex(Vertex): def __init__(self, data: Dict): super().__init__(data, base_type="textsplitters") From 6b893237d067de0e73ca4848e93cd7cbc8184399 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 11:17:30 -0300 Subject: [PATCH 46/72] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.py):=20add=20imp?= =?UTF-8?q?ort=5Fretriever=20function=20to=20import=20retriever=20module?= =?UTF-8?q?=20=E2=9C=A8=20feat(utils.py):=20add=20support=20for=20importin?= =?UTF-8?q?g=20retriever=20module=20based=20on=20retriever=20name=20The=20?= =?UTF-8?q?`import=5Fretriever`=20function=20is=20added=20to=20the=20`util?= =?UTF-8?q?s.py`=20module=20to=20allow=20importing=20the=20retriever=20mod?= =?UTF-8?q?ule=20based=20on=20the=20retriever=20name.=20This=20function=20?= =?UTF-8?q?uses=20the=20`import=5Fmodule`=20function=20from=20the=20`impor?= =?UTF-8?q?tlib`=20module=20to=20dynamically=20import=20the=20retriever=20?= =?UTF-8?q?module=20from=20the=20`langchain.retrievers`=20package.=20This?= =?UTF-8?q?=20enhances=20the=20modularity=20and=20extensibility=20of=20the?= =?UTF-8?q?=20codebase=20by=20providing=20a=20convenient=20way=20to=20impo?= =?UTF-8?q?rt=20retrievers=20based=20on=20their=20names.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/importing/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/langflow/interface/importing/utils.py b/src/backend/langflow/interface/importing/utils.py index f65376d48..7ef916ca9 100644 --- a/src/backend/langflow/interface/importing/utils.py +++ b/src/backend/langflow/interface/importing/utils.py @@ -44,6 +44,7 @@ def import_by_type(_type: str, name: str) -> Any: "documentloaders": import_documentloader, "textsplitters": import_textsplitter, "utilities": import_utility, + "retrievers": import_retriever, } if _type == "llms": key = "chat" if "chat" in name.lower() else "llm" @@ -59,6 +60,11 @@ def import_chat_llm(llm: str) -> BaseChatModel: return import_class(f"langchain.chat_models.{llm}") +def import_retriever(retriever: str) -> Any: + """Import retriever from retriever name""" + return import_module(f"from langchain.retrievers import {retriever}") + + def import_memory(memory: str) -> Any: """Import memory from memory name""" return import_module(f"from langchain.memory import {memory}") From 72b6681f5a798cb15629842d86dba638face030b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 11:17:59 -0300 Subject: [PATCH 47/72] =?UTF-8?q?=F0=9F=94=A7=20chore(loading.py):=20add?= =?UTF-8?q?=20support=20for=20instantiating=20retrievers=20in=20the=20init?= =?UTF-8?q?ialization=20process=20=F0=9F=9A=80=20feat(loading.py):=20imple?= =?UTF-8?q?ment=20the=20ability=20to=20instantiate=20retrievers=20based=20?= =?UTF-8?q?on=20node=20type=20and=20class=20object=20The=20`instantiate=5F?= =?UTF-8?q?based=5Fon=5Ftype`=20function=20now=20includes=20a=20new=20cond?= =?UTF-8?q?ition=20to=20handle=20the=20instantiation=20of=20retrievers.=20?= =?UTF-8?q?The=20`instantiate=5Fretriever`=20function=20is=20introduced=20?= =?UTF-8?q?to=20handle=20the=20specific=20logic=20for=20creating=20retriev?= =?UTF-8?q?ers.=20This=20change=20allows=20for=20the=20dynamic=20creation?= =?UTF-8?q?=20of=20retrievers=20based=20on=20the=20provided=20node=20type?= =?UTF-8?q?=20and=20class=20object.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../langflow/interface/initialize/loading.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index ea9af8d63..65461f141 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -15,6 +15,7 @@ from langflow.interface.custom_lists import CUSTOM_NODES from langflow.interface.importing.utils import get_function, import_by_type from langflow.interface.toolkits.base import toolkits_creator from langflow.interface.chains.base import chain_creator +from langflow.interface.retrievers.base import retriever_creator from langflow.interface.utils import load_file_into_dict from langflow.utils import validate from langchain.chains.base import Chain @@ -79,10 +80,23 @@ def instantiate_based_on_type(class_object, base_type, node_type, params): return instantiate_chains(node_type, class_object, params) elif base_type == "llms": return instantiate_llm(node_type, class_object, params) + elif base_type == "retrievers": + return instantiate_retriever(node_type, class_object, params) else: return class_object(**params) +def instantiate_retriever(node_type, class_object, params): + if "retriever" in params and hasattr(params["retriever"], "as_retriever"): + params["retriever"] = params["retriever"].as_retriever() + if node_type in retriever_creator.from_method_nodes: + method = retriever_creator.from_method_nodes[node_type] + if class_method := getattr(class_object, method, None): + return class_method(**params) + raise ValueError(f"Method {method} not found in {class_object}") + return class_object(**params) + + def instantiate_llm(node_type, class_object, params: Dict): return class_object(**params) From 8cc04971208f3665973b792745352ff002abfbc2 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 11:18:11 -0300 Subject: [PATCH 48/72] =?UTF-8?q?=F0=9F=94=80=20refactor(base.py):=20add?= =?UTF-8?q?=20from=5Fmethod=5Fnodes=20dictionary=20to=20RetrieverCreator?= =?UTF-8?q?=20class=20The=20`from=5Fmethod=5Fnodes`=20dictionary=20is=20ad?= =?UTF-8?q?ded=20to=20the=20`RetrieverCreator`=20class=20in=20order=20to?= =?UTF-8?q?=20map=20the=20"MultiQueryRetriever"=20node=20to=20the=20"from?= =?UTF-8?q?=5Fllm"=20method.=20This=20refactor=20improves=20the=20readabil?= =?UTF-8?q?ity=20and=20maintainability=20of=20the=20code=20by=20explicitly?= =?UTF-8?q?=20defining=20the=20mapping=20between=20nodes=20and=20methods.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/retrievers/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/langflow/interface/retrievers/base.py b/src/backend/langflow/interface/retrievers/base.py index 3eb38861e..16f49191e 100644 --- a/src/backend/langflow/interface/retrievers/base.py +++ b/src/backend/langflow/interface/retrievers/base.py @@ -13,6 +13,8 @@ from langflow.utils.util import build_template_from_method class RetrieverCreator(LangChainTypeCreator): type_name: str = "retrievers" + from_method_nodes = {"MultiQueryRetriever": "from_llm"} + @property def frontend_node_class(self) -> Type[RetrieverFrontendNode]: return RetrieverFrontendNode From 549a8dedc552e8a5d2da81aefc65960d04ec8e6a Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 11:18:19 -0300 Subject: [PATCH 49/72] =?UTF-8?q?=F0=9F=94=A7=20chore(llms.py):=20add=20me?= =?UTF-8?q?thod=20to=20add=20extra=20base=20classes=20to=20improve=20exten?= =?UTF-8?q?sibility=20The=20`add=5Fextra=5Fbase=5Fclasses`=20method=20is?= =?UTF-8?q?=20added=20to=20the=20`LLMFrontendNode`=20class.=20This=20metho?= =?UTF-8?q?d=20checks=20if=20the=20"BaseLLM"=20class=20is=20already=20pres?= =?UTF-8?q?ent=20in=20the=20`base=5Fclasses`=20list=20and=20appends=20it?= =?UTF-8?q?=20if=20not.=20This=20change=20allows=20for=20easier=20extensib?= =?UTF-8?q?ility=20by=20providing=20a=20way=20to=20add=20additional=20base?= =?UTF-8?q?=20classes=20to=20the=20`LLMFrontendNode`=20class.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/llms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/langflow/template/frontend_node/llms.py b/src/backend/langflow/template/frontend_node/llms.py index 703dbacc6..a2a4cb9bb 100644 --- a/src/backend/langflow/template/frontend_node/llms.py +++ b/src/backend/langflow/template/frontend_node/llms.py @@ -21,6 +21,10 @@ class LLMFrontendNode(FrontendNode): if field.name == "openai_api_base": field.info = OPENAI_API_BASE_INFO + def add_extra_base_classes(self) -> None: + if "BaseLLM" not in self.base_classes: + self.base_classes.append("BaseLLM") + @staticmethod def format_azure_field(field: TemplateField): if field.name == "model_name": From 3ced33b6781b93c1d290ce0048f9e0ef802fc008 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 13:07:04 -0300 Subject: [PATCH 50/72] =?UTF-8?q?=F0=9F=94=A7=20chore(base.py):=20add=20me?= =?UTF-8?q?thod=20to=20remove=20unwanted=20base=20classes=20from=20the=20l?= =?UTF-8?q?ist=20of=20base=20classes=20=F0=9F=90=9B=20fix(base.py):=20call?= =?UTF-8?q?=20the=20method=20to=20remove=20unwanted=20base=20classes=20bef?= =?UTF-8?q?ore=20converting=20the=20frontend=20node=20to=20a=20dict=20The?= =?UTF-8?q?=20`process=5Fbase=5Fclasses`=20method=20is=20added=20to=20the?= =?UTF-8?q?=20`FrontendNode`=20class=20to=20remove=20unwanted=20base=20cla?= =?UTF-8?q?sses=20from=20the=20list=20of=20base=20classes.=20This=20method?= =?UTF-8?q?=20iterates=20over=20the=20base=20classes=20and=20filters=20out?= =?UTF-8?q?=20any=20classes=20that=20are=20present=20in=20the=20`CLASSES?= =?UTF-8?q?=5FTO=5FREMOVE`=20list.=20The=20method=20is=20then=20called=20b?= =?UTF-8?q?efore=20converting=20the=20frontend=20node=20to=20a=20dictionar?= =?UTF-8?q?y=20representation=20in=20the=20`to=5Fdict`=20method=20to=20ens?= =?UTF-8?q?ure=20that=20the=20unwanted=20base=20classes=20are=20not=20incl?= =?UTF-8?q?uded=20in=20the=20final=20output.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/backend/langflow/template/frontend_node/base.py b/src/backend/langflow/template/frontend_node/base.py index 0c0c1e06a..de8c78112 100644 --- a/src/backend/langflow/template/frontend_node/base.py +++ b/src/backend/langflow/template/frontend_node/base.py @@ -9,6 +9,8 @@ from langflow.template.template.base import Template from langflow.utils import constants from langflow.template.frontend_node.formatter import field_formatters +CLASSES_TO_REMOVE = ["Serializable", "BaseModel"] + class FieldFormatters(BaseModel): formatters = { @@ -47,6 +49,14 @@ class FrontendNode(BaseModel): documentation: str = "" field_formatters: FieldFormatters = Field(default_factory=FieldFormatters) + def process_base_classes(self) -> None: + """Removes unwanted base classes from the list of base classes.""" + self.base_classes = [ + base_class + for base_class in self.base_classes + if base_class not in CLASSES_TO_REMOVE + ] + # field formatters is an instance attribute but it is not used in the class # so we need to create a method to get it @staticmethod @@ -59,6 +69,7 @@ class FrontendNode(BaseModel): def to_dict(self) -> dict: """Returns a dict representation of the frontend node.""" + self.process_base_classes() return { self.name: { "template": self.template.to_dict(self.format_field), From 7c777bf69206a5aaaa395307d9ba3e8087ca8b42 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Thu, 29 Jun 2023 14:17:55 -0300 Subject: [PATCH 51/72] =?UTF-8?q?=F0=9F=90=9B=20fix(ApiModal/index.tsx):?= =?UTF-8?q?=20fix=20linting=20issues=20and=20improve=20code=20readability?= =?UTF-8?q?=20=E2=9C=A8=20feat(ApiModal/index.tsx):=20add=20support=20for?= =?UTF-8?q?=20displaying=20tweaks=20code=20in=20a=20separate=20tab=20if=20?= =?UTF-8?q?there=20are=20any=20tweaks=20present?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/package-lock.json | 3 +- src/frontend/src/modals/ApiModal/index.tsx | 115 ++++++++++----------- 2 files changed, 57 insertions(+), 61 deletions(-) diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json index a4128b48e..b751823c3 100644 --- a/src/frontend/package-lock.json +++ b/src/frontend/package-lock.json @@ -3563,7 +3563,7 @@ "version": "16.18.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.12.tgz", "integrity": "sha512-vzLe5NaNMjIE3mcddFVGlAXN1LEWueUsMsOJWaT6wWMJGyljHAWHznqfnKUQWGzu7TLPrGvWdNAsvQYW+C0xtw==", - "dev": true + "devOptional": true }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -5633,7 +5633,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 6f0014f33..2377c212b 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -75,6 +75,55 @@ export default function ApiModal({ flow }: { flow: FlowType }) { }, 2000); }); }; + const pythonApiCode = getPythonApiCode(flow, tweak.current); + const curl_code = getCurlCode(flow, tweak.current); + const pythonCode = getPythonCode(flow, tweak.current); + const tweaksCode = buildTweaks(flow); + const tabs = [ + { + name: "cURL", + mode: "bash", + image: "https://curl.se/logo/curl-symbol-transparent.png", + code: curl_code, + }, + { + name: "Python API", + mode: "python", + image: + "https://images.squarespace-cdn.com/content/v1/5df3d8c5d2be5962e4f87890/1628015119369-OY4TV3XJJ53ECO0W2OLQ/Python+API+Training+Logo.png?format=1000w", + code: pythonApiCode, + }, + { + name: "Python Code", + mode: "python", + image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png", + code: pythonCode, + }, + ]; + + useEffect(() => { + if (closeEdit !== "") { + setActiveTab("3"); + tweak.current = getTweak; + openAccordions(); + } else { + startTweaks(); + } + }, [closeEdit]); + + useEffect(() => { + filterNodes(); + }, []); + + if (Object.keys(tweaksCode).length > 0) { + tabs.push({ + name: "Tweaks", + mode: "python", + image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png", + code: pythonCode, + }); + } + function setModalOpen(x: boolean) { setOpen(x); if (x === false) { @@ -84,26 +133,6 @@ export default function ApiModal({ flow }: { flow: FlowType }) { } } - useEffect(() => { - if (closeEdit !== "") { - setActiveTab("3"); - tweak.current = getTweak; - openAccordions(); - } - else{ - startTweaks(); - } - }, [closeEdit]); - - const pythonApiCode = getPythonApiCode(flow, tweak.current); - const curl_code = getCurlCode(flow, tweak.current); - const pythonCode = getPythonCode(flow, tweak.current); - const tweaksCode = buildTweaks(flow); - - useEffect(() => { - filterNodes(); - }, []); - function startTweaks() { tweak.current.push(buildTweaks(flow)); } @@ -135,37 +164,6 @@ export default function ApiModal({ flow }: { flow: FlowType }) { }); } - const tabs = [ - { - name: "cURL", - mode: "bash", - image: "https://curl.se/logo/curl-symbol-transparent.png", - code: curl_code, - }, - { - name: "Python API", - mode: "python", - image: - "https://images.squarespace-cdn.com/content/v1/5df3d8c5d2be5962e4f87890/1628015119369-OY4TV3XJJ53ECO0W2OLQ/Python+API+Training+Logo.png?format=1000w", - code: pythonApiCode, - }, - { - name: "Python Code", - mode: "python", - image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png", - code: pythonCode, - }, - ]; - - if (Object.keys(tweaksCode).length > 0) { - tabs.push({ - name: "Tweaks", - mode: "python", - image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png", - code: pythonCode, - }); - } - function buildTweakObject(tw, changes, template) { if (template.type === "float") { changes = parseFloat(changes); @@ -201,7 +199,6 @@ export default function ApiModal({ flow }: { flow: FlowType }) { }, }; tweak.current.push(newTweak); - } const pythonApiCode = getPythonApiCode(flow, tweak.current); @@ -229,7 +226,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { if (getTweak.length > 0) { for (const obj of getTweak) { - Object.keys(obj).forEach(key =>{ + Object.keys(obj).forEach((key) => { const value = obj[key]; if (key == node["id"]) { Object.keys(value).forEach((key) => { @@ -238,7 +235,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { } }); } - }) + }); } } else { return value ?? ""; @@ -246,16 +243,16 @@ export default function ApiModal({ flow }: { flow: FlowType }) { return returnValue; } - function openAccordions(){ + function openAccordions() { let accordionsToOpen = []; tweak.current.forEach((el) => { Object.keys(el).forEach((key) => { if (Object.keys(el[key]).length > 0) { - accordionsToOpen.push(key) + accordionsToOpen.push(key); setOpenAccordion(accordionsToOpen); } }); - }); + }); } return ( @@ -278,8 +275,8 @@ export default function ApiModal({ flow }: { flow: FlowType }) { className="w-full h-full overflow-hidden text-center bg-muted rounded-md border" onValueChange={(value) => { setActiveTab(value); - if(value === "3"){ - openAccordions() + if (value === "3") { + openAccordions(); } }} > From 473bde940cdff292cfec289a21bffed506b501ca Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 15:17:23 -0300 Subject: [PATCH 52/72] =?UTF-8?q?=F0=9F=90=9B=20fix(loading.py):=20add=20e?= =?UTF-8?q?rror=20handling=20for=20missing=20'cursor'=20attribute=20in=20i?= =?UTF-8?q?nstantiate=5Fmemory=20function=20The=20instantiate=5Fmemory=20f?= =?UTF-8?q?unction=20now=20includes=20error=20handling=20for=20a=20specifi?= =?UTF-8?q?c=20AttributeError=20that=20occurs=20when=20the=20object=20does?= =?UTF-8?q?=20not=20have=20a=20'cursor'=20attribute.=20If=20this=20error?= =?UTF-8?q?=20occurs,=20an=20AttributeError=20is=20raised=20with=20a=20spe?= =?UTF-8?q?cific=20error=20message=20indicating=20a=20failure=20to=20build?= =?UTF-8?q?=20a=20connection=20to=20the=20database.=20This=20change=20impr?= =?UTF-8?q?oves=20the=20error=20handling=20and=20provides=20more=20informa?= =?UTF-8?q?tive=20error=20messages=20for=20debugging=20purposes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../langflow/interface/initialize/loading.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index 65461f141..8503290b1 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -82,10 +82,25 @@ def instantiate_based_on_type(class_object, base_type, node_type, params): return instantiate_llm(node_type, class_object, params) elif base_type == "retrievers": return instantiate_retriever(node_type, class_object, params) + elif base_type == "memory": + return instantiate_memory(node_type, class_object, params) else: return class_object(**params) +def instantiate_memory(node_type, class_object, params): + try: + return class_object(**params) + # I want to catch a specific attribute error that happens + # when the object does not have a cursor attribute + except AttributeError as exc: + if "object has no attribute 'cursor'" in str(exc): + raise AttributeError( + f"Failed to build connection to database. Please check your connection string and try again. Error: {exc}" + ) from exc + raise exc + + def instantiate_retriever(node_type, class_object, params): if "retriever" in params and hasattr(params["retriever"], "as_retriever"): params["retriever"] = params["retriever"].as_retriever() From 9e44720ac87684c09406ae7b6ac864edb38ac630 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 17:38:58 -0300 Subject: [PATCH 53/72] =?UTF-8?q?=F0=9F=94=A7=20chore(config.yaml):=20comm?= =?UTF-8?q?ent=20out=20unused=20integrations=20in=20memories=20and=20retri?= =?UTF-8?q?evers=20sections=20The=20unused=20integrations=20in=20the=20mem?= =?UTF-8?q?ories=20and=20retrievers=20sections=20have=20been=20commented?= =?UTF-8?q?=20out=20to=20improve=20code=20readability=20and=20remove=20unn?= =?UTF-8?q?ecessary=20clutter.=20These=20integrations=20are=20not=20curren?= =?UTF-8?q?tly=20being=20used=20in=20the=20application=20and=20can=20be=20?= =?UTF-8?q?safely=20ignored.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/config.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index 4bb93680f..bc673947e 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -120,8 +120,11 @@ llms: HuggingFaceHub: documentation: "https://python.langchain.com/docs/modules/model_io/models/llms/integrations/huggingface_hub" memories: + # https://github.com/supabase-community/supabase-py/issues/482 + # ZepChatMessageHistory: + # documentation: "https://python.langchain.com/docs/modules/memory/integrations/zep_memory" PostgresChatMessageHistory: - documentation: "https://python.langchain.com/docs/modules/memory/how_to/agent_with_memory_in_db" + documentation: "https://python.langchain.com/docs/modules/memory/integrations/postgres_chat_message_history" ConversationBufferMemory: documentation: "https://python.langchain.com/docs/modules/memory/how_to/buffer" ConversationSummaryMemory: @@ -233,6 +236,9 @@ utilities: retrievers: MultiQueryRetriever: documentation: "https://python.langchain.com/docs/modules/data_connection/retrievers/how_to/MultiQueryRetriever" + # https://github.com/supabase-community/supabase-py/issues/482 + # ZepRetriever: + # documentation: "https://python.langchain.com/docs/modules/data_connection/retrievers/integrations/zep_memorystore" vectorstores: Chroma: documentation: "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/chroma" From 26c42cac05c679ff031ff4e90fc2136742a776c8 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 17:39:12 -0300 Subject: [PATCH 54/72] =?UTF-8?q?=F0=9F=94=A7=20chore(util.py):=20exclude?= =?UTF-8?q?=20"self"=20parameter=20from=20template=20building=20The=20"sel?= =?UTF-8?q?f"=20parameter=20is=20now=20excluded=20from=20the=20template=20?= =?UTF-8?q?building=20process.=20This=20change=20improves=20the=20accuracy?= =?UTF-8?q?=20of=20the=20generated=20template=20by=20removing=20unnecessar?= =?UTF-8?q?y=20information.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/utils/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/langflow/utils/util.py b/src/backend/langflow/utils/util.py index 02a9520b4..486f6c189 100644 --- a/src/backend/langflow/utils/util.py +++ b/src/backend/langflow/utils/util.py @@ -165,6 +165,7 @@ def build_template_from_method( "required": param.default == param.empty, } for name, param in params.items() + if name != "self" }, } From e24ad0513b8bc0ede894565da34b5c1e21be8b90 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 17:39:25 -0300 Subject: [PATCH 55/72] =?UTF-8?q?=F0=9F=94=A7=20chore(memories.py):=20set?= =?UTF-8?q?=20'url'=20field=20to=20be=20shown=20in=20the=20frontend=20The?= =?UTF-8?q?=20'url'=20field=20in=20the=20MemoryFrontendNode=20class=20is?= =?UTF-8?q?=20now=20set=20to=20be=20shown=20in=20the=20frontend.=20This=20?= =?UTF-8?q?change=20allows=20the=20'url'=20field=20to=20be=20visible=20and?= =?UTF-8?q?=20accessible=20to=20users=20in=20the=20frontend=20interface.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/memories.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/langflow/template/frontend_node/memories.py b/src/backend/langflow/template/frontend_node/memories.py index 936bdb8f4..6d9368823 100644 --- a/src/backend/langflow/template/frontend_node/memories.py +++ b/src/backend/langflow/template/frontend_node/memories.py @@ -75,6 +75,8 @@ class MemoryFrontendNode(FrontendNode): field.show = True field.advanced = False field.required = False + if field.name == "url": + field.show = True class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode): From 77cc23bf5fa5f9e731acfc1501405ba2be16746e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 17:39:36 -0300 Subject: [PATCH 56/72] =?UTF-8?q?=F0=9F=90=9B=20fix(base.py):=20fix=20meth?= =?UTF-8?q?od=20name=20in=20build=5Ftemplate=5Ffrom=5Fmethod=20call=20for?= =?UTF-8?q?=20MultiQueryRetriever=20=E2=9C=A8=20feat(base.py):=20add=20sup?= =?UTF-8?q?port=20for=20ZepRetriever=20in=20from=5Fmethod=5Fnodes=20dictio?= =?UTF-8?q?nary=20The=20build=5Ftemplate=5Ffrom=5Fmethod=20call=20for=20th?= =?UTF-8?q?e=20MultiQueryRetriever=20in=20the=20get=5Fsignature=20method?= =?UTF-8?q?=20was=20using=20the=20incorrect=20method=20name=20"from=5Fllm"?= =?UTF-8?q?.=20It=20has=20been=20fixed=20to=20use=20the=20correct=20method?= =?UTF-8?q?=20name=20"from=5Fmethod=5Fnodes".=20Additionally,=20support=20?= =?UTF-8?q?for=20the=20ZepRetriever=20has=20been=20added=20to=20the=20from?= =?UTF-8?q?=5Fmethod=5Fnodes=20dictionary=20to=20allow=20for=20its=20usage?= =?UTF-8?q?=20in=20the=20RetrieverCreator=20class.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../langflow/interface/retrievers/base.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/backend/langflow/interface/retrievers/base.py b/src/backend/langflow/interface/retrievers/base.py index 16f49191e..dc6056656 100644 --- a/src/backend/langflow/interface/retrievers/base.py +++ b/src/backend/langflow/interface/retrievers/base.py @@ -7,13 +7,13 @@ from langflow.interface.importing.utils import import_class from langflow.settings import settings from langflow.template.frontend_node.retrievers import RetrieverFrontendNode from langflow.utils.logger import logger -from langflow.utils.util import build_template_from_method +from langflow.utils.util import build_template_from_method, build_template_from_class class RetrieverCreator(LangChainTypeCreator): type_name: str = "retrievers" - from_method_nodes = {"MultiQueryRetriever": "from_llm"} + from_method_nodes = {"MultiQueryRetriever": "from_llm", "ZepRetriever": "__init__"} @property def frontend_node_class(self) -> Type[RetrieverFrontendNode]: @@ -31,9 +31,16 @@ class RetrieverCreator(LangChainTypeCreator): def get_signature(self, name: str) -> Optional[Dict]: """Get the signature of an embedding.""" try: - return build_template_from_method( - name, type_to_cls_dict=self.type_to_loader_dict, method_name="from_llm" - ) + if name in self.from_method_nodes: + return build_template_from_method( + name, + type_to_cls_dict=self.type_to_loader_dict, + method_name=self.from_method_nodes[name], + ) + else: + return build_template_from_class( + name, type_to_cls_dict=self.type_to_loader_dict + ) except ValueError as exc: raise ValueError(f"Retriever {name} not found") from exc except AttributeError as exc: From 7eeacfbb31b1fe0086503e7f1fe40e2e2ac5e076 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 17:39:46 -0300 Subject: [PATCH 57/72] =?UTF-8?q?=F0=9F=90=9B=20fix(base.py):=20add=20supp?= =?UTF-8?q?ort=20for=20creating=20MemoryFrontendNode=20from=20a=20method?= =?UTF-8?q?=20=E2=9C=A8=20feat(base.py):=20add=20support=20for=20creating?= =?UTF-8?q?=20MemoryFrontendNode=20from=20a=20specific=20method=20in=20Zep?= =?UTF-8?q?ChatMessageHistory=20class=20The=20`MemoryCreator`=20class=20no?= =?UTF-8?q?w=20supports=20creating=20`MemoryFrontendNode`=20from=20a=20spe?= =?UTF-8?q?cific=20method=20in=20the=20`ZepChatMessageHistory`=20class.=20?= =?UTF-8?q?This=20is=20achieved=20by=20adding=20the=20`from=5Fmethod=5Fnod?= =?UTF-8?q?es`=20dictionary=20with=20the=20method=20name=20as=20the=20key?= =?UTF-8?q?=20and=20the=20class=20name=20as=20the=20value.=20The=20`build?= =?UTF-8?q?=5Ftemplate=5Ffrom=5Fmethod`=20function=20is=20used=20to=20crea?= =?UTF-8?q?te=20the=20`MemoryFrontendNode`=20from=20the=20specified=20meth?= =?UTF-8?q?od.=20This=20enhancement=20allows=20for=20more=20flexibility=20?= =?UTF-8?q?in=20creating=20`MemoryFrontendNode`=20instances.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/memories/base.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/interface/memories/base.py b/src/backend/langflow/interface/memories/base.py index a211517f5..4d7f8d5aa 100644 --- a/src/backend/langflow/interface/memories/base.py +++ b/src/backend/langflow/interface/memories/base.py @@ -6,13 +6,15 @@ from langflow.settings import settings from langflow.template.frontend_node.base import FrontendNode from langflow.template.frontend_node.memories import MemoryFrontendNode from langflow.utils.logger import logger -from langflow.utils.util import build_template_from_class +from langflow.utils.util import build_template_from_class, build_template_from_method from langflow.custom.customs import get_custom_nodes class MemoryCreator(LangChainTypeCreator): type_name: str = "memories" + from_method_nodes = {"ZepChatMessageHistory": "__init__"} + @property def frontend_node_class(self) -> Type[FrontendNode]: """The class type of the FrontendNode created in frontend_node.""" @@ -29,6 +31,12 @@ class MemoryCreator(LangChainTypeCreator): try: if name in get_custom_nodes(self.type_name).keys(): return get_custom_nodes(self.type_name)[name] + elif name in self.from_method_nodes: + return build_template_from_method( + name, + type_to_cls_dict=memory_type_to_cls_dict, + method_name=self.from_method_nodes[name], + ) return build_template_from_class(name, memory_type_to_cls_dict) except ValueError as exc: raise ValueError("Memory not found") from exc From f81a835001e9d0e56680d8803b5df52adce609a4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 18:19:22 -0300 Subject: [PATCH 58/72] =?UTF-8?q?=F0=9F=90=9B=20fix(process.py):=20add=20e?= =?UTF-8?q?rror=20handling=20for=20unknown=20langchain=5Fobject=20types=20?= =?UTF-8?q?When=20processing=20the=20data=20graph,=20if=20the=20langchain?= =?UTF-8?q?=5Fobject=20is=20of=20an=20unknown=20type,=20a=20ValueError=20i?= =?UTF-8?q?s=20now=20raised.=20This=20provides=20better=20error=20handling?= =?UTF-8?q?=20and=20helps=20identify=20any=20unexpected=20langchain=5Fobje?= =?UTF-8?q?ct=20types=20that=20may=20be=20encountered=20during=20processin?= =?UTF-8?q?g.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/processing/process.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/langflow/processing/process.py b/src/backend/langflow/processing/process.py index abf7a00b8..e36cbfd8b 100644 --- a/src/backend/langflow/processing/process.py +++ b/src/backend/langflow/processing/process.py @@ -107,6 +107,10 @@ def process_graph_cached(data_graph: Dict[str, Any], inputs: Optional[dict] = No elif isinstance(langchain_object, VectorStore): class_name = langchain_object.__class__.__name__ result = {"message": f"Processed {class_name} successfully"} + else: + raise ValueError( + f"Unknown langchain_object type: {type(langchain_object).__name__}" + ) return result From c834d91efd49272d80a0365354085571a50533fd Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 18:37:33 -0300 Subject: [PATCH 59/72] =?UTF-8?q?=F0=9F=90=9B=20fix(util.py):=20exclude=20?= =?UTF-8?q?"kwargs"=20and=20"args"=20parameters=20from=20the=20generated?= =?UTF-8?q?=20template=20dictionary=20The=20"kwargs"=20and=20"args"=20para?= =?UTF-8?q?meters=20are=20now=20excluded=20from=20the=20generated=20templa?= =?UTF-8?q?te=20dictionary.=20This=20ensures=20that=20only=20the=20relevan?= =?UTF-8?q?t=20parameters=20are=20included=20in=20the=20template,=20improv?= =?UTF-8?q?ing=20the=20accuracy=20and=20usefulness=20of=20the=20generated?= =?UTF-8?q?=20template.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/utils/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/langflow/utils/util.py b/src/backend/langflow/utils/util.py index 486f6c189..4769563bd 100644 --- a/src/backend/langflow/utils/util.py +++ b/src/backend/langflow/utils/util.py @@ -165,7 +165,7 @@ def build_template_from_method( "required": param.default == param.empty, } for name, param in params.items() - if name != "self" + if name not in ["self", "kwargs", "args"] }, } From 6fa295b8a8f7bc17d3f8bd054b6380b2fde4ceec Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 18:37:52 -0300 Subject: [PATCH 60/72] =?UTF-8?q?=F0=9F=90=9B=20fix(memories.py):=20fix=20?= =?UTF-8?q?condition=20to=20add=20extra=20fields=20in=20MemoryFrontendNode?= =?UTF-8?q?=20class=20=E2=9C=A8=20feat(memories.py):=20add=20show=20attrib?= =?UTF-8?q?ute=20to=20entity=5Fstore=20field=20in=20MemoryFrontendNode=20c?= =?UTF-8?q?lass=20The=20condition=20to=20add=20extra=20fields=20in=20the?= =?UTF-8?q?=20MemoryFrontendNode=20class=20has=20been=20fixed=20to=20corre?= =?UTF-8?q?ctly=20check=20if=20any=20of=20the=20base=20classes=20are=20in?= =?UTF-8?q?=20a=20list=20of=20base=20message=20classes.=20Additionally,=20?= =?UTF-8?q?the=20show=20attribute=20has=20been=20added=20to=20the=20entity?= =?UTF-8?q?=5Fstore=20field=20in=20the=20MemoryFrontendNode=20class=20to?= =?UTF-8?q?=20control=20its=20visibility.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/memories.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/template/frontend_node/memories.py b/src/backend/langflow/template/frontend_node/memories.py index 6d9368823..37177c72e 100644 --- a/src/backend/langflow/template/frontend_node/memories.py +++ b/src/backend/langflow/template/frontend_node/memories.py @@ -11,7 +11,8 @@ class MemoryFrontendNode(FrontendNode): def add_extra_fields(self) -> None: # chat history should have another way to add common field? # prevent adding incorect field in ChatMessageHistory - if "BaseChatMessageHistory" in self.base_classes: + base_message_classes = ["BaseEntityStore", "BaseChatMessageHistory"] + if any(base_class in self.base_classes for base_class in base_message_classes): return # add return_messages field @@ -77,6 +78,10 @@ class MemoryFrontendNode(FrontendNode): field.required = False if field.name == "url": field.show = True + if field.name == "entity_store": + field.show = True + if name == "SQLiteEntityStore": + field.show = True class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode): From 4761eda9a046a45f8dbabfb2e430f8e6edfc3448 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 18:38:08 -0300 Subject: [PATCH 61/72] =?UTF-8?q?=F0=9F=94=80=20chore(base.py):=20add=20'S?= =?UTF-8?q?QLiteEntityStore'=20to=20'from=5Fmethod=5Fnodes'=20dictionary?= =?UTF-8?q?=20The=20'from=5Fmethod=5Fnodes'=20dictionary=20in=20the=20'Mem?= =?UTF-8?q?oryCreator'=20class=20in=20'base.py'=20has=20been=20updated=20t?= =?UTF-8?q?o=20include=20the=20'SQLiteEntityStore'=20class=20and=20its=20'?= =?UTF-8?q?=5F=5Finit=5F=5F'=20method.=20This=20change=20allows=20the=20'S?= =?UTF-8?q?QLiteEntityStore'=20class=20to=20be=20used=20as=20a=20memory=20?= =?UTF-8?q?node=20in=20the=20LangFlow=20application.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/memories/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/interface/memories/base.py b/src/backend/langflow/interface/memories/base.py index 4d7f8d5aa..0f97a02fe 100644 --- a/src/backend/langflow/interface/memories/base.py +++ b/src/backend/langflow/interface/memories/base.py @@ -13,7 +13,10 @@ from langflow.custom.customs import get_custom_nodes class MemoryCreator(LangChainTypeCreator): type_name: str = "memories" - from_method_nodes = {"ZepChatMessageHistory": "__init__"} + from_method_nodes = { + "ZepChatMessageHistory": "__init__", + "SQLiteEntityStore": "__init__", + } @property def frontend_node_class(self) -> Type[FrontendNode]: From 08c7bb523097e613dbc84e0d9278e25701f6a915 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 18:38:36 -0300 Subject: [PATCH 62/72] =?UTF-8?q?=F0=9F=90=9B=20fix(loading.py):=20catch?= =?UTF-8?q?=20additional=20exception=20when=20object=20has=20no=20'conn'?= =?UTF-8?q?=20field=20to=20improve=20error=20handling=20The=20code=20now?= =?UTF-8?q?=20catches=20an=20additional=20exception=20when=20the=20object?= =?UTF-8?q?=20does=20not=20have=20a=20'conn'=20field.=20This=20improves=20?= =?UTF-8?q?the=20error=20handling=20by=20providing=20a=20more=20specific?= =?UTF-8?q?=20error=20message=20when=20building=20a=20connection=20to=20th?= =?UTF-8?q?e=20database=20fails.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/initialize/loading.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index 8503290b1..046ca0df6 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -93,8 +93,10 @@ def instantiate_memory(node_type, class_object, params): return class_object(**params) # I want to catch a specific attribute error that happens # when the object does not have a cursor attribute - except AttributeError as exc: - if "object has no attribute 'cursor'" in str(exc): + except Exception as exc: + if "object has no attribute 'cursor'" in str( + exc + ) or 'object has no field "conn"' in str(exc): raise AttributeError( f"Failed to build connection to database. Please check your connection string and try again. Error: {exc}" ) from exc From 2b33334de6699f996547ab457c2c0c4cdc2f061a Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 18:41:23 -0300 Subject: [PATCH 63/72] =?UTF-8?q?=F0=9F=94=92=20chore(poetry.lock):=20upda?= =?UTF-8?q?te=20google-api-python-client=20version=20to=202.91.0=20?= =?UTF-8?q?=F0=9F=94=92=20chore(poetry.lock):=20update=20joblib=20version?= =?UTF-8?q?=20to=201.3.1=20The=20versions=20of=20the=20anthropic,=20google?= =?UTF-8?q?-api-python-client,=20and=20joblib=20packages=20have=20been=20u?= =?UTF-8?q?pdated=20to=20their=20latest=20versions.=20This=20ensures=20tha?= =?UTF-8?q?t=20the=20application=20is=20using=20the=20most=20recent=20bug?= =?UTF-8?q?=20fixes,=20improvements,=20and=20features=20provided=20by=20th?= =?UTF-8?q?ese=20packages.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/poetry.lock b/poetry.lock index c1d7dda7e..a443d85b0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -150,14 +150,14 @@ files = [ [[package]] name = "anthropic" -version = "0.3.0" +version = "0.3.1" description = "Client library for the anthropic API" category = "main" optional = false python-versions = ">=3.7,<4.0" files = [ - {file = "anthropic-0.3.0-py3-none-any.whl", hash = "sha256:13d1d5eb6c835dfa79922eef66589d602c09294105a2951bc7f4284a0581090c"}, - {file = "anthropic-0.3.0.tar.gz", hash = "sha256:e239046e9276486391152f147c81d990b226facd4434ad968585912ffff4e031"}, + {file = "anthropic-0.3.1-py3-none-any.whl", hash = "sha256:bbb534e81018aa756fc4cc79b76b802871c99743a309aa3278f955999aa62d08"}, + {file = "anthropic-0.3.1.tar.gz", hash = "sha256:6714ae9192721278189bc619364b52bf42fd00d35f22172b9f8e4090382399ed"}, ] [package.dependencies] @@ -1606,14 +1606,14 @@ grpcio-gcp = ["grpcio-gcp (>=0.2.2,<1.0.dev0)"] [[package]] name = "google-api-python-client" -version = "2.90.0" +version = "2.91.0" description = "Google API Client Library for Python" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "google-api-python-client-2.90.0.tar.gz", hash = "sha256:cbcb3ba8be37c6806676a49df16ac412077e5e5dc7fa967941eff977b31fba03"}, - {file = "google_api_python_client-2.90.0-py2.py3-none-any.whl", hash = "sha256:4a41ffb7797d4f28e44635fb1e7076240b741c6493e7c3233c0e4421cec7c913"}, + {file = "google-api-python-client-2.91.0.tar.gz", hash = "sha256:d9385ad6e7f95eecd40f7c81e3abfe4b6ad3a84f2c16bcdb66fb7b8dd814ed56"}, + {file = "google_api_python_client-2.91.0-py2.py3-none-any.whl", hash = "sha256:6959d21d4b20c0f65c69662ca7b6a8a02fc08f3e7f72d70b28ae3e6e3a5f9ab2"}, ] [package.dependencies] @@ -2584,14 +2584,14 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "joblib" -version = "1.3.0" +version = "1.3.1" description = "Lightweight pipelining with Python functions" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "joblib-1.3.0-py3-none-any.whl", hash = "sha256:172d56d4c43dd6bcd953bea213018c4084cf754963bbf54b8dae40faea716b98"}, - {file = "joblib-1.3.0.tar.gz", hash = "sha256:0b12a65dc76c530dbd790dd92881f75c40932b4254a7c8e608a868df408ca0a3"}, + {file = "joblib-1.3.1-py3-none-any.whl", hash = "sha256:89cf0529520e01b3de7ac7b74a8102c90d16d54c64b5dd98cafcd14307fdf915"}, + {file = "joblib-1.3.1.tar.gz", hash = "sha256:1f937906df65329ba98013dc9692fe22a4c5e4a648112de500508b18a21b41e3"}, ] [[package]] @@ -7500,4 +7500,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "3875f61e1228dfac1574076a6c3755703463fa6ed1fe737d064a171be94259d4" +content-hash = "e3d0c8e7e89bf23d24b13e187f49a7d1b2dd273cd823f2adff33762190f79bb8" From fdb998688a6603a9ad404ee9652e9085542933f8 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Thu, 29 Jun 2023 18:42:09 -0300 Subject: [PATCH 64/72] =?UTF-8?q?=F0=9F=90=9B=20fix(codeAreaComponent):=20?= =?UTF-8?q?update=20initial=20state=20of=20myValue=20to=20handle=20non-str?= =?UTF-8?q?ing=20values=20properly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 fix(constants.tsx): refactor getCurlCode and getPythonCode to use buildTweakObject function for generating tweak object 🐛 fix(ApiModal): update logic for opening accordions based on tweak.current length and closeEdit value --- .../components/codeAreaComponent/index.tsx | 4 +-- src/frontend/src/constants.tsx | 25 ++++++++++++++++--- src/frontend/src/modals/ApiModal/index.tsx | 23 ++++++++++------- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index 6fec7cd27..ff786ea99 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -12,7 +12,7 @@ export default function CodeAreaComponent({ disabled, editNode = false, }: TextAreaComponentType) { - const [myValue, setMyValue] = useState(value); + const [myValue, setMyValue] = useState(typeof value == "string" ? value : JSON.stringify(value)); const { openPopUp } = useContext(PopUpContext); useEffect(() => { if (disabled) { @@ -22,7 +22,7 @@ export default function CodeAreaComponent({ }, [disabled, onChange]); useEffect(() => { - setMyValue(value); + setMyValue(typeof value == "string" ? value : JSON.stringify(value)); }, [value]); return ( diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index 9bfb4bcd5..a20e5c6c1 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -71,7 +71,7 @@ FLOW_ID = "${flowId}" # You can tweak the flow by adding a tweaks dictionary # e.g {"OpenAI-XXXXX": {"model_name": "gpt-4"}} TWEAKS = ${ - tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2).replace(/\\/g, '') : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 ? buildTweakObject(tweak): JSON.stringify(tweaks, null, 2) } def run_flow(message: str, flow_id: str, tweaks: dict = None) -> dict: @@ -111,7 +111,7 @@ export const getCurlCode = (flow: FlowType, tweak?): string => { }/api/v1/process/${flowId} \\ -H 'Content-Type: application/json' \\ -d '{"inputs": {"input": message}, "tweaks": ${ - tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2).replace(/\\/g, '') : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 ? buildTweakObject(tweak) : JSON.stringify(tweaks, null, 2) }}'`; }; /** @@ -124,13 +124,32 @@ export const getPythonCode = (flow: FlowType, tweak?): string => { const tweaks = buildTweaks(flow); return `from langflow import load_flow_from_json TWEAKS = ${ - tweak && tweak.length > 0 ? JSON.stringify(tweak, null, 2).replace(/\\/g, '') : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 ? buildTweakObject(tweak) : JSON.stringify(tweaks, null, 2) } flow = load_flow_from_json("${flowName}.json", tweaks=TWEAKS) # Now you can use it like any chain flow("Hey, have you heard of LangFlow?")`; }; +function buildTweakObject(tweak){ + tweak.forEach(el => { + Object.keys(el).forEach(key => { + for (let kp in el[key]) { + try{ + el[key][kp] = JSON.parse(el[key][kp]); + console.log(el[key][kp]); + } + catch{} + } + }) + }); + + const tweakString = JSON.stringify(tweak, null, 2); + console.log(tweakString); + + return tweakString; +} + /** * The base text for subtitle of Import Dialog * @constant diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 2377c212b..545a26d01 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -103,9 +103,14 @@ export default function ApiModal({ flow }: { flow: FlowType }) { useEffect(() => { if (closeEdit !== "") { - setActiveTab("3"); tweak.current = getTweak; - openAccordions(); + if(tweak.current.length > 0){ + setActiveTab("3"); + openAccordions(); + } + else{ + startTweaks(); + } } else { startTweaks(); } @@ -245,14 +250,14 @@ export default function ApiModal({ flow }: { flow: FlowType }) { function openAccordions() { let accordionsToOpen = []; - tweak.current.forEach((el) => { - Object.keys(el).forEach((key) => { - if (Object.keys(el[key]).length > 0) { - accordionsToOpen.push(key); - setOpenAccordion(accordionsToOpen); - } + tweak.current.forEach((el) => { + Object.keys(el).forEach((key) => { + if (Object.keys(el[key]).length > 0) { + accordionsToOpen.push(key); + setOpenAccordion(accordionsToOpen); + } + }); }); - }); } return ( From 82c469d3c29e24fe9c8e40127a46c271479f8714 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Thu, 29 Jun 2023 18:42:40 -0300 Subject: [PATCH 65/72] =?UTF-8?q?=F0=9F=94=A5=20refactor(constants.tsx):?= =?UTF-8?q?=20remove=20console.log=20statements=20for=20better=20code=20cl?= =?UTF-8?q?eanliness=20and=20performance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/constants.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index a20e5c6c1..b4a275d17 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -137,7 +137,6 @@ function buildTweakObject(tweak){ for (let kp in el[key]) { try{ el[key][kp] = JSON.parse(el[key][kp]); - console.log(el[key][kp]); } catch{} } @@ -145,8 +144,6 @@ function buildTweakObject(tweak){ }); const tweakString = JSON.stringify(tweak, null, 2); - console.log(tweakString); - return tweakString; } From 4f9466288101fb9017f72c55bc6138d173881979 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 18:43:24 -0300 Subject: [PATCH 66/72] =?UTF-8?q?=F0=9F=93=9D=20docs(config.yaml):=20add?= =?UTF-8?q?=20documentation=20for=20ConversationEntityMemory=20integration?= =?UTF-8?q?=20The=20ConversationEntityMemory=20integration=20is=20now=20do?= =?UTF-8?q?cumented=20in=20the=20config.yaml=20file.=20This=20provides=20a?= =?UTF-8?q?=20link=20to=20the=20documentation=20for=20using=20the=20Conver?= =?UTF-8?q?sationEntityMemory=20module=20with=20SQLite=20as=20the=20underl?= =?UTF-8?q?ying=20storage.=20This=20change=20improves=20the=20clarity=20an?= =?UTF-8?q?d=20accessibility=20of=20the=20documentation=20for=20this=20int?= =?UTF-8?q?egration.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index bc673947e..8d60876fa 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -123,6 +123,11 @@ memories: # https://github.com/supabase-community/supabase-py/issues/482 # ZepChatMessageHistory: # documentation: "https://python.langchain.com/docs/modules/memory/integrations/zep_memory" + ConversationEntityMemory: + documentation: "https://python.langchain.com/docs/modules/memory/integrations/entity_memory_with_sqlite" + # https://github.com/hwchase17/langchain/issues/6091 + # SQLiteEntityStore: + # documentation: "https://python.langchain.com/docs/modules/memory/integrations/entity_memory_with_sqlite" PostgresChatMessageHistory: documentation: "https://python.langchain.com/docs/modules/memory/integrations/postgres_chat_message_history" ConversationBufferMemory: From eb53798c4121ddf6bc628ed636fe36d30d18f763 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 18:43:37 -0300 Subject: [PATCH 67/72] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.ts):=20update=20?= =?UTF-8?q?color=20code=20for=20"retrievers"=20in=20nodeColors=20object=20?= =?UTF-8?q?The=20color=20code=20for=20the=20"retrievers"=20category=20in?= =?UTF-8?q?=20the=20nodeColors=20object=20has=20been=20updated=20from=20"#?= =?UTF-8?q?F5B85A"=20to=20"#e6b25a".=20This=20change=20was=20made=20to=20e?= =?UTF-8?q?nsure=20consistency=20and=20improve=20the=20visual=20representa?= =?UTF-8?q?tion=20of=20the=20"retrievers"=20category.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/utils.ts b/src/frontend/src/utils.ts index d8198ec3d..b50cad2bd 100644 --- a/src/frontend/src/utils.ts +++ b/src/frontend/src/utils.ts @@ -122,7 +122,7 @@ export const nodeColors: { [char: string]: string } = { toolkits: "#DB2C2C", wrappers: "#E6277A", utilities: "#31A3CC", - retrievers: "#F5B85A", + retrievers: "#e6b25a", unknown: "#9CA3AF", }; From b188400517c6124f439fe649d432dc8109b2bff4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 19:36:04 -0300 Subject: [PATCH 68/72] =?UTF-8?q?=F0=9F=90=9B=20fix(loading.py):=20improve?= =?UTF-8?q?=20error=20message=20formatting=20when=20failing=20to=20build?= =?UTF-8?q?=20connection=20to=20database=20=F0=9F=90=9B=20fix(base.py):=20?= =?UTF-8?q?add=20optional=20'name'=20parameter=20to=20the=20format=20metho?= =?UTF-8?q?d=20in=20FieldFormatter=20In=20loading.py,=20the=20error=20mess?= =?UTF-8?q?age=20when=20failing=20to=20build=20a=20connection=20to=20the?= =?UTF-8?q?=20database=20is=20now=20formatted=20in=20a=20more=20readable?= =?UTF-8?q?=20way.=20This=20improves=20the=20clarity=20of=20the=20error=20?= =?UTF-8?q?message=20and=20makes=20it=20easier=20to=20identify=20the=20cau?= =?UTF-8?q?se=20of=20the=20issue.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In base.py, the format method in FieldFormatter now accepts an optional 'name' parameter. This allows for more flexibility when formatting the field and provides the ability to include the field name in the formatting process if needed. --- src/backend/langflow/interface/initialize/loading.py | 5 ++++- .../langflow/template/frontend_node/formatter/base.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index 046ca0df6..08d17d9fa 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -98,7 +98,10 @@ def instantiate_memory(node_type, class_object, params): exc ) or 'object has no field "conn"' in str(exc): raise AttributeError( - f"Failed to build connection to database. Please check your connection string and try again. Error: {exc}" + ( + "Failed to build connection to database." + f" Please check your connection string and try again. Error: {exc}" + ) ) from exc raise exc diff --git a/src/backend/langflow/template/frontend_node/formatter/base.py b/src/backend/langflow/template/frontend_node/formatter/base.py index 653480e03..67e906593 100644 --- a/src/backend/langflow/template/frontend_node/formatter/base.py +++ b/src/backend/langflow/template/frontend_node/formatter/base.py @@ -1,9 +1,10 @@ from abc import ABC, abstractmethod +from typing import Optional from langflow.template.field.base import TemplateField class FieldFormatter(ABC): @abstractmethod - def format(self, field: TemplateField): + def format(self, field: TemplateField, name: Optional[str]) -> None: pass From 60032d614626a8d416411f54ab6f9c0c78ca3182 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 19:36:22 -0300 Subject: [PATCH 69/72] =?UTF-8?q?=F0=9F=90=9B=20fix(AccordionComponent):?= =?UTF-8?q?=20fix=20formatting=20and=20add=20missing=20semicolons=20to=20i?= =?UTF-8?q?mprove=20code=20readability=20and=20maintainability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(codeAreaComponent):=20fix=20formatting=20and?= =?UTF-8?q?=20add=20missing=20semicolons=20to=20improve=20code=20readabili?= =?UTF-8?q?ty=20and=20maintainability=20=F0=9F=90=9B=20fix(dropdownCompone?= =?UTF-8?q?nt):=20fix=20formatting=20and=20add=20missing=20semicolons=20to?= =?UTF-8?q?=20improve=20code=20readability=20and=20maintainability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(floatComponent):=20fix=20formatting=20and=20?= =?UTF-8?q?add=20missing=20semicolons=20to=20improve=20code=20readability?= =?UTF-8?q?=20and=20maintainability=20=F0=9F=90=9B=20fix(inputFileComponen?= =?UTF-8?q?t):=20fix=20formatting=20and=20add=20missing=20semicolons=20to?= =?UTF-8?q?=20improve=20code=20readability=20and=20maintainability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(inputListComponent):=20fix=20formatting=20an?= =?UTF-8?q?d=20add=20missing=20semicolons=20to=20improve=20code=20readabil?= =?UTF-8?q?ity=20and=20maintainability=20=F0=9F=90=9B=20fix(intComponent):?= =?UTF-8?q?=20fix=20formatting=20and=20add=20missing=20semicolons=20to=20i?= =?UTF-8?q?mprove=20code=20readability=20and=20maintainability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(promptComponent):=20fix=20formatting=20and?= =?UTF-8?q?=20add=20missing=20semicolons=20to=20improve=20code=20readabili?= =?UTF-8?q?ty=20and=20maintainability=20=F0=9F=90=9B=20fix(textAreaCompone?= =?UTF-8?q?nt):=20fix=20formatting=20and=20add=20missing=20semicolons=20to?= =?UTF-8?q?=20improve=20code=20readability=20and=20maintainability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(ui/accordion.tsx):=20fix=20formatting=20and?= =?UTF-8?q?=20add=20missing=20semicolons=20to=20improve=20code=20readabili?= =?UTF-8?q?ty=20and=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The changes were made to fix formatting issues and add missing semicolons in the code. This improves code readability and maintainability, making it easier for developers to understand and work with the code. 🐛 fix(constants.tsx): fix formatting and indentation issues in the buildTweakObject function 🐛 fix(popUpContext.tsx): remove unnecessary empty line 🐛 fix(tabsContext.tsx): remove unnecessary empty line 🐛 fix(ApiModal/index.tsx): fix formatting and indentation issues 🐛 fix(codeAreaModal/index.tsx): fix formatting and indentation issues 🐛 fix(types/components/index.ts): remove unnecessary empty line The changes in constants.tsx fix formatting and indentation issues in the buildTweakObject function to improve code readability. The changes in popUpContext.tsx, tabsContext.tsx, ApiModal/index.tsx, codeAreaModal/index.tsx, and types/components/index.ts fix formatting and indentation issues to ensure consistent code style. --- .../components/AccordionComponent/index.tsx | 14 +++++----- .../components/codeAreaComponent/index.tsx | 7 +++-- .../components/dropdownComponent/index.tsx | 12 ++++----- .../src/components/floatComponent/index.tsx | 3 ++- .../components/inputFileComponent/index.tsx | 3 ++- .../components/inputListComponent/index.tsx | 7 ++--- .../src/components/intComponent/index.tsx | 3 ++- .../src/components/promptComponent/index.tsx | 3 ++- .../components/textAreaComponent/index.tsx | 3 ++- src/frontend/src/components/ui/accordion.tsx | 27 +++++++++---------- src/frontend/src/constants.tsx | 27 +++++++++++-------- src/frontend/src/contexts/popUpContext.tsx | 6 ++--- src/frontend/src/contexts/tabsContext.tsx | 2 +- src/frontend/src/modals/ApiModal/index.tsx | 19 +++++++------ .../src/modals/codeAreaModal/index.tsx | 2 +- src/frontend/src/types/components/index.ts | 3 +-- 16 files changed, 76 insertions(+), 65 deletions(-) diff --git a/src/frontend/src/components/AccordionComponent/index.tsx b/src/frontend/src/components/AccordionComponent/index.tsx index 825a2c19d..f03a2ad5f 100644 --- a/src/frontend/src/components/AccordionComponent/index.tsx +++ b/src/frontend/src/components/AccordionComponent/index.tsx @@ -17,15 +17,17 @@ export default function AccordionComponent({ children, open = [], }: AccordionComponentType) { - const [value, setValue] = useState(open.length == 0 ? "" : getOpenAccordion()); + const [value, setValue] = useState( + open.length == 0 ? "" : getOpenAccordion() + ); - function getOpenAccordion(){ + function getOpenAccordion() { let value = ""; - open.forEach(el => { - if(el == trigger){ + open.forEach((el) => { + if (el == trigger) { value = trigger; - } - }) + } + }); return value; } diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index ff786ea99..b42f1489b 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -12,7 +12,9 @@ export default function CodeAreaComponent({ disabled, editNode = false, }: TextAreaComponentType) { - const [myValue, setMyValue] = useState(typeof value == "string" ? value : JSON.stringify(value)); + const [myValue, setMyValue] = useState( + typeof value == "string" ? value : JSON.stringify(value) + ); const { openPopUp } = useContext(PopUpContext); useEffect(() => { if (disabled) { @@ -47,7 +49,8 @@ export default function CodeAreaComponent({ className={ editNode ? "truncate cursor-pointer placeholder:text-center text-gray-500 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 border-1 shadow-sm sm:text-sm" + - INPUT_STYLE + (disabled ? " bg-gray-200 " : "") + INPUT_STYLE + + (disabled ? " bg-gray-200 " : "") : "truncate block w-full text-gray-500 px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm sm:text-sm" + INPUT_STYLE + (disabled ? " bg-gray-200" : "") diff --git a/src/frontend/src/components/dropdownComponent/index.tsx b/src/frontend/src/components/dropdownComponent/index.tsx index d1292525d..fab9cad93 100644 --- a/src/frontend/src/components/dropdownComponent/index.tsx +++ b/src/frontend/src/components/dropdownComponent/index.tsx @@ -13,7 +13,7 @@ export default function Dropdown({ onSelect, editNode = false, numberOfOptions = 0, - apiModal = false + apiModal = false, }: DropDownComponentType) { const { closePopUp } = useContext(PopUpContext); @@ -67,14 +67,12 @@ export default function Dropdown({ leaveTo="opacity-0" > {options.map((option, id) => ( , @@ -17,8 +16,8 @@ const AccordionItem = React.forwardRef< className={cn("border-b", className)} {...props} /> -)) -AccordionItem.displayName = "AccordionItem" +)); +AccordionItem.displayName = "AccordionItem"; const AccordionTrigger = React.forwardRef< React.ElementRef, @@ -37,8 +36,8 @@ const AccordionTrigger = React.forwardRef< -)) -AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName +)); +AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName; const AccordionContent = React.forwardRef< React.ElementRef, @@ -54,7 +53,7 @@ const AccordionContent = React.forwardRef< >
{children}
-)) -AccordionContent.displayName = AccordionPrimitive.Content.displayName +)); +AccordionContent.displayName = AccordionPrimitive.Content.displayName; -export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } +export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }; diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index b4a275d17..49eb583b7 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -71,7 +71,9 @@ FLOW_ID = "${flowId}" # You can tweak the flow by adding a tweaks dictionary # e.g {"OpenAI-XXXXX": {"model_name": "gpt-4"}} TWEAKS = ${ - tweak && tweak.length > 0 ? buildTweakObject(tweak): JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 + ? buildTweakObject(tweak) + : JSON.stringify(tweaks, null, 2) } def run_flow(message: str, flow_id: str, tweaks: dict = None) -> dict: @@ -111,7 +113,9 @@ export const getCurlCode = (flow: FlowType, tweak?): string => { }/api/v1/process/${flowId} \\ -H 'Content-Type: application/json' \\ -d '{"inputs": {"input": message}, "tweaks": ${ - tweak && tweak.length > 0 ? buildTweakObject(tweak) : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 + ? buildTweakObject(tweak) + : JSON.stringify(tweaks, null, 2) }}'`; }; /** @@ -124,25 +128,26 @@ export const getPythonCode = (flow: FlowType, tweak?): string => { const tweaks = buildTweaks(flow); return `from langflow import load_flow_from_json TWEAKS = ${ - tweak && tweak.length > 0 ? buildTweakObject(tweak) : JSON.stringify(tweaks, null, 2) + tweak && tweak.length > 0 + ? buildTweakObject(tweak) + : JSON.stringify(tweaks, null, 2) } flow = load_flow_from_json("${flowName}.json", tweaks=TWEAKS) # Now you can use it like any chain flow("Hey, have you heard of LangFlow?")`; }; -function buildTweakObject(tweak){ - tweak.forEach(el => { - Object.keys(el).forEach(key => { +function buildTweakObject(tweak) { + tweak.forEach((el) => { + Object.keys(el).forEach((key) => { for (let kp in el[key]) { - try{ + try { el[key][kp] = JSON.parse(el[key][kp]); - } - catch{} + } catch {} } - }) + }); }); - + const tweakString = JSON.stringify(tweak, null, 2); return tweakString; } diff --git a/src/frontend/src/contexts/popUpContext.tsx b/src/frontend/src/contexts/popUpContext.tsx index a59eb0f9f..d46f51f00 100644 --- a/src/frontend/src/contexts/popUpContext.tsx +++ b/src/frontend/src/contexts/popUpContext.tsx @@ -13,7 +13,6 @@ interface PopUpProviderProps { children: React.ReactNode; } - const PopUpProvider = ({ children }: PopUpProviderProps) => { const [popUpElements, setPopUpElements] = useState([]); @@ -27,9 +26,10 @@ const PopUpProvider = ({ children }: PopUpProviderProps) => { const [closeEdit, setCloseEdit] = useState(""); - return ( - + {children} {popUpElements[0]} diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 5ce455273..3b20ded95 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -648,7 +648,7 @@ export function TabsProvider({ children }: { children: ReactNode }) { setTabsState, paste, getTweak, - setTweak + setTweak, }} > {children} diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 545a26d01..5acd42ec0 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -104,11 +104,10 @@ export default function ApiModal({ flow }: { flow: FlowType }) { useEffect(() => { if (closeEdit !== "") { tweak.current = getTweak; - if(tweak.current.length > 0){ + if (tweak.current.length > 0) { setActiveTab("3"); openAccordions(); - } - else{ + } else { startTweaks(); } } else { @@ -250,14 +249,14 @@ export default function ApiModal({ flow }: { flow: FlowType }) { function openAccordions() { let accordionsToOpen = []; - tweak.current.forEach((el) => { - Object.keys(el).forEach((key) => { - if (Object.keys(el[key]).length > 0) { - accordionsToOpen.push(key); - setOpenAccordion(accordionsToOpen); - } - }); + tweak.current.forEach((el) => { + Object.keys(el).forEach((key) => { + if (Object.keys(el[key]).length > 0) { + accordionsToOpen.push(key); + setOpenAccordion(accordionsToOpen); + } }); + }); } return ( diff --git a/src/frontend/src/modals/codeAreaModal/index.tsx b/src/frontend/src/modals/codeAreaModal/index.tsx index ec6d3d07c..bc814a9ab 100644 --- a/src/frontend/src/modals/codeAreaModal/index.tsx +++ b/src/frontend/src/modals/codeAreaModal/index.tsx @@ -34,7 +34,7 @@ export default function CodeAreaModal({ const [code, setCode] = useState(value); const { dark } = useContext(darkContext); const { setErrorData, setSuccessData } = useContext(alertContext); - const { closePopUp,setCloseEdit } = useContext(PopUpContext); + const { closePopUp, setCloseEdit } = useContext(PopUpContext); const ref = useRef(); function setModalOpen(x: boolean) { setOpen(x); diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts index 4437f48e3..598f2af41 100644 --- a/src/frontend/src/types/components/index.ts +++ b/src/frontend/src/types/components/index.ts @@ -44,7 +44,6 @@ export type InputListComponentType = { disabled: boolean; editNode?: boolean; onAddInput?: (value?: string[]) => void; - }; export type TextAreaComponentType = { @@ -114,7 +113,7 @@ export type RadialProgressType = { color?: string; }; -export type AccordionComponentType = { +export type AccordionComponentType = { children?: ReactElement; open?: string[]; trigger?: string; From 9fe13ca52da28982789ee309d098d1669f4e7ed8 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 19:46:08 -0300 Subject: [PATCH 70/72] =?UTF-8?q?=F0=9F=94=80=20chore(test=5Fllms=5Ftempla?= =?UTF-8?q?te.py):=20rename=20base=20class=20from=20"Serializable"=20to=20?= =?UTF-8?q?"BaseLLM"=20for=20clarity=20and=20consistency=20The=20base=20cl?= =?UTF-8?q?ass=20"Serializable"=20has=20been=20renamed=20to=20"BaseLLM"=20?= =?UTF-8?q?to=20provide=20a=20more=20descriptive=20and=20consistent=20name?= =?UTF-8?q?=20for=20the=20class.=20This=20change=20improves=20clarity=20an?= =?UTF-8?q?d=20maintainability=20of=20the=20code.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_llms_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_llms_template.py b/tests/test_llms_template.py index 859b722e1..7679ba9c0 100644 --- a/tests/test_llms_template.py +++ b/tests/test_llms_template.py @@ -516,7 +516,7 @@ def test_chat_open_ai(client: TestClient): == "Wrapper around OpenAI Chat large language models." # noqa E501 ) assert set(model["base_classes"]) == { - "Serializable", + "BaseLLM", "BaseChatModel", "ChatOpenAI", "BaseLanguageModel", From ca32bc3ab544dbf79b724ddb0d220d73f8ff7952 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 19:46:33 -0300 Subject: [PATCH 71/72] =?UTF-8?q?=F0=9F=93=A6=20chore(poetry.lock):=20upda?= =?UTF-8?q?te=20strenum=20package=20version=20to=200.4.15=20The=20strenum?= =?UTF-8?q?=20package=20has=20been=20updated=20from=20version=200.4.12=20t?= =?UTF-8?q?o=20version=200.4.15.=20This=20update=20may=20include=20bug=20f?= =?UTF-8?q?ixes,=20performance=20improvements,=20or=20new=20features.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index a443d85b0..e8bf033b7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -6171,14 +6171,14 @@ typing-extensions = ">=4.2.0,<5.0.0" [[package]] name = "strenum" -version = "0.4.12" +version = "0.4.15" description = "An Enum that inherits from str." category = "main" optional = false python-versions = "*" files = [ - {file = "StrEnum-0.4.12-py3-none-any.whl", hash = "sha256:d75cdebe07e2537989a925089a248673a34e8a6e9d8fe6846fd04b1aa2e1f44f"}, - {file = "StrEnum-0.4.12.tar.gz", hash = "sha256:75e234fea070aabae9b03b63385880e286defdcdf6fb2933cde4f964f7763544"}, + {file = "StrEnum-0.4.15-py3-none-any.whl", hash = "sha256:a30cda4af7cc6b5bf52c8055bc4bf4b2b6b14a93b574626da33df53cf7740659"}, + {file = "StrEnum-0.4.15.tar.gz", hash = "sha256:878fb5ab705442070e4dd1929bb5e2249511c0bcf2b0eeacf3bcd80875c82eff"}, ] [package.extras] @@ -7500,4 +7500,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "e3d0c8e7e89bf23d24b13e187f49a7d1b2dd273cd823f2adff33762190f79bb8" +content-hash = "3875f61e1228dfac1574076a6c3755703463fa6ed1fe737d064a171be94259d4" From 606779f2164f6dbb9d9d29de618b875cb1f6b23c Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 20:43:52 -0300 Subject: [PATCH 72/72] =?UTF-8?q?=F0=9F=94=96=20chore(pyproject.toml):=20u?= =?UTF-8?q?pdate=20package=20version=20to=200.2.7=20The=20package=20versio?= =?UTF-8?q?n=20has=20been=20updated=20from=200.2.6=20to=200.2.7.=20This=20?= =?UTF-8?q?change=20is=20made=20to=20reflect=20the=20latest=20changes=20an?= =?UTF-8?q?d=20improvements=20in=20the=20package.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 764948765..e606cf828 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "0.2.6" +version = "0.2.7" description = "A Python package with a built-in web application" authors = ["Logspace "] maintainers = [