AutoGPT: Command google returned: Error: 'list' object has no attribute 'encode'
Duplicates
- I have searched the existing issues
Steps to reproduce 🕹
After pulling the latest code, I can’t use google to get information, and I get an error every time
NEXT ACTION: COMMAND = google ARGUMENTS = {‘input’: ‘What are the latest news or developments in the Russo-Ukrainian war from reliable sources other than AP News?’} Enter ‘y’ to authorise command, ‘y -N’ to run N continuous commands, ‘n’ to exit program, or enter feedback for … Input:y -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= SYSTEM: Command google returned: Error: ‘list’ object has no attribute ‘encode’
Current behavior 😯
SYSTEM: Command google returned: Error: ‘list’ object has no attribute ‘encode’
Expected behavior 🤔
Get a list of google search results
Your prompt 📝
# Paste your prompt here
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 15 (1 by maintainers)
Fixing the formatting from @JOechoech 's comment, here’s the correct spacing:
autogpt/commands/google_search.py
:I asked gtp-4 about it and pasted the code of the google_search.py. It actually managed to fix it lol. Here’s what to paste (replace everything in the file):
`“”“Google search command for Autogpt.”“” import json from typing import List, Union
from duckduckgo_search import ddg
from autogpt.config import Config
CFG = Config()
def google_search(query: str, num_results: int = 8) -> str: “”"Return the results of a google search
def google_official_search(query: str, num_results: int = 8) -> str: “”"Return the results of a google search using the official Google API
+1
same.