Fixed googlesearch dependency issue
Swapped the googlesearch package for the duckduckgo-search. It uses the ddg instant answer API and works very similarly to the googlesearch one.pull/98/head
parent
51e293f64c
commit
6306a033cc
|
@ -1,14 +0,0 @@
|
|||
# I wasn't having any luck installing the requirements.txt file in Mac or Linux
|
||||
# But this seems to work.
|
||||
# The biggest difference is docker 5 instead of 6, because of this silliness:
|
||||
#
|
||||
# The conflict is caused by:
|
||||
# The user requested requests>=2.26.0
|
||||
# docker 6.0.1 depends on requests>=2.26.0
|
||||
# googlesearch-python 1.1.0 depends on requests==2.25.1
|
||||
docker==5.0.3
|
||||
|
||||
# I'd love to fix this in a cleaner way
|
||||
|
||||
# Now go ahead and install the rest of what requirements.txt says:
|
||||
-r requirements.txt
|
|
@ -8,5 +8,5 @@ readability-lxml==0.8.1
|
|||
requests
|
||||
tiktoken==0.3.3
|
||||
docker
|
||||
googlesearch-python
|
||||
duckduckgo-search
|
||||
# Googlesearch python seems to be a bit cursed, anyone good at fixing thigns like this?
|
|
@ -9,7 +9,7 @@ import ai_functions as ai
|
|||
from file_operations import read_file, write_to_file, append_to_file, delete_file
|
||||
from execute_code import execute_python_file
|
||||
from json_parser import fix_and_parse_json
|
||||
from googlesearch import search
|
||||
from duckduckgo_search import ddg
|
||||
cfg = Config()
|
||||
|
||||
|
||||
|
@ -103,7 +103,7 @@ def get_datetime():
|
|||
|
||||
def google_search(query, num_results=8):
|
||||
search_results = []
|
||||
for j in search(query, num_results=num_results):
|
||||
for j in ddg(query, max_results=num_results):
|
||||
search_results.append(j)
|
||||
|
||||
return json.dumps(search_results, ensure_ascii=False, indent=4)
|
||||
|
|
Loading…
Reference in New Issue