Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Orchestrartor: The Agent decides on what of the tools given should be choosen in this case the Document Search

  2. Document SearchPrompt Rephrasor: The Agent asks another agent (Prompt Rephrasor) to rephrase the question to better incorporate the history into it and makes sure the text is in the language of the underlying documents to produce better matches. Here the API is used to retreive documents using different search techniques resulting in a flow to extract

    1. VectorSearch

    2. Full-text search (optional)

    3. Combine the two (optional)

    4. Rerank the results (optional)

  3. Relevancy Checker: This Agent is checking the found document parts for relevancy with LLMs is that chunk relevant for answering the given question, if not remove the chunk to not confuse the model during answer. Highly paralellized to get the results fast. (optional)

  4. Document Search: The Agents uses the document Search alongside the information of the user and the Prompt to then filter down the Documents to the correct ones and surfaces the information to another Agent (Librarian) that is able to assemble the information into an answer with References

  5. Document SearchHalucination check: The given information is taken by yet another Agent (Hallucinator Checker) to check if the answer given is hallucinated by checking the relevant resource and checking the information content on both.

  6. Answer revision: As an optional next step the agent (Answer Revisor) can decide based on the outcome of the hallucination check to make another attempt at answering the question. (not yet implemented)

Here a diagram that illustrates that process:

Drawio
simple
mVer2
simple0
zoom1
0inComment0custContentId765558908
pageId765788213
lboxcustContentId1765558908
diagramDisplayNameUntitled Diagram-1726046119284.drawio
lbox1
contentVer12
revision12
baseUrlhttps://unique-ch.atlassian.net/wiki
diagramNameUntitled Diagram-1726046119284.drawio
pCenter0
width10431153.5
links
tbstyle
height680.5

...

  • 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.

Drawio
mVer2
zoom1
simple0
inComment0
custContentId767623192
pageId765788213
lbox1
diagramDisplayNameUntitled Diagram-1726061925949.drawio
contentVer2
revision2
baseUrlhttps://unique-ch.atlassian.net/wiki
diagramNameUntitled Diagram-1726061925949.drawio
pCenter0
width692
links
tbstyle
height981