microsoft / TaskWeaver

A code-first agent framework for seamlessly planning and executing data analytics tasks.
https://microsoft.github.io/TaskWeaver/
MIT License
5.16k stars 658 forks source link

Websearch Functionality Not Working in TaskWeaver #363

Open saeid976 opened 2 months ago

saeid976 commented 2 months ago

Hi,

I am encountering an issue with using TaskWeaver's websearch functionality. In the environment.py, I have set the image_name to taskweavercontainers/taskweaver-all-in-one:latest-ws, which should include the websearch option. However, when I ask a question, I receive the response:

"I'm sorry, but I am not able to perform web searches. Is there anything else I can assist you with?"

Here is the code I am using:

from taskweaver.app.app import TaskWeaverApp import os

app_dir = "./project/" app = TaskWeaverApp(app_dir=app_dir) session = app.get_session()

user_query = "current GOOG stock price" response_round = session.send_message(user_query) print(response_round.to_dict())

Note: When I run it via Docker Compose, it can use the websearch functionality without any issues.

Could you please assist me in resolving this problem?

Thank you.

liqul commented 2 months ago

Could you share more information on your two different set ups (like the steps and the model used) and also what is your query? The code looks quite wired as it was attempting to call taskweaver as a lib to do something. But in fact, we have a dedicated role to do web searches.

arhaang13 commented 1 month ago

The web search role is being called here but I receive the following error:

File "/Users/arhaan/TaskWeaver/playground/UI/../../taskweaver/session/session.py", line 202, in _send_text_message post = _send_message(post.send_to, post) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/arhaan/TaskWeaver/playground/UI/../../taskweaver/module/tracing.py", line 174, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/arhaan/TaskWeaver/playground/UI/../../taskweaver/session/session.py", line 182, in _send_message reply_post = self.worker_instances[recipient].reply( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/arhaan/TaskWeaver/playground/UI/../../taskweaver/ext_role/web_search/web_search.py", line 199, in reply browse_page( File "/Users/arhaan/TaskWeaver/playground/UI/../../taskweaver/ext_role/web_search/web_search.py", line 78, in browse_page type=AttachmentType.text, ^^^^^^^^^^^^^^^^^^^ File "/Users/arhaan/anaconda3/envs/taskweaver/lib/python3.11/enum.py", line 786, in getattr raise AttributeError(name) from None AttributeError: text

Apart from this, how do I edit the role to post a reply to the planner, and how do i configure the planner to use my reply.

Also, how do i instruct the planner certain cases where this role has to be called. In the planner examples folder in the project directory?

liqul commented 1 month ago

Are you using our latest code? The text attachment type has been deprecated in our latest code as documented here.

I didn't get your question. It seems that you want to manually compose the reply from the role to the planner?

arhaang13 commented 1 month ago

I want to call the web search role in a certain case for example for additional information extraction but the planner is not calling the role at the moment.

How do i train/instruct the planner that in these certain cases it needs to call the web search role.

Thank you for your help!