...
Module agent system message is updated dynamically, depending on previous function calls and results. E.g. the information about referencing style is only appended if sources are found in previous function calls.
Modules need to be redesigned such that they include a look of function calling. Each functionality of the module needs to be abstracted into a function that is usable across different modules
Like this, we build up a collection of functions that can be activated/deactivated for new modules
Archive:
There are two distinct styles of interaction with function calling stand out: loop interaction and sequential function execution.
1. Loop Interaction (Dynamic, Iterative Flow)
In the loop interaction style, the agent operates iteratively, continuously evaluating the user input in conjunction with previous results to determine the next necessary steps. This dynamic loop involves several key components:
Agent Evaluation: The agent receives the user's input and evaluates whether one or multiple functions are needed to process the request. It checks whether function calls are required, based on the specific query and the current context.
Function Execution: If functions are needed, the agent initiates them.
State Object: A central state object maintains the context throughout the interaction, storing the history of all prior function calls, user inputs, and their respective results. This state serves as a memory, ensuring the agent has full context for each iteration.
Iterative Process: Once function outputs are received, the agent reassesses whether more functions are required based on the current context and results. The process continues iteratively, looping back to the agent evaluation stage until:
The query is fully satisfied (i.e., the agent reaches a "finished" status).
A maximum number of iterations is reached, ensuring that the loop doesn’t run indefinitely.
Example Scenario:
A user asks, "What is the stock of the week and what is its price?"
First, the agent determines that it needs to call a function to identify the "stock of the week", e.g. AstraZeneca
Once this function is executed and the stock is identified, the agent re-evaluates and sees that it now needs to retrieve the price for this specific stock (AstraZeneca) in the database.
The process loops until both pieces of information are gathered, and then the final response is presented to the user.
This style is ideal for situations where information is interdependent or requires multiple layers of decision-making and real-time evaluation.
2. Sequential Function Execution (One-Time Evaluation, Linear Flow)
❗ ChatGPT is atm using this flow → /wiki/spaces/Q/pages/646119595
In contrast, the sequential function execution style is simpler and involves only one round of agent evaluation. The key aspects of this approach are:
Single Agent Evaluation: The agent is called once to assess the user’s input. In this single step, it determines all necessary tasks and corresponding functions as well as the order in which they should be executed. This is a more straightforward process where no further agent involvement is needed after the initial evaluation.
Predefined Function Sequence: After the agent identifies which functions are needed, they are executed sequentially, one after the other, in the defined order. Each function’s output is either returned directly to the user or passed as input to the next function in the chain. The agent doesn't loop back or reassess the situation once the sequence has started.
No Further Re-evaluation: After all the functions are executed as initially determined by the agent, the flow ends. There is no iterative re-checking or reassessment of whether additional function calls are needed.
Example Scenario:
A user asks, "What is the weather in Zurich, and create an image about it."
The agent first calls a function to retrieve the weather in Zurich.
Once the weather information is obtained, it then calls another function to create an image based on the weather data.
Both functions are executed sequentially, and the agent doesn’t re-evaluate after each step. The flow finishes once all functions are complete.
This style is more efficient for cases where the tasks are independent, and the function calls do not require dynamic re-evaluation after each step. It provides a more linear, predictable process flow.
Key Differences Between the Two Styles:
Aspect | Loop Interaction | Sequential Function Execution |
---|---|---|
Agent Involvement | Continuous re-evaluation after each function call. | Single evaluation, no reassessment after execution. |
Function Execution | Functions are called dynamically, based on ongoing evaluation. | Functions are called in a predefined sequence, determined in the initial step. |
Ideal for | Complex queries where outputs depend on previous results. | Simple, independent queries where outputs can be processed in a fixed order. |
...