Update app.py
Browse files
app.py
CHANGED
@@ -218,7 +218,7 @@ async def website_summarizer(url: str):
|
|
218 |
raise HTTPException(status_code=500, detail=f"Error during summarization: {e}")
|
219 |
|
220 |
@app.get("/api/ask_website")
|
221 |
-
async def ask_website(url: str, question: str):
|
222 |
"""
|
223 |
Asks a question about the content of a given website.
|
224 |
"""
|
@@ -231,11 +231,11 @@ async def ask_website(url: str, question: str):
|
|
231 |
visible_text = visible_text[:7500] + "..."
|
232 |
|
233 |
# Construct a prompt for the chat model
|
234 |
-
prompt = f"Based on the following text, answer this question in Paragraph: [QUESTION] {question}
|
235 |
|
236 |
# Use chat model to get the answer
|
237 |
with WEBS() as webs:
|
238 |
-
answer_result = webs.chat(keywords=prompt, model=
|
239 |
|
240 |
# Return the answer result
|
241 |
return JSONResponse(content=jsonable_encoder({answer_result}))
|
|
|
218 |
raise HTTPException(status_code=500, detail=f"Error during summarization: {e}")
|
219 |
|
220 |
@app.get("/api/ask_website")
|
221 |
+
async def ask_website(url: str, question: str, model: str = "llama-3-70b"):
|
222 |
"""
|
223 |
Asks a question about the content of a given website.
|
224 |
"""
|
|
|
231 |
visible_text = visible_text[:7500] + "..."
|
232 |
|
233 |
# Construct a prompt for the chat model
|
234 |
+
prompt = f"Based on the following text, answer this question in Paragraph: [QUESTION] {question} [TEXT] {visible_text}"
|
235 |
|
236 |
# Use chat model to get the answer
|
237 |
with WEBS() as webs:
|
238 |
+
answer_result = webs.chat(keywords=prompt, model=model)
|
239 |
|
240 |
# Return the answer result
|
241 |
return JSONResponse(content=jsonable_encoder({answer_result}))
|