microsoft / autogen

A programming framework for agentic AI. Discord: https://aka.ms/autogen-dc. Roadmap: https://aka.ms/autogen-roadmap
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
28.27k stars 4.13k forks source link

[Bug]: Autogen is not searching in internet #2585

Open zioalex opened 2 months ago

zioalex commented 2 months ago

Describe the bug

I am trying to use the WebSurferAgent as described here https://nbviewer.org/github/microsoft/autogen/blob/main/notebook/agentchat_surfer.ipynb

Here is my code:

import os
import autogen
from autogen.agentchat.contrib.web_surfer import WebSurferAgent  # noqa: E402
# pip install "pyautogen[websurfer]"

BASE_URL="http://localhost:11434/v1/"
bing_api_key = os.environ["BING_API_KEY"]

# Openai Secret key 
openai_key = ""
config_list_mistral = [ {
    'base_url': BASE_URL,
        'api_key': "NULL",
    'model': "mistral",
    'timeout': 1800
    }
]

#'base_url': "http://0.0.0.0:8000",
#   'model': "ollama/llama2-uncensored",
config_list_codellama = [ {
    'base_url': BASE_URL,
        'api_key': "NULL",
    'model': "llama3:8b",
    'timeout': 1800
    }
]

llm_config_mistral={
    "config_list": config_list_mistral,
}

llm_config_codellama={
    "config_list": config_list_codellama,
}

web_surfer = WebSurferAgent(
    "web_surfer",
    llm_config=llm_config_codellama,
    summarizer_llm_config=llm_config_mistral,
    browser_config={"viewport_size": 4096, "bing_api_key": bing_api_key},
)

user_proxy = autogen.UserProxyAgent(
    "user_proxy",
    human_input_mode="NEVER",
    code_execution_config=False,
    default_auto_reply="",
    is_termination_msg=lambda x: True,
)

task1 = """
Search the web for information about Microsoft PyAutoGen. Report the found internet links.
"""

chat_res = user_proxy.initiate_chat(web_surfer, message=task1, clear_history=False)

print("Summary:", chat_res.summary)
print("Cost info:", chat_res.cost)

Steps to reproduce

  1. Created a Bing search resource in Azure
  2. Exported the Key in my shell
  3. run the code with python websearch.py
  4. It runs without error but the response is wrong and not updated

Model Used

llama3:8b and mistral

Expected Behavior

A proper internet search is done.

Screenshots and logs

No response

Additional Information

annotated-types==0.6.0
anyio==4.3.0
beautifulsoup4==4.12.3
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
cryptography==42.0.5
diskcache==5.6.3
distro==1.9.0
docker==7.0.0
exceptiongroup==1.2.1
FLAML==2.1.2
h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
idna==3.7
markdownify==0.12.1
numpy==1.24.4
openai==1.20.0
packaging==24.0
pathvalidate==3.2.0
pdfminer.six==20231228
pyautogen==0.2.26
pycparser==2.22
pydantic==2.7.1
pydantic-core==2.18.2
python-dotenv==1.0.1
regex==2024.4.16
requests==2.31.0
six==1.16.0
sniffio==1.3.1
soupsieve==2.5
termcolor==2.4.0
tiktoken==0.6.0
tqdm==4.66.2
typing-extensions==4.11.0
urllib3==2.2.1

ekzhu commented 2 months ago

It runs without error but the response is wrong and not updated

What is the response?

Hk669 commented 2 months ago

@zioalex please share the response or any screenshots. Thanks