Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions content/en/docs/marketplace/genai/concepts/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ This approach uses a linear chain of multiple LLM calls, where the output of one

The system takes a user prompt as input, either typed directly or generated using prompt engineering techniques. Its output is typically the plain response from the final LLM call in the chain.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/agents/Linear-Chaining.svg" >}}
{{< figure src="/attachments/genai/agents/Linear-Chaining.svg" alt="" >}}

### Prompt Chaining with Gatekeeper

This is an extension of the linear chain of multiple LLM calls. Now, the gatekeeper LLM call is part of the linear flow. Unlike other steps, the gatekeeper does not always pass its output directly to the next call. Its role is to assess the input and decide whether to continue the flow or break out, typically in "unhappy" or exception scenarios. If the gatekeeper determines that the process should proceed, the next LLM call receives the same input that the gatekeeper received.

As with the previous pattern, the system takes a user prompt as input, either entered directly or generated through prompt engineering techniques. The output is typically the plain result of the final LLM call in the happy flow. In an unhappy scenario, developers can choose to return either the gatekeeper agent’s response or a predefined static message.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/agents/Linear-Chaining-Gatekeeper.svg" >}}
{{< figure src="/attachments/genai/agents/Linear-Chaining-Gatekeeper.svg" alt="" >}}

### Evaluator-Optimizer

Expand All @@ -47,15 +47,15 @@ Alternative names for this pattern are:

The input of this system is a user prompt, either typed directly by the user or constructed using prompt engineering techniques. The output of the system is the plain output of the last iteration of the Generator Agent LLM call, as approved by the Evaluator Agent.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/agents/Evaluator-optimizer.svg" >}}
{{< figure src="/attachments/genai/agents/Evaluator-optimizer.svg" alt="" >}}

### Routing

This pattern is especially effective when the system needs to handle a variety of specific tasks. For each task, a dedicated agent is created with a clear focus on its assigned responsibility. When the system is triggered, a router agent classifies the input and determines which supported task most closely matches the user's intent. Once a match is found, the original input (which may include chat history) is passed to the appropriate agent. This process is often referred to as “hand-off”. It transfers full responsibility to the selected agent, which processes the input and generates an output, typically without any awareness of the router's involvement.

The system takes a user prompt as input, either entered directly or crafted using prompt engineering techniques. The output is typically the plain response from the agent chosen by the Router Agent. In some variations, the Router Agent may choose not to hand off the input if it determines that the request falls outside the system's supported scope. In such cases, the system returns either the Router Agent's own response or a static message explaining why the request could not be processed.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/agents/Routing.svg" >}}
{{< figure src="/attachments/genai/agents/Routing.svg" alt="" >}}

## Learn More

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: "This document describes the Model Context Protocol (MCP) and how i

The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) is an open protocol that standardizes how Large Language Models (LLMs) can autonomously connect to apps. Many AI platforms and third-party systems have already adopted MCP for easier integration and empowerment of LLMs. Mendix provides an [MCP Server](/appstore/modules/genai/genai-for-mx/mcp-server/) module to facilitate an MCP server from a Mendix app, enabling developers to expose tools and prompts to external MCP clients as well as an [MCP Client](https://marketplace.mendix.com/link/component/244893) module. The MCP Client module enables your app to connect to MCP servers, allowing it to discover and use tools and prompts.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/mcp/mcp-client-server-architecture-mendix.png" >}}
{{< figure src="/attachments/genai/mcp/mcp-client-server-architecture-mendix.png" alt="" >}}

As described in the diagram above, a user can chat with a model in the MCP Host application (for example, in Mendix, using Conversational UI), which connects to the MCP Server (a Mendix app or an external server) via MCP to discover available tools and prompts. If the user's request can be solved with any available tool, the LLM can call a tool which is executed in the server environment and returns the result. This approach allows developers to integrate their Mendix app with existing external AI systems.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: "Describes Prompt Engineering as used with generative AI in Mendix"

Prompt engineering involves the skillful structuring of instructions to guide generative Artificial Intelligence (AI) models in producing the desired outcomes, blending technical precision and creativity. With today’s more advanced models, it has become easier for models to interpret user intent with minimal input, becoming more user-friendly, and in exchange, users have adapted their language to be better understood by the Large Language Models (LLM). The image below shows an example of this.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/prompt-engineering/prompt_types.png" >}}
{{< figure src="/attachments/genai/prompt-engineering/prompt_types.png" alt="" >}}

These prompts typically contain input from the end-user or are generated by the app which is enriched with instructions from the developer/administrator or enriched by the app. A prompt typically contains at least one of the following:

Expand Down
6 changes: 3 additions & 3 deletions content/en/docs/marketplace/genai/concepts/tool-calling.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ The [GenAI Showcase App](https://marketplace.mendix.com/link/component/220475) c

The first diagram shows a simple process where the user is interested in the status of a certain ticket. The LLM connector takes care of handling the tool call response as well as executing the function microflows until the API returns the final assistant's response as visualized by the blue box.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/function-calling/function-calling.png" >}}
{{< figure src="/attachments/genai/function-calling/function-calling.png" alt="" >}}

In the second diagram, the user does not provide the required input for the function. The model is instructed in the system prompt not to assume parameters and ask for clarification if needed: `Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous. If a tool call was not successful, give this information to the user and ask for clarification.`

The second user prompt contains the identifier, and the whole message history is sent as part of the request. With this information, the model is now able to answer the initial question of the user.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/function-calling/function-calling-with-clarification.png" >}}
{{< figure src="/attachments/genai/function-calling/function-calling-with-clarification.png" alt="" >}}

In the last diagram, the `Ticket_CreateNew` function is registered with `UserConfirmationRequired`, so it is only executed when user confirms it. The tool call is shown to the user, who can decide to confirm or reject it. If rejected, the microflow will not be executed, and the LLM gets informed about the decision. If confirmed, the microflow gets executed and returns the response as usual to the LLM.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/function-calling/function-calling-with-user-control.png" >}}
{{< figure src="/attachments/genai/function-calling/function-calling-with-user-control.png" alt="" >}}
12 changes: 6 additions & 6 deletions content/en/docs/marketplace/genai/how-to/byo_connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If you want to create your own connection to the LLM model of your choice while

Building your own GenAI Commons connector offers several practical benefits that streamline development and enhance flexibility. You can reuse [ConversationalUI](/appstore/modules/genai/genai-for-mx/conversational-ui/) components, quickly set up with [starter apps](/appstore/modules/genai/how-to/starter-template/), and switch providers effortlessly. This guide will help you integrate your preferred LLM while maintaining a seamless and user-friendly chat experience.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-byo/connectors_diagram.png" >}}
{{< figure src="/attachments/genai/howto-byo/connectors_diagram.png" alt="" >}}

### Prerequisites

Expand Down Expand Up @@ -81,7 +81,7 @@ And one output object:

Since this structure is already standardized, no modifications are needed for the `Request` entity. Instead, when implementing a new connector, map the request data from the existing `Request` object to the format required by the specific provider—in this case, the Echo Connector.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-byo/GenAICommons_TextFiles_DomainModel.png" >}}
{{< figure src="/attachments/genai/howto-byo/GenAICommons_TextFiles_DomainModel.png" alt="" >}}

Just as the `Request` entity structures input for the LLM, the Response entity defines how the model's output must be formatted for proper display in the chat interface. When an LLM returns a result, it must be converted into the `Response` entity’s format to ensure compatibility with GenAICommons and ConversationalUI.

Expand All @@ -102,7 +102,7 @@ The `DeployedModel` represents a GenAI model that the Mendix app can invoke, ens

To accommodate this, you will need to create a new entity within your connector that inherits from `GenAICommons.DeployedModel`. This allows you to extend it with any provider-specific attributes required for your integration.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-byo/GenAICommons_DeployedModel_DM.png" >}}
{{< figure src="/attachments/genai/howto-byo/GenAICommons_DeployedModel_DM.png" alt="" >}}

For the Echo Connector, a specialization of `DeployedModel` is created to include any additional attributes required for proper functionality.

Expand All @@ -112,7 +112,7 @@ Your model will require an authentication method based on your provider’s requ

To enable seamless model invocation, creating an entity to store authentication details is recommended. A `Configuration` entity is associated with the specialized `EchoDeployedModel`, allowing users to manage credentials separately from the deployed model. The specific attributes required in this `Configuration` entity depend on the model’s authentication method and requirements. A basic example is shown below:

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-byo/EchoConnector_DomainModel.png" >}}
{{< figure src="/attachments/genai/howto-byo/EchoConnector_DomainModel.png" alt="" >}}

When storing sensitive authentication data, use encryption methods to keep the application secure. For reference, the Echo Connector implementation in the GenAI Showcase App provides an example of how this can be set up.

Expand All @@ -124,13 +124,13 @@ When creating specialized `DeployedModel` objects, the `Microflow` attribute mus

DeployedModel_Create | DeployedModel_SetMicroflow
:-------------------------:|:-------------------------:
{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-byo/DeployedModel_Create.png" >}} | {{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-byo/DeployedModel_SetMicroflow.png" >}}
{{< figure src="/attachments/genai/howto-byo/DeployedModel_Create.png" alt="" >}} | {{< figure src="/attachments/genai/howto-byo/DeployedModel_SetMicroflow.png" alt="" >}}

Define a microflow that will handle the request and generate a response in the expected format. This microflow will be used as the Microflow attribute for the `EchoDeployedModel` objects, ensuring that when an Echo model is called, it follows the same structure required for chat interactions.

The following microflow was created to be used as the `Microflow` attribute for the `EchoDeployedModel` objects:

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-byo/EchoDeployedModel_CallLLM.png" >}}
{{< figure src="/attachments/genai/howto-byo/EchoDeployedModel_CallLLM.png" alt="" >}}

As mentioned earlier, in the EchoConnector, the microflow simply returns the input provided by the user. To achieve this, the latest user message must be retrieved from the Request, and a Response along with an assistant's message must be created.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This guide explains how to create an agent in your Mendix app that combines [kno

## Agent Use Case

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-singleagent/structure_singleagent.svg" alt="Agent use case structure showing integration of LLM, knowledge base, and function calling" >}}
{{< figure src="/attachments/genai/howto-singleagent/structure_singleagent.svg" alt="Agent use case structure showing integration of LLM, knowledge base, and function calling" >}}

For this agent, you will set up logic that calls LLMs available via Mendix Cloud GenAI calls to dynamically determine which in-app and external information is needed based on user input. The system retrieves the necessary information, uses it to reason about the actions to perform, and handles execution while keeping you informed and involved where needed.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Finally, you can add a tool for knowledge base retrieval. This allows the agent

You have successfully integrated a knowledge base into your agent interaction. Run the app to see the agent integrated in the use case. Using the **TicketHelper_Agent** page, the user can ask the model questions and receive responses. When it deems it relevant, it uses the functions or the knowledge base. If you ask the agent "How many tickets are open?", a log should appear in your Studio Pro console indicating that the function microflow was executed. When a user submits a request like "My VPN crashes all the time and I need it to work on important documents", the agent searches the knowledge base for similar tickets and provides a relevant solution.

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-singleagent/Microflow_GenAICommons.png" alt="Microflow showing GenAI Commons implementation" >}}
{{< figure src="/attachments/genai/howto-singleagent/Microflow_GenAICommons.png" alt="Microflow showing GenAI Commons implementation" >}}

If you would like to learn how to enable user confirmation for tools, similar to what is described for the [Agent Commons approach](/appstore/modules/genai/how-to/create-agent-with-agent-commons/), you can find examples in the `ExampleMicroflows` module of the [GenAI Showcase App](https://marketplace.mendix.com/link/component/220475).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Before you begin, complete the following:

Create an agent that can be called to interact with the LLM. The [Agent Commons](/appstore/modules/genai/genai-for-mx/agent-commons/) module allows agentic AI engineers to define agents and perform prompt engineering at runtime. After you complete these steps, your agent configuration will look like this:

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-singleagent/agent-runtime.png" alt="Agent Commons UI showing IT-Ticket Helper configuration">}}
{{< figure src="/attachments/genai/howto-singleagent/agent-runtime.png" alt="Agent Commons UI showing IT-Ticket Helper configuration">}}

1. Run the app.

Expand Down Expand Up @@ -87,7 +87,7 @@ Use the function microflows created in [Set Up Your App for Agent Creation](/app
* Description: `Get number of tickets in a certain status. Only the following values for status are available: ['Open', 'In Progress', 'Closed']`
* Enabled: *yes* (default)

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-singleagent/runtime-RetrieveNumberOfTicketsInStatus.png" alt="Add tool dialog box with RetrieveNumberOfTicketsInStatus configuration" max-width=60% >}}
{{< figure src="/attachments/genai/howto-singleagent/runtime-RetrieveNumberOfTicketsInStatus.png" alt="Add tool dialog box with RetrieveNumberOfTicketsInStatus configuration" max-width=60% >}}

3. Click **Save**.

Expand Down Expand Up @@ -145,7 +145,7 @@ If your knowledge base is not compatible with Agent Commons, or if the retrieval

Configure the **Ask the agent** button created in [Set Up Your App for Agent Creation](/appstore/modules/genai/how-to/creating-agents/shared-setup/#domain-model-setup) to call a microflow to invoke the agent. Your completed microflow will look like this:

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-singleagent/Microflow_AgentCommons.png" alt="Microflow with three activities: Retrieve Agent from database, Call Agent Without History, and Change TicketHelper ModelResponse attribute" >}}
{{< figure src="/attachments/genai/howto-singleagent/Microflow_AgentCommons.png" alt="Microflow with three activities: Retrieve Agent from database, Call Agent Without History, and Change TicketHelper ModelResponse attribute" >}}

1. On the **TicketHelper_Agent** page, edit the button's **On click** event to call a microflow. Click **New** to create a microflow named `ACT_TicketHelper_CallAgent_Commons`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Link a knowledge base collection to the agent so it can retrieve relevant histor
* **Collection**: `HistoricalTickets`
* **Name**: `RetrieveSimilarTickets`
* **Description**: `Similar tickets from the database`
{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-singleagent/configure-knowledge-base.gif" alt="">}}
{{< figure src="/attachments/genai/howto-singleagent/configure-knowledge-base.gif" alt="">}}

6. Click **OK** to close the dialog box. Save the Agent document.

Expand All @@ -162,7 +162,7 @@ If you make changes to the agent definition afterward, restart or redeploy the l

Configure the **Ask the agent** button created in [Set Up Your App for Agent Creation](/appstore/modules/genai/how-to/creating-agents/shared-setup/#domain-model-setup) to call a microflow that invokes the Agent Editor agent and stores the response in the UI helper object. Your completed microflow will look like this:

{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-singleagent/ACT_TicketHelper_CallAgent_Editor.png" alt="">}}
{{< figure src="/attachments/genai/howto-singleagent/ACT_TicketHelper_CallAgent_Editor.png" alt="">}}

1. On the **TicketHelper_Agent** page, edit the **On click** event of the button to call a microflow. Click **New** to create a microflow named `ACT_TicketHelper_CallAgent_Editor`.

Expand Down
Loading
Loading