Table of Contents
Revealing the core architecture of TaskWeaver
The specific process of TaskWeaver
Home Technology peripherals AI TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions

TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions

Jan 17, 2024 am 08:36 AM
data train

Data analysis has always been a key tool in modern society, helping us deeply understand the essence, discover patterns and guide decision-making. However, the data analysis process is often complex and time-consuming, so we expect an intelligent assistant that can interact directly with the data. With the development of large language models (LLM), virtual assistants and intelligent agents such as Copilot have emerged one after another, and their performance in natural language understanding and generation is amazing. Unfortunately, however, existing agent frameworks still face difficulties in handling complex data structures (such as DataFrame, ndarray, etc.) and introducing domain knowledge, which is exactly the core requirement in data analysis and professional fields.

In order to better solve the bottleneck problem of voice assistants when performing tasks, Microsoft launched an Agent framework called TaskWeaver. The framework is code-first and can intelligently convert users' natural language requests into executable code, while supporting multiple data structures and dynamic plug-in selection. In addition, TaskWeaver can also be professionally adapted according to the planning process in different fields, fully utilizing the potential of large language models. As an open source framework, TaskWeaver provides customizable examples and plug-ins that can incorporate knowledge in specific fields, allowing users to easily create personalized virtual assistants. The launch of TaskWeaver will effectively improve the intelligence level of voice assistants and meet users' growing needs for personalized virtual assistants.

TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions

  • Thesis: TaskWeaver: A Code-First Agent Framework
  • Thesis address: https ://export.arxiv.org/abs/2311.17541

The TaskWeaver project has been open sourced on GitHub and appeared on the GitHub trending list on the day of release. Currently, the project has received 2.9k stars and has received good response. In addition, there are also some practical cases on social platforms such as LinkedIn, such as using TaskWeaver for SAP data analysis. These cases demonstrate the utility and value of TaskWeaver.

TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions


  • Project homepage: https://microsoft.github.io/TaskWeaver/
  • Project address: https://github.com/microsoft/TaskWeaver

##Story example

Tracking the hidden secrets in sales data

Xiaoya is a business analyst, and one of her jobs is from Look for anomalies in recent sales data and guide the company to adjust sales strategies based on those anomalies. All sales data is securely stored in a SQL database. She hopes to be able to easily extract and analyze data through natural language communication with an AI assistant. Of particular importance is the fact that in the sales world, anomalies are unique, so she hopes the AI ​​assistant can employ customized anomaly detection algorithms to solve this problem. The following is the chat record between Xiaoya and the AI ​​assistant (Figure 1), showing the interaction between them. Xiaoya: Hello, I need help extracting sales data from the database and analyzing it. AI assistant: OK, I will extract the corresponding data from the database right away. I will present the extracted data to you later for confirmation. Xiaoya: Thank you very much. (After awhile) AI assistant: I have extracted the sales data from the database. The following is an overview of the data, please confirm. (Overview of data displayed by AI assistant) Xiaoya: The data looks good, please continue with anomaly detection and analysis. AI Assistant: Got it. I'll perform the analysis using our custom anomaly detection algorithm and show you intuitive visualizations as soon as possible. (After awhile) AI Assistant: Analysis completed. Please view the following visualization results. (AI assistant displays visual results) Xiaoya: Thank you very much for your help! These results are very valuable to me. AI Assistant: Glad to help you. If you have any further questions or need further analysis, feel free to let me know. Xiaoya: Of course, thank you for your support.

TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions

Figure 1. Conversation transcript in the story example

What skills are required for the Agent framework?

Through the above-mentioned Xiaoya’s story, we have sorted out several core capabilities that the Agent framework should have:

1. Plug-in support: In the above story, the Agent needs to get data from the database and then use the specified anomaly detection algorithm. In order to accomplish these tasks, the smart assistant needs to be able to define and call custom plugins, such as the "query_database" plugin and the "anomaly_detection" plugin.

2. Rich data structure support: Agent needs to process complex data structures, such as arrays, matrices, table data, etc., thus Smoothly perform advanced data processing such as prediction, clustering, and more. Furthermore, this data should be passed seamlessly between different plugins. However, most existing agent frameworks convert the intermediate results of data analysis into text in Prompt, or save them as local files first and then read them when needed. However, these practices are prone to errors and exceeding the Prompt word limit.

3. Stateful execution: Agent often needs to interact with the user for multiple rounds of iterations, and generate and execute code based on user input. . Therefore, the execution state of these codes should be preserved throughout the session until the session ends.

4. Reason first and then act (ReAct) : Agent should have the ability of ReAct, that is, observe reasoning first and then take action. This is very necessary in some scenarios where uncertainty exists. For example, in the above example, since the data schema (schema) in the database is usually diverse, the Agent must first obtain the data schema information and understand which columns are appropriate (and confirm with the user), and then the corresponding columns can be name is input into the anomaly detection algorithm.

5. Generate arbitrary code: Sometimes, the predefined plug-in cannot satisfy the user's request, and the Agent should be able to generate code to deal with it. Temporary needs of users. In the above example, the Agent needs to generate code to visualize the detected anomalies, and this process is achieved without the help of any plug-ins.

6. Integrate domain knowledge: Agent should provide a systematic solution to integrate knowledge in specific fields. This will help LLM with better planning and accurate invocation of tools, thereby producing reliable results, especially in industry-tailored scenarios.

Revealing the core architecture of TaskWeaver

Figure 2 shows the overall architecture of TaskWeaver, including Planner, Code Interpreter Interpreter), and memory module (Memory).

The planner is like the brain of the system. It has two core responsibilities: 1) Make plans, that is, split the user's needs into subtasks and send these subtasks one by one to Code interpreter, and self-adjust the plan as needed during the entire plan execution process; 2) Respond to the user, it will convert the feedback results of the code interpreter into answers that are easy for the user to understand and send them to the user.

The code interpreter is mainly composed of two components: the code generator (Code Generator) will receive subtasks sent by the planner, combined with existing available plug-ins and domain-specific tasks Example to generate the corresponding code block; the code executor (Code Executor) is responsible for executing the generated code and maintaining the execution state throughout the session. Because of this, complex data structures can be passed in memory without going through prompts or the file system. It's like programming in Python in Jupyter Notebook, where the user enters a snippet of code into a cell, and the internal state of the program is preserved during sequential execution and can be referenced by subsequent processes. In terms of implementation, in each session, the code executor will have an independent Python process to execute the code, thus supporting multiple users at the same time.

The memory module mainly stores useful information during the operation of the entire system, such as execution results, etc., and can be written and read by different modules. Short-term memory mainly includes communication records between the user and TaskWeaver in the current session, as well as communication records between modules. Long-term memory includes domain knowledge that can be customized by the user in advance, as well as some experiences summarized during the interaction process, etc.

TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions

Figure 2. TaskWeaver overall architecture diagram

In addition to the basic architecture, TaskWeaver also has many unique designs. For example, session compression reduces text size, allowing for more conversation turns, and dynamic plug-in selection automatically picks appropriate plug-ins based on user requests, allowing for the integration of more custom plug-ins. In addition, TaskWeaver also supports the experience saving function, which can be triggered by users entering commands during use. It will summarize the user's experience and lessons in the current session, avoid repeating mistakes in the next session, and achieve true personalization. In terms of security, TaskWeaver is also carefully designed. For example, users can specify a whitelist of Python modules. If the generated code references modules outside the whitelist, an error will be triggered, thereby reducing security risks.

The specific process of TaskWeaver

Figure 3 shows us part of the process of TaskWeaver completing the aforementioned sample tasks.

First, the planner receives user input and generates specific plans based on the functional descriptions of each module and planning examples. The plan contains four subtasks, the first of which is to extract data from the database and describe the data schema.

The code generator then generates a piece of code based on its capability description and the definition of all related plug-ins. This code calls the sql_pull_data plugin to save the data into a DataFrame and provide a description of the data schema.

Finally, the generated code will be sent to the code executor for execution, and the completed results will be sent to the planner to update the plan or proceed to the next subtask. The execution results in the figure show that there are two columns in the DataFrame, namely date and value. The planner can further confirm with the user whether these columns are correct, or directly proceed to the next step of calling the anomaly_detection plug-in.

TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions

Figure 3. TaskWeaver internal workflow

How to inject domain knowledge into TaskWeaver?

In large model applications, the main purpose of integrating domain-specific knowledge is to improve the generalization performance of LLM in industry customization. TaskWeaver provides three ways to inject domain knowledge into the model:

  • Customize using plug-ins: Users can customize Integrate domain knowledge in the form of plug-ins. Plug-ins can come in many forms, such as calling an API, grabbing data from a specific database, or running a specific machine learning algorithm or model. Plug-in customization is relatively straightforward. You only need to provide basic information about the plug-in (including plug-in name, function description, input parameters and return values) and Python implementation.
  • Customize using examples: TaskWeaver also provides users with a systematic interface ( in YAML format) to teach LLM how to respond to user requests. Specifically, examples can be divided into two types, used for planning in the planner and code programming in the code generator.
  • Save experience: TaskWeaver supports users to summarize and store the current session process as long-term memory . Users can “teach” TaskWeaver their domain knowledge as conversations and then save the conversations as experiences. In the subsequent use process, you can better complete professional field problems by dynamically loading experience.

#How to use TaskWeaver?

The complete code for TaskWeaver is now open source on GitHub. Currently, three solutions are supported for use, namely command line startup, web service, and import in the form of Python library. After a simple installation, users only need to configure a few key parameters, such as LLM API address, key, and model name, to easily start the TaskWeaver service.

TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions

Figure 4. Command line startup interface

TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions

Figure 5. TaskWeaver running example

TaskWeaver is a new Agent framework solution designed to meet the needs of data analysis and industry customization scenarios. By converting user language into programming language, "talking to data" will no longer be a dream, but a reality.

The above is the detailed content of TaskWeaver: an open source framework that facilitates data analysis and industry customization to build excellent Agent solutions. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Use ddrescue to recover data on Linux Use ddrescue to recover data on Linux Mar 20, 2024 pm 01:37 PM

DDREASE is a tool for recovering data from file or block devices such as hard drives, SSDs, RAM disks, CDs, DVDs and USB storage devices. It copies data from one block device to another, leaving corrupted data blocks behind and moving only good data blocks. ddreasue is a powerful recovery tool that is fully automated as it does not require any interference during recovery operations. Additionally, thanks to the ddasue map file, it can be stopped and resumed at any time. Other key features of DDREASE are as follows: It does not overwrite recovered data but fills the gaps in case of iterative recovery. However, it can be truncated if the tool is instructed to do so explicitly. Recover data from multiple files or blocks to a single

Open source! Beyond ZoeDepth! DepthFM: Fast and accurate monocular depth estimation! Open source! Beyond ZoeDepth! DepthFM: Fast and accurate monocular depth estimation! Apr 03, 2024 pm 12:04 PM

0.What does this article do? We propose DepthFM: a versatile and fast state-of-the-art generative monocular depth estimation model. In addition to traditional depth estimation tasks, DepthFM also demonstrates state-of-the-art capabilities in downstream tasks such as depth inpainting. DepthFM is efficient and can synthesize depth maps within a few inference steps. Let’s read about this work together ~ 1. Paper information title: DepthFM: FastMonocularDepthEstimationwithFlowMatching Author: MingGui, JohannesS.Fischer, UlrichPrestel, PingchuanMa, Dmytr

Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Apr 01, 2024 pm 07:46 PM

The performance of JAX, promoted by Google, has surpassed that of Pytorch and TensorFlow in recent benchmark tests, ranking first in 7 indicators. And the test was not done on the TPU with the best JAX performance. Although among developers, Pytorch is still more popular than Tensorflow. But in the future, perhaps more large models will be trained and run based on the JAX platform. Models Recently, the Keras team benchmarked three backends (TensorFlow, JAX, PyTorch) with the native PyTorch implementation and Keras2 with TensorFlow. First, they select a set of mainstream

Hello, electric Atlas! Boston Dynamics robot comes back to life, 180-degree weird moves scare Musk Hello, electric Atlas! Boston Dynamics robot comes back to life, 180-degree weird moves scare Musk Apr 18, 2024 pm 07:58 PM

Boston Dynamics Atlas officially enters the era of electric robots! Yesterday, the hydraulic Atlas just "tearfully" withdrew from the stage of history. Today, Boston Dynamics announced that the electric Atlas is on the job. It seems that in the field of commercial humanoid robots, Boston Dynamics is determined to compete with Tesla. After the new video was released, it had already been viewed by more than one million people in just ten hours. The old people leave and new roles appear. This is a historical necessity. There is no doubt that this year is the explosive year of humanoid robots. Netizens commented: The advancement of robots has made this year's opening ceremony look like a human, and the degree of freedom is far greater than that of humans. But is this really not a horror movie? At the beginning of the video, Atlas is lying calmly on the ground, seemingly on his back. What follows is jaw-dropping

Slow Cellular Data Internet Speeds on iPhone: Fixes Slow Cellular Data Internet Speeds on iPhone: Fixes May 03, 2024 pm 09:01 PM

Facing lag, slow mobile data connection on iPhone? Typically, the strength of cellular internet on your phone depends on several factors such as region, cellular network type, roaming type, etc. There are some things you can do to get a faster, more reliable cellular Internet connection. Fix 1 – Force Restart iPhone Sometimes, force restarting your device just resets a lot of things, including the cellular connection. Step 1 – Just press the volume up key once and release. Next, press the Volume Down key and release it again. Step 2 – The next part of the process is to hold the button on the right side. Let the iPhone finish restarting. Enable cellular data and check network speed. Check again Fix 2 – Change data mode While 5G offers better network speeds, it works better when the signal is weaker

The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks Apr 29, 2024 pm 06:55 PM

I cry to death. The world is madly building big models. The data on the Internet is not enough. It is not enough at all. The training model looks like "The Hunger Games", and AI researchers around the world are worrying about how to feed these data voracious eaters. This problem is particularly prominent in multi-modal tasks. At a time when nothing could be done, a start-up team from the Department of Renmin University of China used its own new model to become the first in China to make "model-generated data feed itself" a reality. Moreover, it is a two-pronged approach on the understanding side and the generation side. Both sides can generate high-quality, multi-modal new data and provide data feedback to the model itself. What is a model? Awaker 1.0, a large multi-modal model that just appeared on the Zhongguancun Forum. Who is the team? Sophon engine. Founded by Gao Yizhao, a doctoral student at Renmin University’s Hillhouse School of Artificial Intelligence.

Kuaishou version of Sora 'Ke Ling' is open for testing: generates over 120s video, understands physics better, and can accurately model complex movements Kuaishou version of Sora 'Ke Ling' is open for testing: generates over 120s video, understands physics better, and can accurately model complex movements Jun 11, 2024 am 09:51 AM

What? Is Zootopia brought into reality by domestic AI? Exposed together with the video is a new large-scale domestic video generation model called "Keling". Sora uses a similar technical route and combines a number of self-developed technological innovations to produce videos that not only have large and reasonable movements, but also simulate the characteristics of the physical world and have strong conceptual combination capabilities and imagination. According to the data, Keling supports the generation of ultra-long videos of up to 2 minutes at 30fps, with resolutions up to 1080p, and supports multiple aspect ratios. Another important point is that Keling is not a demo or video result demonstration released by the laboratory, but a product-level application launched by Kuaishou, a leading player in the short video field. Moreover, the main focus is to be pragmatic, not to write blank checks, and to go online as soon as it is released. The large model of Ke Ling is already available in Kuaiying.

Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! May 06, 2024 pm 04:13 PM

The latest video of Tesla's robot Optimus is released, and it can already work in the factory. At normal speed, it sorts batteries (Tesla's 4680 batteries) like this: The official also released what it looks like at 20x speed - on a small "workstation", picking and picking and picking: This time it is released One of the highlights of the video is that Optimus completes this work in the factory, completely autonomously, without human intervention throughout the process. And from the perspective of Optimus, it can also pick up and place the crooked battery, focusing on automatic error correction: Regarding Optimus's hand, NVIDIA scientist Jim Fan gave a high evaluation: Optimus's hand is the world's five-fingered robot. One of the most dexterous. Its hands are not only tactile

See all articles