From 27a084cf1b32f2a52a87b389b4a6bbd8dd8525c6 Mon Sep 17 00:00:00 2001 From: melih-unsal Date: Thu, 21 Sep 2023 00:28:21 +0300 Subject: [PATCH] document loader bug fixed --- demogpt/chains/prompts/task_list/ui_input_file.py | 2 ++ demogpt/chains/task_chains.py | 1 - pyproject.toml | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demogpt/chains/prompts/task_list/ui_input_file.py b/demogpt/chains/prompts/task_list/ui_input_file.py index a5dea53..8bce075 100644 --- a/demogpt/chains/prompts/task_list/ui_input_file.py +++ b/demogpt/chains/prompts/task_list/ui_input_file.py @@ -8,6 +8,8 @@ with tempfile.NamedTemporaryFile(delete=False) as temp_file: temp_file.write(uploaded_file.read()) {variable} = temp_file.name # it shows the file path +else: + {variable} = '' Suppose that, streamlit has been imported by "import streamlit as st" so you don't need to import it. Here is the part of the code that you are supposed to continue: diff --git a/demogpt/chains/task_chains.py b/demogpt/chains/task_chains.py index c16c55e..8814c01 100644 --- a/demogpt/chains/task_chains.py +++ b/demogpt/chains/task_chains.py @@ -190,7 +190,6 @@ def docLoad(cls, task, code_snippets): def stringToDoc(cls, task, code_snippets): argument = task["input_key"] variable = task["output_key"] - code = f'{variable} = "".join([doc.page_content for doc in {argument}])' code = f""" from langchain.docstore.document import Document {variable} = [Document(page_content={argument}, metadata={{'source': 'local'}})] diff --git a/pyproject.toml b/pyproject.toml index 993ba74..708235a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,6 @@ openai = "*" python-dotenv = "*" unstructured = "*" pdf2image = "*" -pdfminer = "*" pdfminer-six = "*" [tool.poetry.dev-dependencies]