AutoGPT: Command google_search never invoked anymore

⚠️ Search for existing issues first ⚠️

  • I have searched the existing issues, and there is no existing issue for my problem

Which Operating System are you using?

Linux

Which version of Auto-GPT are you using?

Latest Release

GPT-3 or GPT-4?

GPT-3.5

Steps to reproduce 🕹

Start a goal that’s primarily searching the web

Current behavior 😯

Instead of searching Google or any other search engine, it will always ‘browse website’ instead. Even when the declared plan is to use search engines. Browsing the homepage of search engines and archive sites obviously yield no results.

Expected behavior 🤔

Use ‘google_search’ command like it used to before the latest release.

Your prompt 📝

# Search and summarize recent articles on the topic of XXX

Your Logs 📒

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (4 by maintainers)

Most upvoted comments

Using the combination of suggestions from @benqqqq and @jonasdebeukelaer I was able to get mine running smoothly again with proper Google searches via the Google API (running in VS Code + Docker Container):

1. Renamed Duck Duck Go query name, changed Line 14 from:

https://github.com/Significant-Gravitas/Auto-GPT/blob/3bf5934b20b906f977776e2d41033027ecb5df9b/autogpt/commands/google_search.py#L14

to

@command("ddg", "Duck Duck Go", '"query": "<query>"', not CFG.google_api_key)

2. Added line fix, changed Line 113 from:

https://github.com/Significant-Gravitas/Auto-GPT/blob/3bf5934b20b906f977776e2d41033027ecb5df9b/autogpt/commands/google_search.py#L113

to

[result.encode("utf-8", "ignore").decode("utf-8") for result in results]

Now everything running smoothly for me again.

Note: I also updated my DuckDuckGo Search per discussion comments in #4120 - Not sure if that has anything to do with it as I didn’t test in between the DDG update and making the other changes. But worth noting.

Update DuckDuckGo Search:

pip install --upgrade duckduckgo-search

I’ve noticed this issue as well. Worked for me in v0.2.2 but not since switching to stable v.0.3.0.

I have both Google API Key and Search ID set in my .env but it just uses the browse_website function and not Google.

Using GPT 4 API.

I also checked my Google API Key results to see if any traffic was using it, and I see no traffic on my API since making the switch.

@yangkyeongmo added whitespace and removed escape sequences for readability

Commands:
  1. analyze_code: Analyze Code, args: "code": "<full_code_string>"
  2. read_audio_from_file: Convert Audio to text, args: "filename": "<filename>"
  3. execute_python_file: Execute Python File, args: "filename": "<filename>"
  4. execute_shell: Execute Shell Command, non-interactive commands only, args: "command_line": "<command_line>"
  5. execute_shell_popen: Execute Shell Command, non-interactive commands only, args: "command_line": "<command_line>"
  6. append_to_file: Append to file, args: "filename": "<filename>", "text": "<text>"
  7. delete_file: Delete file, args: "filename": "<filename>"
  8. list_files: List Files in Directory, args: "directory": "<directory>"
  9. read_file: Read file, args: "filename": "<filename>"
  10. write_to_file: Write to file, args: "filename": "<filename>", "text": "<text>"
  11. clone_repository: Clone Repository, args: "url": "<repository_url>", "clone_path": "<clone_path>"
  12. generate_image: Generate Image, args: "prompt": "<prompt>"
  13. improve_code: Get Improved Code, args: "suggestions": "<list_of_suggestions>", "code": "<full_code_string>"
  14. send_tweet: Send Tweet, args: "tweet_text": "<tweet_text>"
  15. browse_website: Browse Website, args: "url": "<url>", "question": "<what_you_want_to_find_on_website>"
  16. write_tests: Write Tests, args: "code": "<full_code_string>", "focus": "<list_of_focus_areas>"
  17. delete_agent: Delete GPT Agent, args: "key": "<key>"
  18. get_hyperlinks: Get text summary, args: "url": "<url>"
  19. get_text_summary: Get text summary, args: "url": "<url>", "question": "<question>"
  20. list_agents: List GPT Agents, args: () -> str
  21. message_agent: Message GPT Agent, args: "key": "<key>", "message": "<message>"
  22. start_agent: Start GPT Agent, args: "name": "<name>", "task": "<short_task_desc>", "prompt": "<prompt>"
  23. Task Complete (Shutdown): "task_complete", args: "reason": "<reason>"

Is there a workaround for people running autogpt on Docker? I can’t get it to use Google Search at all

Hi, I think the root cause is that there are two commands with the same “name” google (the first argument) in the following code snippets:

(Google Official search) https://github.com/Significant-Gravitas/Auto-GPT/blob/3bf5934b20b906f977776e2d41033027ecb5df9b/autogpt/commands/google_search.py#L40-L47

(DuckDuckGo search) https://github.com/Significant-Gravitas/Auto-GPT/blob/3bf5934b20b906f977776e2d41033027ecb5df9b/autogpt/commands/google_search.py#L14-L15

This causes the command registry to overwrite each other, as seen in the code snippet https://github.com/Significant-Gravitas/Auto-GPT/blob/dcd6aa912b992d7c024ea1b668d3249b201b0c2c/autogpt/commands/command.py#L61-L62

There are two workarounds available:

  1. Comment out the GOOGLE_API_KEY in the .env file, which will make it use DuckDuckGo for searching instead. #GOOGLE_API_KEY=xxxx

  2. Use different names in the above two code snippets for these two commands.

I believe command changed to just google but it returns disabled for me.

Try prompting explicitly to use the google_search command.

I have, and it seems to understand. Yet, the generated command is ‘browse_website’ instead of ‘google_search’. It just keeps scraping google com homepage.