geekan / MetaGPT

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
https://deepwisdom.ai/
MIT License
43.46k stars 5.17k forks source link

Search example doesn't work #389

Open thurft opened 11 months ago

thurft commented 11 months ago

I am running the example search_google.py and i get the following error. But I put a set & uncomment from the config file. GOOGLE_API_KEY: "xxx" and take the # away from it so its all uncommented. technically it should work.

❯ python search_google.py
2023-10-02 22:26:46.137 | INFO     | metagpt.config:__init__:44 - Config loading done.
2023-10-02 22:26:47.243 | INFO     | metagpt.roles.seacher:_act_sp:54 - Alice(Smart Assistant): ready to SearchAndSummarize
2023-10-02 22:26:47.243 | WARNING  | metagpt.actions.search_and_summarize:run:118 - Configure one of SERPAPI_API_KEY, SERPER_API_KEY, GOOGLE_API_KEY to unlock full feature
neilmartindev commented 11 months ago

Have you removed the "" also?

iorisa commented 10 months ago

SERPAPI_API_KEY, SERPER_API_KEY, and GOOGLE_API_KEY are all reported as unavailable in the log. Please ensure that the key you used is uncommented and that the value is usable.

olsn commented 10 months ago

The example is poorly documented, after browsing the source-code I found the following solution: The default search-engine used in the Searcher is SERPAPI. If you want to use direct google, you will have to modify the example to to the following:

...
from metagpt.tools import SearchEngineType
...

async def main():
    await Searcher(engine=SearchEngineType.DIRECT_GOOGLE).run(....

That worked for me.