Spaces:
Runtime error
Runtime error
moved system_template definition above onchat_start
Browse files
app.py
CHANGED
@@ -84,7 +84,16 @@ reranker = FlagEmbeddingReranker(
|
|
84 |
model="BAAI/bge-reranker-large",
|
85 |
)
|
86 |
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
def resursive_fn(reranker):
|
89 |
recursive_query_engine = recursive_index_faiss.as_query_engine(
|
90 |
similarity_top_k=5,
|
@@ -99,21 +108,6 @@ recursive_fn_val = resursive_fn(reranker)
|
|
99 |
@cl.on_chat_start
|
100 |
async def start_chat():
|
101 |
print("A new chat session has started!")
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
# ChatOpenAI Templates
|
107 |
-
system_template = """Use the following pieces of context to answer the user's question.
|
108 |
-
If you don't know the answer, say that you don't know, do not try to make up an answer.
|
109 |
-
ALWAYS return a "SOURCES" part in your answer.
|
110 |
-
The "SOURCES" part should be a reference to the source inside the document from which you got your answer.
|
111 |
-
You are a helpful assistant who always speaks in a pleasant tone! """
|
112 |
-
|
113 |
-
user_template = """ Think through your response step by step."""
|
114 |
-
|
115 |
-
#user_query = "Who are the E-VP, Operations - and how old are they?"
|
116 |
-
|
117 |
cl.user_session.set("recursive_query_engine", recursive_fn_val)
|
118 |
|
119 |
|
|
|
84 |
model="BAAI/bge-reranker-large",
|
85 |
)
|
86 |
|
87 |
+
# ChatOpenAI Templates
|
88 |
+
system_template = """Use the following pieces of context to answer the user's question.
|
89 |
+
If you don't know the answer, say that you don't know, do not try to make up an answer.
|
90 |
+
ALWAYS return a "SOURCES" part in your answer.
|
91 |
+
The "SOURCES" part should be a reference to the source inside the document from which you got your answer.
|
92 |
+
You are a helpful assistant who always speaks in a pleasant tone! """
|
93 |
+
|
94 |
+
user_template = """ Think through your response step by step."""
|
95 |
+
|
96 |
+
#user_query = "Who are the E-VP, Operations - and how old are they?"
|
97 |
def resursive_fn(reranker):
|
98 |
recursive_query_engine = recursive_index_faiss.as_query_engine(
|
99 |
similarity_top_k=5,
|
|
|
108 |
@cl.on_chat_start
|
109 |
async def start_chat():
|
110 |
print("A new chat session has started!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
cl.user_session.set("recursive_query_engine", recursive_fn_val)
|
112 |
|
113 |
|