Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -340,7 +340,7 @@ def web_search_and_extract_threading(
|
|
| 340 |
async def adv_web_search(
|
| 341 |
q: str,
|
| 342 |
model: str = "llama3-8b",
|
| 343 |
-
max_results: int =
|
| 344 |
timelimit: Optional[str] = None,
|
| 345 |
safesearch: str = "moderate",
|
| 346 |
region: str = "wt-wt",
|
|
@@ -369,11 +369,11 @@ async def adv_web_search(
|
|
| 369 |
extracted_text += f"## Content from: {result['link']}\n\n{result['text']}\n\n"
|
| 370 |
|
| 371 |
# 3. Construct the prompt for FastAI
|
| 372 |
-
ai_prompt = f"Query by user: {q}
|
| 373 |
|
| 374 |
# 4. Get the FastAI's response using FastAI service
|
| 375 |
try:
|
| 376 |
-
response = await asyncio.to_thread(fastai
|
| 377 |
except Exception as e:
|
| 378 |
raise HTTPException(status_code=500, detail=f"Error during FastAI request: {e}")
|
| 379 |
|
|
|
|
| 340 |
async def adv_web_search(
|
| 341 |
q: str,
|
| 342 |
model: str = "llama3-8b",
|
| 343 |
+
max_results: int = 3,
|
| 344 |
timelimit: Optional[str] = None,
|
| 345 |
safesearch: str = "moderate",
|
| 346 |
region: str = "wt-wt",
|
|
|
|
| 369 |
extracted_text += f"## Content from: {result['link']}\n\n{result['text']}\n\n"
|
| 370 |
|
| 371 |
# 3. Construct the prompt for FastAI
|
| 372 |
+
ai_prompt = f"Query by user: {q}. Answer the query asked by the user in detail. Search Result: {extracted_text}"
|
| 373 |
|
| 374 |
# 4. Get the FastAI's response using FastAI service
|
| 375 |
try:
|
| 376 |
+
response = await asyncio.to_thread(fastai, ai_prompt, model=model, system=system_prompt)
|
| 377 |
except Exception as e:
|
| 378 |
raise HTTPException(status_code=500, detail=f"Error during FastAI request: {e}")
|
| 379 |
|