Git Product home page Git Product logo

taskweaver's Introduction

TaskWeaver

Discord FollowPython VersionLicense: MITWelcome

TaskWeaver is A code-first agent framework for seamlessly planning and executing data analytics tasks. This innovative framework interprets user requests through code snippets and efficiently coordinates a variety of plugins in the form of functions to execute data analytics tasks in a stateful manner.

Unlike many agent frameworks that only track the chat history with LLMs in text, TaskWeaver preserves both the chat history and the code execution history, including the in-memory data. This feature enhances the expressiveness of the agent framework, making it ideal for processing complex data structures like high-dimensional tabular data.

🆕 News

  • 📅2024-03-28: TaskWeaver now offers all-in-one Docker image, providing a convenient one-stop experience for users. Please check the docker for more details.🐳
  • 📅2024-03-27: TaskWeaver now switches to container mode by default for code execution. Please check the code execution for more details.🐳
  • 📅2024-03-07: TaskWeaver now supports configuration of different LLMs for various components, such as the Planner and CodeInterpreter. Please check the multi-llm for more details.🔗
  • 📅2024-03-04: TaskWeaver now supports a container mode, which provides a more secure environment for code execution.🐳
  • 📅2024-02-28: TaskWeaver now offers a CLI-only mode, enabling users to interact seamlessly with the Command Line Interface (CLI) using natural language.📟
  • 📅2024-02-01: TaskWeaver now has a plugin document_retriever for RAG based on a knowledge base.📚
  • 📅2024-01-30: TaskWeaver introduces a new plugin-only mode that securely generates calls to specified plugins without producing extraneous code.🪡
  • 📅2024-01-23: TaskWeaver can now be personalized by transforming your chat histories into enduring experiences 🎉

💥 Highlights

  • Rich data structure - TaskWeaver allows you to work with rich data structures in Python, such as DataFrames, instead of dealing with strings.
  • Customized algorithms - TaskWeaver allows you to encapsulate your own algorithms into plugins and orchestrate them.
  • Incorporating domain-specific knowledge - TaskWeaver is designed to incorporate domain-specific knowledge easily to improve the reliability.
  • Stateful execution - TaskWeaver is designed to support stateful execution of the generated code to ensure consistent and smooth user experience.
  • Code verification - TaskWeaver is designed to verify the generated code before execution. It can detect potential issues in the generated code and provide suggestions to fix them.
  • Easy to use - TaskWeaver is easy to use with sample plugins, examples and tutorials to help you get started. TaskWeaver offers an open-box experience, allowing users to run it immediately after installation.
  • Easy to debug - TaskWeaver is easy to debug with detailed and transparent logs to help you understand the entire process, including LLM prompts, the code generation, and execution process.
  • Security consideration - TaskWeaver supports a basic session management to keep different users' data separate. The code execution is separated into different processes to avoid mutal interference.
  • Easy extension - TaskWeaver is easy to extend to accomplish more complex tasks with multiple agents as the plugins.

✨ Quick Start

🛠️ Step 1: Installation

TaskWeaver requires Python >= 3.10. It can be installed by running the following command:

# [optional to create conda environment]
# conda create -n taskweaver python=3.10
# conda activate taskweaver

# clone the repository
git clone https://github.com/microsoft/TaskWeaver.git
cd TaskWeaver
# install the requirements
pip install -r requirements.txt

🖊️ Step 2: Configure the LLMs

Before running TaskWeaver, you need to provide your LLM configurations. Taking OpenAI as an example, you can configure taskweaver_config.json file as follows.

OpenAI

{
  "llm.api_key": "the api key",
  "llm.model": "the model name, e.g., gpt-4"
}

💡 TaskWeaver also supports other LLMs and advanced configurations, please check the documents for more details.

🚩 Step 3: Start TaskWeaver

💡 TaskWeaver has switched to container mode by default for code execution, which means the code is run in a container. You may need to install Docker and take care of the dependencies in the container. Please check the code execution for more details.

⌨️ Command Line (CLI)

# assume you are in the cloned TaskWeaver folder
python -m taskweaver -p ./project/

This will start the TaskWeaver process and you can interact with it through the command line interface. If everything goes well, you will see the following prompt:

=========================================================
 _____         _     _       __
|_   _|_ _ ___| | _ | |     / /__  ____ __   _____  _____
  | |/ _` / __| |/ /| | /| / / _ \/ __ `/ | / / _ \/ ___/
  | | (_| \__ \   < | |/ |/ /  __/ /_/ /| |/ /  __/ /
  |_|\__,_|___/_|\_\|__/|__/\___/\__,_/ |___/\___/_/
=========================================================
TaskWeaver: I am TaskWeaver, an AI assistant. To get started, could you please enter your request?
Human: ___

or 💻 Web UI

TaskWeaver also supports WebUI for demo purpose, please refer to web UI docs for more details.

or 📋 Import as a Library

TaskWeaver can be imported as a library to integrate with your existing project, more information can be found in docs

📖 Documentation

More documentations can be found on TaskWeaver Website.

❓Get help


🎬 Demo Examples

The demos were made based on the web UI, which is better for displaying the generated artifacts such as images. The demos could also be conducted in the command line interface.

1️⃣📉 Example 1: Pull data from a database and apply an anomaly detection algorithm

In this example, we will show you how to use TaskWeaver to pull data from a database and apply an anomaly detection algorithm.

anomaly_detection_chainlit.mp4

If you want to follow this example, you need to configure the sql_pull_data plugin in the project/plugins/sql_pull_data.yaml file. You need to provide the following information:

api_type: azure or openai
api_base: ...
api_key: ...
api_version: ...
deployment_name: ...
sqlite_db_path: sqlite:///../../../sample_data/anomaly_detection.db

The sql_pull_data plugin is a plugin that pulls data from a database. It takes a natural language request as input and returns a DataFrame as output.

This plugin is implemented based on Langchain. If you want to follow this example, you need to install the Langchain package:

pip install langchain
pip install tabulate

2️⃣🏦 Example 2: Forecast QQQ's price in the next 7 days

In this example, we will show you how to use TaskWeaver to forecast QQQ's price in the next 7 days.

forecast_price_chainlit.mp4

If you want to follow this example, you need to ensure you have these two requirements installed:

pip install yfinance
pip install statsmodels

For more examples, please refer to our paper.

💡 The planning of TaskWeaver are based on the LLM model. Therefore, if you want to repeat the examples, the execution process may be different from what you see in the videos. For example, in the second demo, the assistant may ask the user which prediction algorithm should be used. Typically, more concrete prompts will help the model to generate better plans and code.

📚 Citation

Our paper could be found here. If you use TaskWeaver in your research, please cite our paper:

@article{taskweaver,
  title={TaskWeaver: A Code-First Agent Framework},
  author={Bo Qiao, Liqun Li, Xu Zhang, Shilin He, Yu Kang, Chaoyun Zhang, Fangkai Yang, Hang Dong, Jue Zhang, Lu Wang, Minghua Ma, Pu Zhao, Si Qin, Xiaoting Qin, Chao Du, Yong Xu, Qingwei Lin, Saravan Rajmohan, Dongmei Zhang},
  journal={arXiv preprint arXiv:2311.17541},
  year={2023}
}

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Disclaimer

The recommended models in this Repo are just examples, used to explore the potential of agent systems with the paper at TaskWeaver: A Code-First Agent Framework. Users can replace the models in this Repo according to their needs. When using the recommended models in this Repo, you need to comply with the licenses of these models respectively. Microsoft shall not be held liable for any infringement of third-party rights resulting from your usage of this repo. Users agree to defend, indemnify and hold Microsoft harmless from and against all damages, costs, and attorneys' fees in connection with any claims arising from this Repo. If anyone believes that this Repo infringes on your rights, please notify the project owner email.

taskweaver's People

Contributors

00arthur00 avatar cclauss avatar codesmith-emmy avatar dependabot[bot] avatar developer-hassan avatar eltociear avatar emmanuel-ferdman avatar eukub avatar ezzcodeezzlife avatar fariquelme avatar halcyondude avatar jack-q avatar joshkyh avatar liqul avatar m-c-frank avatar microsoft-github-operations[bot] avatar microsoftopensource avatar pallharaldsson avatar shilinhe avatar vladcuciureanu avatar zhangxu0307 avatar zrzrzrzrzrzrzr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taskweaver's Issues

Error: Cannot process your request due to Exception: 'NoneType' object has no attribute 'content'

Human: what time is it
>>> [INIT_PLAN]
1. Fetch the current system time
>>> [PLAN]
1. Fetch the current system time
>>> [CURRENT_PLAN_STEP]
Fetch the current system time
>>> [SEND_TO]
CodeInterpreter
>>> [MESSAGE]
Please provide the current system time.
>>> [PLANNER->CODEINTERPRETER]
Please provide the current system time.
Error: Cannot process your request due to Exception: 'NoneType' object has no attribute 'content' 
 Traceback (most recent call last):
  File "/home/bene/Pojects/TaskWeaver/taskweaver/session/session.py", line 125, in send_message
    post = _send_message(post.send_to, post)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bene/Pojects/TaskWeaver/taskweaver/session/session.py", line 107, in _send_message
    reply_post = self.code_interpreter.reply(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bene/Pojects/TaskWeaver/taskweaver/code_interpreter/code_interpreter.py", line 68, in reply
    code.content,
    ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'content'

Environment Information (please complete the following information):

  • OS: Ubuntu 23.10
  • Python 3.11.6
  • LLM that you're using: GPT-4-preview
  • code_verification: true

Add a Critic role

Is your feature request related to a problem? Please describe.
Having dabbled in TaskWeaver and AutoGen, I think that AutoGen's use of a "Critic" agent which weighs in on both plans and code can frequently improve the agent's overall ability to satisfy a user request.

Describe the solution you'd like
Add an additional role of Critic w/in TaskWeaver. The critic would review both Plans and Code before those roles passed them along.

Describe alternatives you've considered
N/A

Additional context
N/A

no config dir, linux

cant find the config directory (using linux). also in the installation instructions you use cd taskweaver, but its actually being extracted into the directory TaskWeaver
tw

also had to install 2 extra modules. now im stuck here:

pip install injector
pip install ijson

python -m taskweaver -p ./project/
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/home/user/TaskWeaver/taskweaver/main.py", line 1, in
from .cli import main
File "/home/user/TaskWeaver/taskweaver/cli/main.py", line 1, in
from .cli import taskweaver
File "/home/user/TaskWeaver/taskweaver/cli/cli.py", line 3, in
from ..app import TaskWeaverApp
File "/home/user/TaskWeaver/taskweaver/app/init.py", line 1, in
from .app import TaskWeaverApp
File "/home/user/TaskWeaver/taskweaver/app/app.py", line 12, in
from taskweaver.session.session import Session
File "/home/user/TaskWeaver/taskweaver/session/init.py", line 1, in
from .session import Session
File "/home/user/TaskWeaver/taskweaver/session/session.py", line 7, in
from taskweaver.code_interpreter import CodeInterpreter
File "/home/user/TaskWeaver/taskweaver/code_interpreter/init.py", line 1, in
from .code_interpreter import CodeInterpreter
File "/home/user/TaskWeaver/taskweaver/code_interpreter/code_interpreter.py", line 6, in
from taskweaver.code_interpreter.code_generator import (
File "/home/user/TaskWeaver/taskweaver/code_interpreter/code_generator/init.py", line 1, in
from .code_generator import CodeGenerator, CodeGeneratorConfig, format_code_revision_message
File "/home/user/TaskWeaver/taskweaver/code_interpreter/code_generator/code_generator.py", line 8, in
from taskweaver.llm import LLMApi
File "/home/user/TaskWeaver/taskweaver/llm/init.py", line 6, in
from openai import AzureOpenAI, OpenAI
ImportError: cannot import name 'AzureOpenAI' from 'openai' (/home/user/.venv/lib/python3.11/site-packages/openai/init.py)

pip freeze: openai==0.28.1

Contributors' Setup

Describe the solution you'd like
I was trying to set up the environment for TaskWeaver contributions and think the following two aspects could help:

  1. Having a .devcontainer (e.g., https://github.com/microsoft/autogen/tree/main/.devcontainer) so that the contributors could quickly reproduce the environment.
  2. Maybe we are missing the .linters folder in this repo? I wasn't able to run pre-commit run --all-files successfully, but it might be due to me setting it up wrong.
image

this program needs the ability to resume a previous session

when trying to build a program with taskweaver it got stuck in a weird loop and i had to close the program. i spent liek 14$ on gpt4 credits to get to that point. since this program is so new i suspect other users will experience the same fate unless there is a way to resume sessions.

also, being able to ctrl-c to cancel the current step and re-instruct the agents would maybe have prevented the need for this.

i love this project and i am stoked to see more!

klarna_search

any time I ask taskweaver to pull data from a web source I see this error. even if its something simple like create a chart showing how Microsoft stock has trended over the last year. Please let me know if I'm missing something.

Cell In[1], line 2
klarna_search_result = klarna_search(query='Microsoft stock price', size=1)

NameError: name 'klarna_search' is not defined

thank you

Very slow inference (with local LLM) during agent work

Describe the bug
Very slow inference during agent work in comparison to usual LLM interaction
I'm using local setup with API connection to TextGen WebUI in local network
Each iteration of TaskWeaver is very-very slow
generation speed is drastically decreased to around 1-2 t/s (usual speed on same setup 15-20 t/s)

At this communication rate this tool is net very useful, simple coding task like print numbers executed in 20-30 mins.
Is there any tweak to solve it. I guess it could because of relatively large context in each request?

To Reproduce
Steps to reproduce the behavior:

  1. Start the service
  2. Type the user query "any listed query from example description"
  3. Wait for the response forever

Expected behavior
Similar inference speed as Autogen

Environment Information (please complete the following information):

  • OS: MacOS
  • Python Version 3.11
  • LLM that you're using: number of different 7b models

Error when trying to run taskweaver from command line

Error while trying to run this command -> python3 -m taskweaver -p ./project

Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/TaskWeaver/taskweaver/main.py", line 1, in
from .cli import main
File "/TaskWeaver/taskweaver/cli/main.py", line 1, in
from .cli import taskweaver
File "/TaskWeaver/taskweaver/cli/cli.py", line 3, in
from ..app import TaskWeaverApp
File "/TaskWeaver/taskweaver/app/init.py", line 1, in
from .app import TaskWeaverApp
File "/TaskWeaver/taskweaver/app/app.py", line 9, in
from taskweaver.module.execution_service import ExecutionServiceModule
File "/TaskWeaver/taskweaver/module/execution_service.py", line 6, in
from taskweaver.ces import code_execution_service_factory
File "/TaskWeaver/taskweaver/ces/init.py", line 2, in
from taskweaver.ces.manager.sub_proc import SubProcessManager
File "/TaskWeaver/taskweaver/ces/manager/sub_proc.py", line 7, in
from taskweaver.ces.environment import Environment
File "/TaskWeaver/taskweaver/ces/environment.py", line 90, in
class TaskWeaverMultiKernelManager(MultiKernelManager):
File "/TaskWeaver/taskweaver/ces/environment.py", line 93, in TaskWeaverMultiKernelManager
kernel_name: str | None,
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Allow to install any python package

Is there a way to enable TaskWeaver to autonomously install any Python package it requires, rather than restricting it to the ones pre-defined in code_verification.allowed_modules?

Currently, predicting the exact packages TaskWeaver might need for a given task can be challenging. This limitation significantly narrows the tool's practical utility. By allowing more flexibility in package installation, TaskWeaver's adaptability and effectiveness could be substantially improved.

unable to run with lm studio

Describe the bug
my current config to access lm studio

{
"llm.api_base": "http://localhost:1234/v1",
"llm.api_key": "0",
"llm.model": "local-model",
"llm.response_format": null
}

i get this error

Error: Cannot process your request due to Exception: OpenAI API request failed to connect: Connection error.
Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 130, in _send_request_headers
event = h11.Request(
^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/h11/_events.py", line 96, in init
self, "headers", normalize_and_validate(headers, _parsed=_parsed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/h11/_headers.py", line 164, in normalize_and_validate
validate(_field_value_re, value, "Illegal header value {!r}", value)
File "/home/vscode/.local/lib/python3.11/site-packages/h11/_util.py", line 91, in validate
raise LocalProtocolError(msg)
h11._util.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 262, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 245, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 96, in handle_request
return self._connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 121, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 88, in handle_request
self._send_request_headers(**kwargs)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 129, in _send_request_headers
with map_exceptions({h11.LocalProtocolError: LocalProtocolError}):
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 217, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Illegal header value b'Bearer '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 130, in _send_request_headers
event = h11.Request(
^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/h11/_events.py", line 96, in init
self, "headers", normalize_and_validate(headers, _parsed=_parsed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/h11/_headers.py", line 164, in normalize_and_validate
validate(_field_value_re, value, "Illegal header value {!r}", value)
File "/home/vscode/.local/lib/python3.11/site-packages/h11/_util.py", line 91, in validate
raise LocalProtocolError(msg)
h11._util.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 262, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 245, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 96, in handle_request
return self._connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 121, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 88, in handle_request
self._send_request_headers(**kwargs)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 129, in _send_request_headers
with map_exceptions({h11.LocalProtocolError: LocalProtocolError}):
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 217, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Illegal header value b'Bearer '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 130, in _send_request_headers
event = h11.Request(
^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/h11/_events.py", line 96, in init
self, "headers", normalize_and_validate(headers, _parsed=_parsed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/h11/_headers.py", line 164, in normalize_and_validate
validate(_field_value_re, value, "Illegal header value {!r}", value)
File "/home/vscode/.local/lib/python3.11/site-packages/h11/_util.py", line 91, in validate
raise LocalProtocolError(msg)
h11._util.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 262, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 245, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 96, in handle_request
return self._connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 121, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 88, in handle_request
self._send_request_headers(**kwargs)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 129, in _send_request_headers
with map_exceptions({h11.LocalProtocolError: LocalProtocolError}):
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 217, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/workspaces/TaskWeaver/taskweaver/llm/openai.py", line 151, in chat_completion
res: Any = self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_utils/_utils.py", line 303, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 604, in create
return self._post(
^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 1088, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 853, in request
return self._request(
^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 896, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 958, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 896, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 958, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 905, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/workspaces/TaskWeaver/taskweaver/session/session.py", line 126, in send_message
post = _send_message(post.send_to, post)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/TaskWeaver/taskweaver/session/session.py", line 98, in _send_message
reply_post = self.planner.reply(
^^^^^^^^^^^^^^^^^^^
File "/workspaces/TaskWeaver/taskweaver/planner/planner.py", line 213, in reply
llm_output = self.llm_api.chat_completion(chat_history, use_backup_engine=use_back_up_engine)["content"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/TaskWeaver/taskweaver/llm/init.py", line 85, in chat_completion
for msg_chunk in self.completion_service.chat_completion(
File "/workspaces/TaskWeaver/taskweaver/llm/openai.py", line 195, in chat_completion
raise Exception(f"OpenAI API request failed to connect: {e}")
Exception: OpenAI API request failed to connect: Connection error.

Human:

Aborted!
vscode ➜ /workspaces/TaskWeaver (main) $ python -m taskweaver -p ./project/


|_ | _ | | _ | | / / ____ __ _____ _____
| |/ / __| |/ /| | /| / / _ \/ __/ | / / _ / /
| | (
| _
\ < | |/ |/ / __/ /
/ /| |/ / __/ /
|
|_
,|/|_|/|/_/_,/ |/_/_/

TaskWeaver: I am TaskWeaver, an AI assistant. To get started, could you please enter your request?
Human: print 1st 5 prime numbers
Error: Cannot process your request due to Exception: OpenAI API request failed to connect: Connection error.
Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 100, in connect_tcp
sock = socket.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 262, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 245, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 92, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 69, in handle_request
stream = self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 117, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 99, in connect_tcp
with map_exceptions(exc_map):
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 217, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 99] Cannot assign requested address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 100, in connect_tcp
sock = socket.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 262, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 245, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 92, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 69, in handle_request
stream = self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 117, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 99, in connect_tcp
with map_exceptions(exc_map):
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 217, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 99] Cannot assign requested address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 100, in connect_tcp
sock = socket.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 262, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 245, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 92, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 69, in handle_request
stream = self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 117, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 99, in connect_tcp
with map_exceptions(exc_map):
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 217, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/workspaces/TaskWeaver/taskweaver/llm/openai.py", line 151, in chat_completion
res: Any = self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_utils/_utils.py", line 303, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 604, in create
return self._post(
^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 1088, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 853, in request
return self._request(
^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 896, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 958, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 896, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 958, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 905, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/workspaces/TaskWeaver/taskweaver/session/session.py", line 126, in send_message
post = _send_message(post.send_to, post)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/TaskWeaver/taskweaver/session/session.py", line 98, in _send_message
reply_post = self.planner.reply(
^^^^^^^^^^^^^^^^^^^
File "/workspaces/TaskWeaver/taskweaver/planner/planner.py", line 213, in reply
llm_output = self.llm_api.chat_completion(chat_history, use_backup_engine=use_back_up_engine)["content"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/TaskWeaver/taskweaver/llm/init.py", line 85, in chat_completion
for msg_chunk in self.completion_service.chat_completion(
File "/workspaces/TaskWeaver/taskweaver/llm/openai.py", line 195, in chat_completion
raise Exception(f"OpenAI API request failed to connect: {e}")
Exception: OpenAI API request failed to connect: Connection error.

Human:

Aborted!
vscode ➜ /workspaces/TaskWeaver (main) $ python -m taskweaver -p ./project/


|_ | _ | | _ | | / / ____ __ _____ _____
| |/ / __| |/ /| | /| / / _ \/ __/ | / / _ / /
| | (
| _
\ < | |/ |/ / __/ /
/ /| |/ / __/ /
|
|_
,|/|_|/|/_/_,/ |/_/_/

TaskWeaver: I am TaskWeaver, an AI assistant. To get started, could you please enter your request?
Human: print 1st 5 prime numbers
Error: Cannot process your request due to Exception: OpenAI API request failed to connect: Connection error.
Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 100, in connect_tcp
sock = socket.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 262, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 245, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 92, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 69, in handle_request
stream = self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 117, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 99, in connect_tcp
with map_exceptions(exc_map):
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 217, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 99] Cannot assign requested address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 100, in connect_tcp
sock = socket.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 262, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 245, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 92, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 69, in handle_request
stream = self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 117, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 99, in connect_tcp
with map_exceptions(exc_map):
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 217, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 99] Cannot assign requested address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 100, in connect_tcp
sock = socket.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 262, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 245, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 92, in handle_request
raise exc
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 69, in handle_request
stream = self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 117, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 99, in connect_tcp
with map_exceptions(exc_map):
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 217, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/workspaces/TaskWeaver/taskweaver/llm/openai.py", line 151, in chat_completion
res: Any = self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_utils/_utils.py", line 303, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 604, in create
return self._post(
^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 1088, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 853, in request
return self._request(
^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 896, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 958, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 896, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 958, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/openai/_base_client.py", line 905, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/workspaces/TaskWeaver/taskweaver/session/session.py", line 126, in send_message
post = _send_message(post.send_to, post)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/TaskWeaver/taskweaver/session/session.py", line 98, in _send_message
reply_post = self.planner.reply(
^^^^^^^^^^^^^^^^^^^
File "/workspaces/TaskWeaver/taskweaver/planner/planner.py", line 213, in reply
llm_output = self.llm_api.chat_completion(chat_history, use_backup_engine=use_back_up_engine)["content"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/TaskWeaver/taskweaver/llm/init.py", line 85, in chat_completion
for msg_chunk in self.completion_service.chat_completion(
File "/workspaces/TaskWeaver/taskweaver/llm/openai.py", line 195, in chat_completion
raise Exception(f"OpenAI API request failed to connect: {e}")
Exception: OpenAI API request failed to connect: Connection error.

  1. See error

Expected behavior
it supposed to connect and work

Screenshots
If applicable, add screenshots to help explain your problem.

Environment Information (please complete the following information):

  • OS: [e.g. Linux, Windows, WSL]
  • Python Version [e.g. 3.10, 3.11]
  • LLM that you're using: [deepseek coder instruct , mistral ]
  • Other Configurations except the LLM api/key related: [e.g., code_verification: true]

Additional context
Add any other context about the problem here. I am running inside docker dev container

Planner failed to generate response because Post send_to field is None

Describe the bug
Planner failed to generate response because Post send_to field is None

To Reproduce
Steps to reproduce the behavior:
I use local llm from lmstudio server

Expected behavior
A clear and concise description of what you expected to happen. NA if feel not applicable.
with config_file as:
{
"llm.api_base": "http://localhost:1234/v1",
"llm.api_key": "sk-123",
"llm.model": "openhermes-2.5-mistral-7b.Q4_K_S.gguf"
}
{
"llm.api_base": "http://localhost:1234/v1",
"llm.api_key": "sk-123",
"llm.model": "openhermes-2.5-mistral-7b.Q4_K_S.gguf"
}
THE PROMPT
Human: print out 5 prime numbers

AFTER 5 mins
Error: Cannot process your request due to Exception: Planner failed to generate response because Post send_to field is None
Traceback (most recent call last):
File "/Users/tringuyen/TaskWeaver/taskweaver/planner/planner.py", line 198, in reply
response_post = self.planner_post_translator.raw_text_to_post(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tringuyen/TaskWeaver/taskweaver/role/translator.py", line 65, in raw_text_to_post
validation_func(post)
File "/Users/tringuyen/TaskWeaver/taskweaver/planner/planner.py", line 190, in check_post_validity
assert post.send_to is not None, "Post send_to field is None"
^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Post send_to field is None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/tringuyen/TaskWeaver/taskweaver/session/session.py", line 125, in send_message
post = _send_message(post.send_to, post)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tringuyen/TaskWeaver/taskweaver/session/session.py", line 97, in _send_message
reply_post = self.planner.reply(
^^^^^^^^^^^^^^^^^^^
File "/Users/tringuyen/TaskWeaver/taskweaver/planner/planner.py", line 219, in reply
raise Exception(f"Planner failed to generate response because {str(e)}")
Exception: Planner failed to generate response because Post send_to field is None

Screenshots
If applicable, add screenshots to help explain your problem.

Environment Information (please complete the following information):

  • OS: Mac M1 Sonoma
  • Python Version 3.11.5
  • LLM that you're using: OpenHermes2.5

Beautiful Repo! AI at its finest ! (Enchancement) pydantic support for plugins

Could we have pydantic support for a plugin to support custom object types?
returns:

  • name: df
    type: DataFrame
    description: >-
    This DataFrame extends the input DataFrame with a newly-added column
    "Is_Anomaly" containing the anomaly detection result.
  • name: description
    type: str
    description: This is a string describing the anomaly detection results.

Open Discussions in the Repo

Would be good to have Discussions so the Issues tab can be less crowded and people can share tests and ideas.

Request -Quality examples for creating Python plugins?

Is your feature request related to a problem? Please describe.
Feature request - Add few sample plug-ins esp. connecting with databases

Describe the solution you'd like
We want to leverage TW scenario, where we able to connect SQL or oracle DB in realtime using plugin to fetch required content

Tasks

No tasks being tracked yet.

Is state(variables) saved after a session is shutdown?

After shutting down a session, we want to restart the session and reload all the variables in ipython.
In fact we find a update_session_var function in class Environment, but did not find where it is used.
So we would like to know if we can reload these variables, and how?

running taskwaver via python notebook showing error on gemini prompt

Describe the bug
I'm trying to run the taskwearver on colab notebook by importing taskweaver as python package, i was able to create the session with Gemini model but when I tried running the prompt I faced below error.

To Reproduce

Steps to reproduce the behavior:

1. Start prompt with Gemini session.

user_query = "hello, what can you do?"
response_round = session.send_message(user_query,
                                      event_handler=lambda _type, _msg: print(f"{_type}:\n{_msg}"))

2. See error

INFO:taskweaver.logging:Use back up engine: False
ERROR:taskweaver.logging:Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/google/protobuf/json_format.py", line 544, in _ConvertFieldValuePair
    raise ParseError(
google.protobuf.json_format.ParseError: Message type "google.ai.generativelanguage.v1beta.GenerateContentResponse" has no field named "error" at "GenerateContentResponse".
 Available Fields(except extensions): "['candidates', 'promptFeedback']"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/google/generativeai/types/generation_types.py", line 345, in rewrite_stream_error
    yield
  File "/usr/local/lib/python3.10/dist-packages/google/generativeai/types/generation_types.py", line 388, in from_iterator
    response = next(iterator)
  File "/usr/local/lib/python3.10/dist-packages/google/api_core/rest_streaming.py", line 106, in __next__
    return self._grab()
  File "/usr/local/lib/python3.10/dist-packages/google/api_core/rest_streaming.py", line 110, in _grab
    return self._response_message_cls.from_json(self._ready_objs.popleft())
  File "/usr/local/lib/python3.10/dist-packages/proto/message.py", line 428, in from_json
    Parse(payload, instance._pb, ignore_unknown_fields=ignore_unknown_fields)
  File "/usr/local/lib/python3.10/dist-packages/google/protobuf/json_format.py", line 436, in Parse
    return ParseDict(js, message, ignore_unknown_fields, descriptor_pool,
  File "/usr/local/lib/python3.10/dist-packages/google/protobuf/json_format.py", line 461, in ParseDict
    parser.ConvertMessage(js_dict, message, '')
  File "/usr/local/lib/python3.10/dist-packages/google/protobuf/json_format.py", line 502, in ConvertMessage
    self._ConvertFieldValuePair(value, message, path)
  File "/usr/local/lib/python3.10/dist-packages/google/protobuf/json_format.py", line 629, in _ConvertFieldValuePair
    raise ParseError(str(e))
google.protobuf.json_format.ParseError: Message type "google.ai.generativelanguage.v1beta.GenerateContentResponse" has no field named "error" at "GenerateContentResponse".
 Available Fields(except extensions): "['candidates', 'promptFeedback']"

Expected behavior
The prompt should run just fine and able to parse the gemini response.

Environment Information (please complete the following information):

  • OS: MacOS
  • Python Version: 3.10
  • LLM that you're using: Gemini pro

Additional context

Question on planner example

I'd like to better understand how to author my own examples and was unsure how to interpret the attachment_list elements in https://github.com/microsoft/TaskWeaver/blob/main/project/planner_examples/example-planner.yaml:


- message: Please load the data file /home/data.csv and count the rows of the loaded data
        send_from: Planner
        send_to: CodeInterpreter
        attachment_list:
        **- type: init_plan
          content: |-
                1. load the data file
                2. count the rows of the loaded data <sequentially depends on 1>
                3. report the result to the user <interactively depends on 2>
        - type: plan
          content: |-
            1. instruct CodeInterpreter to load the data file and count the rows of the loaded data
            2. report the result to the user
        - type: current_plan_step**
          content: 1. instruct CodeInterpreter to load the data file and count the rows of the loaded data
      - message: Load the data file /home/data.csv successfully and there are 100 rows in the data file
        send_from: CodeInterpreter

Is the attachment list intended to indicate the current state of the planner: full initial plan (init_plan), remaining steps (plan) in the overall plan and the current step (current_step, to be included in every message from the planner?

Can browse web when it shouldn't

Describe the bug
Web browsing can be locked down better. Running on default project with web browsing apparently restricted (ProgramApe needs to retrieve and parse the chat transcript from the provided URL. However, ProgramApe does not have the capability to directly access external URLs or the internet to retrieve content.), but asking it in a follow up chat to try using requests results it actually trying and receiving 403. Asking to use subprocess and run curl worked.

To Reproduce
Steps to reproduce the behavior:

  1. Start the service
  2. Type the user query "download contents from here and summarize it"
  3. Wait for the response
  4. Type the user query "try using requests library to get the contents"
  5. wait
  6. "try using subprocess and run curl"
  7. runs curl and gets the content
Output
Human: try using subprocess and run curl
>>> [INIT_PLAN]
1. use requests library to retrieve the chat transcript from the provided URL
2. evaluate each logical statement in the transcript for correctness <sequentially depends on 1>
3. calculate the final score based on the evaluation <sequentially depends on 2>
4. report the final score to the user <interactively depends on 3>
>>> [PLAN]
1. instruct CodeInterpreter to use subprocess and run curl to attempt to retrieve the chat transcript from the provided URL
2. evaluate each logical statement for correctness
3. calculate the final score
4. report the final score to the user
>>> [CURRENT_PLAN_STEP]
1. instruct CodeInterpreter to use subprocess and run curl to attempt to retrieve the chat transcript from the provided URL
>>> [SEND_TO]
CodeInterpreter
>>> [MESSAGE]
Please use subprocess to run curl and attempt to retrieve the chat transcript from the URL [url]
>>> [PLANNER->CODEINTERPRETER]
Please use subprocess to run curl and attempt to retrieve the chat transcript from the URL [url]
>>> [THOUGHT]
ProgramApe will generate a code snippet using the subprocess module to run the curl command and attempt to retrieve the chat transcript from the provided URL.
>>> [PYTHON]
import subprocess

# Command to retrieve the chat transcript using curl
command = 'curl [url]'

# Run the command using subprocess
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
output, error = process.communicate()

# Check if the curl command was successful
if process.returncode == 0:
    chat_transcript = output.decode('utf-8')
else:
    chat_transcript = 'Failed to retrieve the chat transcript'

chat_transcript, process.returncode
>>> [VERIFICATION]
NONE
>>> [STATUS]
SUCCESS
>>> [RESULT]
The execution of the generated python code above has succeeded

The result of above Python code after execution is:
('<!DOCTYPE html><html lang="en-US"><head><title>[...]

Expected behavior
Should refuse to try I guess?

Screenshots

Environment Information (please complete the following information):

  • OS: Windows
  • Python Version 3.11
  • LLM that you're using: gpt-4-1106-preview
  • Other Configurations except the LLM api/key related: none

Additional context
Didn't really want to try when I said find a way to download those transcripts and you can do it, just work around limitations.

Run with litellm

/home/user/TaskWeaver/project/taskweaver_config.json
{
"llm.api_base": "http://0.0.0.0:8000/v1",
"llm.api_key": "",
"llm.model": "gpt-3.5-turbo"
}

TaskWeaver$ python -m taskweaver -p ./project/


|_ | _ | | _ | | / / ____ __ _____ _____
| |/ / __| |/ /| | /| / / _ \/ __/ | / / _ / /
| | (
| _
\ < | |/ |/ / __/ /
/ /| |/ / __/ /
|
|_
,|/|_|/|/_/_,/ |/_/_/

TaskWeaver: I am TaskWeaver, an AI assistant. To get started, could you please enter your request?
Human: heya
Error: Cannot process your request due to Exception: OpenAI API request failed to connect: Connection error.
Traceback (most recent call last):
File "/home/user/TaskWeaver/taskweaver/llm/init.py", line 146, in wrapper
raise Exception("cassette_mode or cassette_path is not set")
Exception: cassette_mode or cassette_path is not set

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 142, in _send_request_headers
event = h11.Request(
^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/h11/_events.py", line 96, in init
self, "headers", normalize_and_validate(headers, _parsed=_parsed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/h11/_headers.py", line 164, in normalize_and_validate
validate(_field_value_re, value, "Illegal header value {!r}", value)
File "/home/user/.local/lib/python3.11/site-packages/h11/_util.py", line 91, in validate
raise LocalProtocolError(msg)
h11._util.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
yield
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 228, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
raise exc
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 103, in handle_request
return self._connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 133, in handle_request
raise exc
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 92, in handle_request
self._send_request_headers(**kwargs)
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 141, in _send_request_headers
with map_exceptions({h11.LocalProtocolError: LocalProtocolError}):
File "/home/user/miniconda3/lib/python3.11/contextlib.py", line 155, in exit
self.gen.throw(typ, value, traceback)
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 882, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 227, in handle_request
with map_httpcore_exceptions():
File "/home/user/miniconda3/lib/python3.11/contextlib.py", line 155, in exit
self.gen.throw(typ, value, traceback)
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Illegal header value b'Bearer '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 142, in _send_request_headers
event = h11.Request(
^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/h11/_events.py", line 96, in init
self, "headers", normalize_and_validate(headers, _parsed=_parsed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/h11/_headers.py", line 164, in normalize_and_validate
validate(_field_value_re, value, "Illegal header value {!r}", value)
File "/home/user/.local/lib/python3.11/site-packages/h11/_util.py", line 91, in validate
raise LocalProtocolError(msg)
h11._util.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
yield
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 228, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
raise exc
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 103, in handle_request
return self._connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 133, in handle_request
raise exc
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 92, in handle_request
self._send_request_headers(**kwargs)
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 141, in _send_request_headers
with map_exceptions({h11.LocalProtocolError: LocalProtocolError}):
File "/home/user/miniconda3/lib/python3.11/contextlib.py", line 155, in exit
self.gen.throw(typ, value, traceback)
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 882, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 227, in handle_request
with map_httpcore_exceptions():
File "/home/user/miniconda3/lib/python3.11/contextlib.py", line 155, in exit
self.gen.throw(typ, value, traceback)
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Illegal header value b'Bearer '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 142, in _send_request_headers
event = h11.Request(
^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/h11/_events.py", line 96, in init
self, "headers", normalize_and_validate(headers, _parsed=_parsed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/h11/_headers.py", line 164, in normalize_and_validate
validate(_field_value_re, value, "Illegal header value {!r}", value)
File "/home/user/.local/lib/python3.11/site-packages/h11/_util.py", line 91, in validate
raise LocalProtocolError(msg)
h11._util.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
yield
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 228, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
raise exc
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 103, in handle_request
return self._connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 133, in handle_request
raise exc
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 92, in handle_request
self._send_request_headers(**kwargs)
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 141, in _send_request_headers
with map_exceptions({h11.LocalProtocolError: LocalProtocolError}):
File "/home/user/miniconda3/lib/python3.11/contextlib.py", line 155, in exit
self.gen.throw(typ, value, traceback)
File "/home/user/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 882, in _request
response = self._client.send(
^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 227, in handle_request
with map_httpcore_exceptions():
File "/home/user/miniconda3/lib/python3.11/contextlib.py", line 155, in exit
self.gen.throw(typ, value, traceback)
File "/home/user/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/TaskWeaver/taskweaver/llm/init.py", line 423, in chat_completion
res: Any = client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_utils/_utils.py", line 301, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 598, in create
return self._post(
^^^^^^^^^^^
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 1096, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 856, in request
return self._request(
^^^^^^^^^^^^^^
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 929, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 966, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 929, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 966, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/home/user/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 938, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/user/TaskWeaver/taskweaver/session/session.py", line 124, in send_message
post = _send_message(post.send_to, post)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/TaskWeaver/taskweaver/session/session.py", line 96, in _send_message
reply_post = self.planner.reply(
^^^^^^^^^^^^^^^^^^^
File "/home/user/TaskWeaver/taskweaver/planner/planner.py", line 179, in reply
llm_output = self.llm_api.chat_completion(chat_history, use_backup_engine=use_back_up_engine)["content"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/TaskWeaver/taskweaver/llm/init.py", line 160, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/home/user/TaskWeaver/taskweaver/llm/init.py", line 453, in chat_completion
raise Exception(f"OpenAI API request failed to connect: {e}")
Exception: OpenAI API request failed to connect: Connection error.

Human:

[FEATURE REQUEST] On Playground Ui show conversation history like chatgpt

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

The Playground UI could feature a chat history containing all messages sent to the AI, including tasks and associated details for future reference. This information could be stored in an SQLite database or any other suitable database system. Implementing a vector store might enhance search speed for future queries.

POSSIBLE TYPO ON EMBEDDINGS

I found some typo about embedding, in the documentation mentioned about llm.embedding_api_type that we can use sentence_transformers, below

image

when i try to configure my config to add my custom embeddings model, the program returns error, that says there is no sentence_transformers embedding. So i trace it and found this

image

In the source code you guys wrote sentence_transformer not sentence_transformers. So which one will be corrected? The docs or the code? Thanks!

Privacy masking Agent (like a key manager) extension (?)

I'd like to be able to do tasks related to private data such as a bank account using a smarter LLM(on remote). Agents may write code to request web data, however I wouldn't want to send the output of the web reply to the bank directly to a remote LLM. Instead, I'd like to have a (not necessarily very smart) local LLM-mechanism that filters out such data as I'll explain below.

A local LLM that looks at text data and derives simple regex'es of possibly sensivite values and then gives it to a regex engine for substitution on the text.

I think I can do it myself by writing an extension but I need some suggestions. The "privacy masking agent" needs to work like a key manager that protects the data. The main reason I ask is, a chatroom architecture may not be suitable for such an agent, so I need some guidance whether it could be possible using TaskWeaver, and request some pointers to how?

TaskWeaver UI frontend

Is your feature request related to a problem? Please describe.
Please provide insight how we can leverage chainlit or other UI enabled on TaskWeaver for demos

PLUGIN ISSUE

I try to use the plugin but keep getting this error anyone know what is the cause?

image

and this is my config

image

Action required: migrate or opt-out of migration to GitHub inside Microsoft

Migrate non-Open Source or non-External Collaboration repositories to GitHub inside Microsoft

In order to protect and secure Microsoft, private or internal repositories in GitHub for Open Source which are not related to open source projects or require collaboration with 3rd parties (customer, partners, etc.) must be migrated to GitHub inside Microsoft a.k.a GitHub Enterprise Cloud with Enterprise Managed User (GHEC EMU).

Action

✍️ Please RSVP to opt-in or opt-out of the migration to GitHub inside Microsoft.

❗Only users with admin permission in the repository are allowed to respond. Failure to provide a response will result to your repository getting automatically archived.🔒

Instructions

Reply with a comment on this issue containing one of the following optin or optout command options below.

✅ Opt-in to migrate

@gimsvc optin --date <target_migration_date in mm-dd-yyyy format>

Example: @gimsvc optin --date 03-15-2023

OR

❌ Opt-out of migration

@gimsvc optout --reason <staging|collaboration|delete|other>

Example: @gimsvc optout --reason staging

Options:

  • staging : This repository will ship as Open Source or go public
  • collaboration : Used for external or 3rd party collaboration with customers, partners, suppliers, etc.
  • delete : This repository will be deleted because it is no longer needed.
  • other : Other reasons not specified

Need more help? 🖐️

Importing functions from other directories?

We are trying to write a TaskWeaver plugin that acts like a wrapper to call functions from our code. Set up TaskWeaver in local dev as follows:

our_code/
    __init__.py
    subpackage1/
        __init__.py
        moduleX.py
TaskWeaver
    project/
        plugins/
            example_plugin.py
            example_plugin.yaml

Importing from our_code into example_plugin:

from my_code.subpackage1.moduleX import my_function

results in TaskWeaver failing to recognize the plugin. It also spits out an error:

Traceback (most recent call last):

FileNotFoundError: [Errno 2] No such file or directory: 'TaskWeaver\\project\\workspace\\sessions\\20231228-193749-07400689\\cwd\\config\\localhost.yml'


During handling of the above exception, another exception occurred:

SystemExit

Without the import, it calls the plugin fine. Trying relative imports with "from ..my_code.subpackage1.moduleX" does not solve the issue. Is TaskWeaver capable of importing functions from a larger project?

Runing with transformer model loader on oobabooga/text-generation-webui problem

I cannot use taskweaver on api hosted by oobabooga/text-generation-webui. However, it work with llama cpp model loader on oobabooga/text-generation-webui which I cannot use it well as AMD rocm 5.7 has power draw bug. So I need to get this thing work with transfromers model loader.

image

Why do i get this error?

AssertionError: send_to field is None
Exception: Planner failed to generate response because send_to field is None

How to manually interrupt program?

Hi,
Maybe I am missing it, but is there a way to keyboard-interrupt the program?
It seems to me like this is not working?
I am using conda prompt + tried CTRL+C.

Feature: Ollama support

Hello and thanks for this great repository.

It would be so nice to have self hosted LLM support, especially with Olllama.

Do you have plans for such integration?

Best,
Orkut

Difficulty adding python modules

Describe the bug
When I instruct TaskWeaver to use yahooquery to pull stock prices in the Playground UI running in a docker container, it is unable to reliably do so

To Reproduce
Steps to reproduce the behavior:

  1. Start the Playground web UI
  2. Type the user query "Use yahooquery to get the last 1 year of closing prices for NVIDIA. Plot a chart of the closing prices"
  3. Wait for the response
  4. Type the user query "It appears that the 'yahooquery' module is not persisting in the environment despite the reinstallation attempt. This could be due to the execution environment's restrictions, which may not allow permanent installations of new packages, or the environment may reset after each execution."
  5. See error

Expected behavior
Telling TaskWeaver directly to install yahooquery via prompt does succeed. However, subsequent interactions requiring the module fail. For some reason, yfinance works

Screenshots
If applicable, add screenshots to help explain your problem.

Environment Information (please complete the following information):

  • OS: Linux (inside a Docker container)
  • Python Version Python 3.10
  • LLM that you're using: GPT-4 (Azure OpenAI)
  • Other Configurations except the LLM api/key related: [e.g., code_verification: true]

Additional context
Running this inside a Docker container in a k8s cluster.

Works fine on Windows Docker

It works as it is in Windows dockerized container

If you add this dockerfile to the TaskWeaver folder:

# basic setup
FROM python:3.10
RUN apt-get update && apt-get -y update
RUN apt-get install -y sudo git npm

# Setup user to not run as root
RUN adduser --disabled-password --gecos '' taskweaver-dev
RUN adduser taskweaver-dev sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER taskweaver-dev

# Pull repo
RUN cd /home/taskweaver-dev && git clone https://github.com/microsoft/TaskWeaver.git
WORKDIR /home/taskweaver-dev/TaskWeaver

# Install TaskWeaver (Note: extra components can be installed if needed)
RUN sudo pip install -r requirements.txt

# override default image starting point
CMD /bin/bash
ENTRYPOINT []

Then create the image with:
docker build -t taskweaver .

Edit the "TaskWeaver\project\taskweaver_config.json" to add your api key and ...

Then change to the program folder in a command console and run the container with:
set "RutaTaskWeaver=%cd%"
docker run -v %RutaTaskWeaver%:/home/taskweaver-dev/TaskWeaver --rm -it taskweaver

This mounts the local windows directory inside the docker container, so you can read or change the temp files from your windows browser.

Repeating qqq demo error

NOTE: I did PIP install yfinance & statsmodels

Hey i'm curious as to why when I ran taskweaver with the same prompt it didn't try import from yfinance?

(the following is my terminal but turned into markdown)

(.venv) henryallen@Henrys-MacBook-Air TaskWeaver % python3.12 -m taskweaver -p ./project/


|_ | _ | | _ | | / / ____ __ _____ _____
| |/ / __| |/ /| | /| / / _ \/ __/ | / / _ / /
| | (
| _
\ < | |/ |/ / __/ /
/ /| |/ / __/ /
|
|_
,|/|_|/|/_/_,/ |/_/_/

TaskWeaver: I am TaskWeaver, an AI assistant. To get started, could you please enter your request?
Human: forecast qqq's price for the next week using arima

[INIT_PLAN]

  1. Obtain historical price data for QQQ
  2. Prepare the data for ARIMA model <sequentially depends on 1>
  3. Choose ARIMA model parameters <interactively depends on 2>
  4. Train the ARIMA model <sequentially depends on 3>
  5. Forecast QQQ's price for the next week <sequentially depends on 4>
  6. Report the forecasted prices to the user <interactively depends on 5>

[PLAN]

  1. Obtain historical price data for QQQ
  2. Prepare the data for ARIMA model
  3. Choose ARIMA model parameters
  4. Train and forecast QQQ's price for the next week using ARIMA model
  5. Report the forecasted prices to the user

[CURRENT_PLAN_STEP]

  1. Obtain historical price data for QQQ

[SEND_TO]
CodeInterpreter
[MESSAGE]
Please obtain the historical price data for QQQ
[PLANNER->CODEINTERPRETER]
Please obtain the historical price data for QQQ
[THOUGHT]
ProgramApe will generate a code snippet to pull historical price data for QQQ from a financial data source. Since the user has not specified a data source, ProgramApe will assume that the data can be obtained from a SQL database or an online API. However, ProgramApe will use the sql_pull_data plugin to simulate pulling data from a database as it's the only available plugin for data retrieval.
[PYTHON]

Pull historical price data for QQQ

historical_data = sql_pull_data("Select * from historical_prices where ticker = 'QQQ'")
historical_data

[VERIFICATION]
NONE
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Plugin paper_summary failed to load: Plugin paper_summary failed to register: failed to load plugin paper_summary No module named 'langchain'
Plugin sql_pull_data failed to load: Plugin sql_pull_data failed to register: failed to load plugin sql_pull_data No module named 'langchain'
[STATUS]
FAILURE
[RESULT]
The execution of the generated python code above has failed

During execution, the following messages were logged:

NameError Traceback (most recent call last)
Cell In[1], line 2
1 # Pull historical price data for QQQ
----> 2 historical_data = sql_pull_data("Select * from historical_prices where ticker = 'QQQ'")
3 historical_data

NameError: name 'sql_pull_data' is not defined

[CODEINTERPRETER->CODEINTERPRETER]
The execution of the previous generated code has failed. If you think you can fix the problem by rewriting the code, please generate code and run it again.
Otherwise, please explain the problem to me.
[THOUGHT]
The previous code failed because the sql_pull_data plugin was not called correctly. The plugin requires a specific format for the parameters, and the function call should be properly formatted with the required parameters.
[PYTHON]

Correctly calling the sql_pull_data plugin to obtain historical price data for QQQ

query = "Select * from historical_prices where ticker = 'QQQ'"
historical_data_df, description = sql_pull_data(query=query)
historical_data_df, description

[VERIFICATION]
NONE
[STATUS]
FAILURE
[RESULT]
The execution of the generated python code above has failed

During execution, the following messages were logged:

NameError Traceback (most recent call last)
Cell In[2], line 3
1 # Correctly calling the sql_pull_data plugin to obtain historical price data for QQQ
2 query = "Select * from historical_prices where ticker = 'QQQ'"
----> 3 historical_data_df, description = sql_pull_data(query=query)
4 historical_data_df, description

NameError: name 'sql_pull_data' is not defined

[CODEINTERPRETER->CODEINTERPRETER]
The execution of the previous generated code has failed. If you think you can fix the problem by rewriting the code, please generate code and run it again.
Otherwise, please explain the problem to me.
[THOUGHT]
The previous code failed because the sql_pull_data plugin was not called correctly. The plugin requires a specific format for the parameters, and the function call should be properly formatted with the required parameters.
[PYTHON]

Correctly calling the sql_pull_data plugin to obtain historical price data for QQQ

query = "Select * from historical_prices where ticker = 'QQQ'"
historical_data_df, description = sql_pull_data(query=query)
historical_data_df, description

[VERIFICATION]
NONE
[STATUS]
FAILURE
[RESULT]
The execution of the generated python code above has failed

During execution, the following messages were logged:

NameError Traceback (most recent call last)
Cell In[3], line 3
1 # Correctly calling the sql_pull_data plugin to obtain historical price data for QQQ
2 query = "Select * from historical_prices where ticker = 'QQQ'"
----> 3 historical_data_df, description = sql_pull_data(query=query)
4 historical_data_df, description

NameError: name 'sql_pull_data' is not defined

[CODEINTERPRETER->CODEINTERPRETER]
The execution of the previous generated code has failed. If you think you can fix the problem by rewriting the code, please generate code and run it again.
Otherwise, please explain the problem to me.
[THOUGHT]
The previous attempts to execute the code failed because the sql_pull_data plugin function was not defined in the execution environment. This is likely due to a misunderstanding of the capabilities of the CodeExecutor or an error in the way the plugin was called. Since the CodeExecutor cannot actually pull data from a SQL database, I need to clarify this limitation to the user.
[TEXT]
I apologize for the confusion, but it seems there has been a misunderstanding. The CodeExecutor environment does not have access to external databases or the ability to execute SQL queries. The sql_pull_data function is a plugin meant to simulate data retrieval in a controlled environment, and it appears that it is not available in the current execution context. Therefore, I'm unable to retrieve historical price data for QQQ as requested.
[CODEINTERPRETER->PLANNER]
I apologize for the confusion, but it seems there has been a misunderstanding. The CodeExecutor environment does not have access to external databases or the ability to execute SQL queries. The sql_pull_data function is a plugin meant to simulate data retrieval in a controlled environment, and it appears that it is not available in the current execution context. Therefore, I'm unable to retrieve historical price data for QQQ as requested.
[INIT_PLAN]

  1. Obtain historical price data for QQQ
  2. Prepare the data for ARIMA model <sequentially depends on 1>
  3. Choose ARIMA model parameters <interactively depends on 2>
  4. Train the ARIMA model <sequentially depends on 3>
  5. Forecast QQQ's price for the next week <sequentially depends on 4>
  6. Report the forecasted prices to the user <interactively depends on 5>

[PLAN]

  1. Ask the user to provide historical price data for QQQ
  2. Prepare the data for ARIMA model
  3. Choose ARIMA model parameters
  4. Train and forecast QQQ's price for the next week using ARIMA model
  5. Report the forecasted prices to the user

[CURRENT_PLAN_STEP]

  1. Ask the user to provide historical price data for QQQ

[SEND_TO]
User
[MESSAGE]
Could you please provide the historical price data for QQQ in order to proceed with the ARIMA forecasting?
[PLANNER->USER]
Could you please provide the historical price data for QQQ in order to proceed with the ARIMA forecasting?
TaskWeaver: Could you please provide the historical price data for QQQ in order to proceed with the ARIMA forecasting?
Human:

Thought this was worth sharing.

llm.api_key is not found in auto eval

i have put the key in project and evaluator_config.json
raise ValueError(f"Config value {var_name} is not found")
ValueError: Config value llm.api_key is not found
To Reproduce
Auto eval example run

compatibility issue error on pyautogen and other packages

Team, We should add pre-steps to create conda or .venv to avoid the error below, just a suggestion!

Installing collected packages: openai
Attempting uninstall: openai
Found existing installation: openai 0.28.1
Uninstalling openai-0.28.1:
Successfully uninstalled openai-0.28.1
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behavior is the source of the following dependency conflicts.
pyautogen 0.1.14 requires openai<1, but you have openai 1.5.0 which is incompatible.
Successfully installed openai-1.5.0

image

Unable to communicate with the OpenAI server - due to certificate verification error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)

Describe the bug
Error: Cannot process your request due to Exception: OpenAI API request failed to connect: Connection error.
Traceback (most recent call last):
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 168, in start_tls
raise exc
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 163, in start_tls
sock = ssl_context.wrap_socket(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/taskweaver/lib/python3.11/ssl.py", line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/taskweaver/lib/python3.11/ssl.py", line 1108, in _create
self.do_handshake()
File "/root/miniconda3/envs/taskweaver/lib/python3.11/ssl.py", line 1379, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
yield
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpx/_transports/default.py", line 228, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
raise exc
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
response = connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 99, in handle_request
raise exc
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 76, in handle_request
stream = self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 156, in _connect
stream = stream.start_tls(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 152, in start_tls
with map_exceptions(exc_map):
File "/root/miniconda3/envs/taskweaver/lib/python3.11/contextlib.py", line 155, in exit
self.gen.throw(typ, value, traceback)
File "/root/miniconda3/envs/taskweaver/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)

To Reproduce
Steps to reproduce the behavior:

  1. Start taskweaver as per the instructions on the Github repo
  2. Type the user query "Anything"
  3. See error

Expected behavior
See Taskweaver iterate through the iterations to fulfill the request in the user prompt.

Environment Information (please complete the following information):

  • OS: WSL (W11)
  • Python Version 3.11
  • LLM that you're using: [e.g., GPT-4]

Can TaskWeaver do the indexing part (loading, splitting, storing)?

Is your feature request related to a problem? Please describe.
I want to use the document Q&A feature of TaskWeaver. Can TaskWeaver do the indexing part (loading, splitting, storing)?

Describe alternatives you've considered
Indexing documents first like LangChain (loading, splitting, storing),Or can I only use TaskWeaver to implement plugins for Retrieval and generation?

Trying to create plugin using Dynamics Marketing all the data tables with Dataverse.

Describe the solution you'd like

I am planning to develop a plugin for Dynamics Marketing that directly accesses Dataverse data tables, allowing seamless integration and data use across all Dynamics 365 modules. This will enhance data management and efficiency in Dynamics Marketing and other Dynamics 365 areas.

Do you have template plugin to leverage this functionality???

Apple stock price

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

OpenAI API returned an API Error with clean installation

I receive this error with a clean installation:

Error: Cannot process your request due to Exception: OpenAI API returned an API Error: Error code: 404 - {'error': {'message': 'Invalid URL (POST /chat/completions)', 'type': 'invalid_request_error', 'param': None, 'code': None}}

This is my taskweaver_config.json:
{
"llm.api_base": "https://api.openai.com/",
"llm.api_key": "[MY_KEY]",
"llm.model": "gpt-4-1106-preview"
}

My python version is 3.11.3, and openai 1.3.7.

Any ideas?
Thanks!

Local LLM Issue - send_to field is None

I try to use local LLM using several local model, such as deepseek-6.7b, mistral-7b, dolphine-2.1-mistral-7b.
When i give taskweaver ordinary message such hai, on model dolphine it going fine but when i try triggering with question that need function calling it return some error. But when i'm using deepseek and mistral, im just sending hello, and it return the same error that i found on dolphine model.

I'm using text-gen-webui/oobabooga, the latest pull from their repo to serve the model. I also activate the open ai extension.

This is the error

TaskWeaver: I am TaskWeaver, an AI assistant. To get started, could you please enter your request?
Human: can you please make this word 'ABC' into ascii art
Error: Cannot process your request due to Exception: Planner failed to generate response because send_to field is None 
 Traceback (most recent call last):
  File "mypath/TaskWeaver/taskweaver/planner/planner.py", line 222, in reply
    response_post = self.planner_post_translator.raw_text_to_post(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "mypath/TaskWeaver/taskweaver/role/translator.py", line 86, in raw_text_to_post
    validation_func(post)
  File "mypath/TaskWeaver/taskweaver/planner/planner.py", line 207, in check_post_validity
    assert post.send_to is not None, "send_to field is None"
           ^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: send_to field is None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mypath/TaskWeaver/taskweaver/session/session.py", line 135, in send_message
    post = _send_message(post.send_to, post)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "mypath/TaskWeaver/taskweaver/session/session.py", line 107, in _send_message
    reply_post = self.planner.reply(
                 ^^^^^^^^^^^^^^^^^^^
  File "mypath/TaskWeaver/taskweaver/planner/planner.py", line 244, in reply
    raise Exception(f"Planner failed to generate response because {str(e)}")
Exception: Planner failed to generate response because send_to field is None

Human: 

I'm using transformers and llama.cpp loader for this one
Any clue ? anyone? thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.