Chia Woon Yap
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -133,10 +133,13 @@ def clean_response(response):
|
|
| 133 |
# Function to generate quiz based on content
|
| 134 |
def generate_quiz(content):
|
| 135 |
prompt = f"{quiz_prompt}\n\nDocument content:\n{content}"
|
| 136 |
-
response = chat_model([HumanMessage(content=prompt)])
|
|
|
|
|
|
|
| 137 |
cleaned_response = clean_response(response.content)
|
| 138 |
return cleaned_response
|
| 139 |
|
|
|
|
| 140 |
# Function to retrieve relevant documents from vectorstore based on user query
|
| 141 |
def retrieve_documents(query):
|
| 142 |
results = vectorstore.similarity_search(query, k=3)
|
|
|
|
| 133 |
# Function to generate quiz based on content
|
| 134 |
def generate_quiz(content):
|
| 135 |
prompt = f"{quiz_prompt}\n\nDocument content:\n{content}"
|
| 136 |
+
#response = chat_model([HumanMessage(content=prompt)])
|
| 137 |
+
# Use invoke method instead of direct calling
|
| 138 |
+
response = chat_model.invoke([HumanMessage(content=prompt)])
|
| 139 |
cleaned_response = clean_response(response.content)
|
| 140 |
return cleaned_response
|
| 141 |
|
| 142 |
+
|
| 143 |
# Function to retrieve relevant documents from vectorstore based on user query
|
| 144 |
def retrieve_documents(query):
|
| 145 |
results = vectorstore.similarity_search(query, k=3)
|