Update app.py
Browse files
app.py
CHANGED
|
@@ -42,7 +42,8 @@ import database as db # python文件同目录下的.py程序,直接导入。
|
|
| 42 |
import deta
|
| 43 |
from langchain.chat_models import ChatOpenAI
|
| 44 |
from llama_index import StorageContext, load_index_from_storage, GPTVectorStoreIndex, LLMPredictor, PromptHelper
|
| 45 |
-
from llama_index import ServiceContext, QuestionAnswerPrompt
|
|
|
|
| 46 |
import sys
|
| 47 |
import time
|
| 48 |
import PyPDF2 ## read the local_KB PDF file.
|
|
@@ -305,7 +306,7 @@ def localKB_mode(username):
|
|
| 305 |
"Given all this information, please answer the following questions,"
|
| 306 |
"You MUST use the SAME language as the question:\n"
|
| 307 |
"{query_str}\n")
|
| 308 |
-
QA_PROMPT = QuestionAnswerPrompt(QA_PROMPT_TMPL)
|
| 309 |
# print('QA_PROMPT:', QA_PROMPT)
|
| 310 |
|
| 311 |
# llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0.8, model_name="gpt-3.5-turbo", max_tokens=4024,streaming=True))
|
|
|
|
| 42 |
import deta
|
| 43 |
from langchain.chat_models import ChatOpenAI
|
| 44 |
from llama_index import StorageContext, load_index_from_storage, GPTVectorStoreIndex, LLMPredictor, PromptHelper
|
| 45 |
+
# from llama_index import ServiceContext, QuestionAnswerPrompt ## QuestionAnswerPrompt在新版本中有import错。
|
| 46 |
+
from llama_index import ServiceContext
|
| 47 |
import sys
|
| 48 |
import time
|
| 49 |
import PyPDF2 ## read the local_KB PDF file.
|
|
|
|
| 306 |
"Given all this information, please answer the following questions,"
|
| 307 |
"You MUST use the SAME language as the question:\n"
|
| 308 |
"{query_str}\n")
|
| 309 |
+
# QA_PROMPT = QuestionAnswerPrompt(QA_PROMPT_TMPL)
|
| 310 |
# print('QA_PROMPT:', QA_PROMPT)
|
| 311 |
|
| 312 |
# llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0.8, model_name="gpt-3.5-turbo", max_tokens=4024,streaming=True))
|