Spaces:
Configuration error
Configuration error
Update agent.py
Browse files
agent.py
CHANGED
@@ -46,13 +46,6 @@ from llama_index.readers.file import (
|
|
46 |
from pydantic import PrivateAttr
|
47 |
|
48 |
|
49 |
-
import requests
|
50 |
-
def search_ddg(query):
|
51 |
-
url = "https://api.duckduckgo.com/"
|
52 |
-
params = {"q": query, "format": "json"}
|
53 |
-
response = requests.get(url, params=params)
|
54 |
-
return response.json()
|
55 |
-
|
56 |
# Optional API-based imports (conditionally loaded)
|
57 |
try:
|
58 |
# Gemini (for API mode)
|
@@ -529,6 +522,7 @@ def search_and_extract_content_from_url(query: str) -> List[Document]:
|
|
529 |
return documents
|
530 |
except Exception as e:
|
531 |
# Handle any exceptions that occur during content extraction
|
|
|
532 |
return [Document(text=f"Error extracting content from URL: {str(e)}")]
|
533 |
|
534 |
def enhanced_web_search_and_update(query: str) -> str:
|
|
|
46 |
from pydantic import PrivateAttr
|
47 |
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
# Optional API-based imports (conditionally loaded)
|
50 |
try:
|
51 |
# Gemini (for API mode)
|
|
|
522 |
return documents
|
523 |
except Exception as e:
|
524 |
# Handle any exceptions that occur during content extraction
|
525 |
+
print(e)
|
526 |
return [Document(text=f"Error extracting content from URL: {str(e)}")]
|
527 |
|
528 |
def enhanced_web_search_and_update(query: str) -> str:
|