Skip to content

Commit 78dd9f0

Browse files
Merge pull request #9664 from liamsommer-mx/deployedKnowledgeBase
Deployed knowledge base
2 parents 0d1b1c9 + 0265bc2 commit 78dd9f0

File tree

6 files changed

+73
-37
lines changed

6 files changed

+73
-37
lines changed

content/en/docs/appstore/use-content/platform-supported-content/modules/aws/amazon-bedrock.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ The [ChatCompletions (with history)](/appstore/modules/genai/genai-for-mx/common
217217

218218
Some capabilities of the chat completions operations are currently only available for specific models:
219219

220-
* **Function Calling** - You can use function calling in all chat completions operations using a [supported model](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html) by adding a `ToolCollection` with a `Tool` via the [Tools: Add Function to Request](/appstore/modules/genai/genai-for-mx/commons/#add-function-to-request) operation. For more information about function calling, see the [Function Calling Documentation](/appstore/modules/genai/function-calling/).
220+
* **Function Calling** - You can use function calling in all chat completions operations. To do this, use a [supported model](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html) by adding a `ToolCollection` with a `Tool` via the [Tools: Add Function to Request](/appstore/modules/genai/genai-for-mx/commons/#add-function-to-request) operation. You can also first retrieve data from a knowledge base and then call `ChatCompletions` with the information required using the connector's function calling properties. In order to use this function, add a knowledge base to your Request using [Tools: Add Knowledge Base](/appstore/modules/genai/genai-for-mx/commons/#add-knowledge-base-to-request). For more information about function calling, see [Function Calling](/appstore/modules/genai/function-calling/).
221221

222222
**Function calling microflows**: A microflow used as a tool for function calling must satisfy the following conditions:
223223

content/en/docs/appstore/use-content/platform-supported-content/modules/genai/how-to/create-single-agent.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Mendix ticket data needs to be ingested into the knowledge base. You can find a
122122
* Edit the first retrieve action to retrieve objects from your new entity `Ticket`.
123123
* In the loop, delete the second action that adds metadata to the `MetadataCollection`.
124124
* In the last action of the loop `Chunks: Add KnowledgeBaseChunk to ChunkCollection` keep the **Human readable ID** field empty.
125-
* Near the end of the microflow, edit the action `Connection: Get` to change the collection name from *example* to `HistoricalTickets`
125+
* Near the end of the microflow, edit the action `DeployedKnowledgeBase: Get` to change the collection name from *example* to `HistoricalTickets`
126126
127127
7. Finally, create a microflow `ACT_CreateDemoData_IngestIntoKnowledgeBase` that first calls the `Tickets_CreateDataset` microflow, followed by the `ACT_TicketList_LoadAllIntoKnowledgeBase` microflow. Add this `ACT_CreateDemoData_IngestIntoKnowledgeBase` new microflow to your navigation or homepage and ensure that it is accessible to admins (add the admin role under **Allowed Roles** in the microflow properties).
128128
@@ -289,23 +289,22 @@ Users can now ask for information for a specific ticket by providing a ticket id
289289
290290
Finally, you can add a tool for knowledge base retrieval. This allows the agent to query the knowledge base for similar tickets and thus tailor a response to the user based on private knowledge. Note that the knowledge base retrieval is only supported for [Mendix Cloud GenAI Resource Packs](/appstore/modules/genai/mx-cloud-genai/resource-packs/).
291291
292-
1. In the microflow `ACT_TicketHelper_CallAgent`, add a `Retrieve` action, before the request is created, to retrieve a **Mendix Cloud Knowledge Base** object:
292+
1. In the microflow `ACT_TicketHelper_CallAgent`, add a `Retrieve` action, before the request is created, to retrieve a **Collection** object:
293293
294294
* Source: `From database`
295-
* Entity: `MxGenAIConnector.MxCloudKnowledgeBase` (search for *MxCloudKnowledgeBase*)
295+
* Entity: `MxGenAIConnector.Collection` (search for *Collection*)
296296
* Range: `First`
297-
* Object name: `MxCloudKnowledgeBase` (default)
297+
* Object name: `Collection` (default)
298298
299-
2. Add the `Tools: Add Mendix Cloud Knowledge Base` action after the **Request** creation microflow:
299+
2. Add the `Tools: Add Knowledge Base` action after the **Request** creation microflow:
300300
301301
* Request: `Request` (object created in previous action)
302-
* MxCloudKnowledgeBase: `MxCloudKnowledgeBase` (object that was retrieved in the previous step)
303-
* CollectionName: `HistoricalTickets` (name that was used in the [Ingest Data into Knowledge Base](#ingest-knowledge-base))
304302
* MaxNumberOfResults: empty (expression; optional)
305303
* MinimumSimilarity: empty (expression; optional)
306304
* MetadataCollection: empty (expression; optional)
307305
* Name: `RetrieveSimilarTickets` (expression)
308306
* Description: `Similar tickets from the database` (expression)
307+
* DeployedKnowledgeBase: `Collection` (object that was retrieved in the previous step)
309308
* Use return value: `no`
310309
311310
You have successfully integrated a knowledge base into your agent interaction. Now, when a user submits a request like, `My VPN crashes all the time and I need it to work on important documents`, the agent will search the knowledge base for similar tickets and provide a relevant solution.

content/en/docs/appstore/use-content/platform-supported-content/modules/genai/how-to/ground_your_llm_in_data.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ Before implementing this capability into your app, make sure you meet the follow
3939

4040
Since this document focuses on the [Mendix Cloud GenAI Resource Packs](/appstore/modules/genai/mx-cloud-genai/resource-packs/), ensure that you have the [Mendix Cloud GenAI Connector](https://marketplace.mendix.com/link/component/239449) installed.
4141

42-
Follow the [Navigate through the Mendix Cloud GenAI Portal](/appstore/modules/genai/mx-cloud-genai/Navigate-MxGenAI/) instructions to collect the resources keys.
42+
Follow the instructions in the [Navigate through the Mendix Cloud GenAI Portal](/appstore/modules/genai/mx-cloud-genai/Navigate-MxGenAI/) guide to collect the resources keys and configure the connector within your application. The keys bridge the gap between your app and the resources, enabling you to access models and add to or retrieve data from a Mendix Cloud GenAI knowledge base.
43+
44+
While this documentation focuses on adding data to your knowledge base from a Mendix application, you can also fill the knowledge base directly within the portal, for example, by uploading files.
4345

4446
### Creating Domain Model Entity {#domainmodel}
4547

@@ -80,22 +82,22 @@ To start, create a microflow that allows you to upload data into your knowledge
8082
* Use return value: No
8183
* Metadata collection: `empty` (optional)
8284

83-
5. After the loop, add a `Retrieve` action to retrieve a `MxCloudKnowledgeBase`. In this example, the first entry found in the database is used.
85+
5. After the loop, add a `Retrieve` action to retrieve a `MxCloudKnowledgeBaseResource`. In this example, the first entry found in the database is used.
8486

8587
* **Source**: `From database`
86-
* **Entity**: `MxGenAIConnector.MxCloudKnowledgeBase`
88+
* **Entity**: `MxGenAIConnector.MxCloudKnowledgeBaseResource`
8789
* **Range**: `First`
88-
* **Object name**: `MxCloudKnowledgeBase`
90+
* **Object name**: `MxCloudKnowledgeBaseResource`
8991

90-
6. Next, add the `Connection: Get` action from the `Mendix Cloud Knowledge Base` category:
92+
6. Next, add the `DeployedKnowledgeBase: Get` action from the `Mendix Cloud Knowledge Base` category:
9193

92-
To edit the parameter value for `MxCloudKnowledgeBase`, double-click its type, select `Variable`, and assign it the value `MxCloudKnowledgeBase`. Similarly, for `CollectionName`, double-click its type, select `Expression`, and assign it the value `TicketSolutions`.
94+
To edit the parameter value for `MxCloudKnowledgeBaseResource`, double-click its type, select `Variable`, and assign it the value `MxCloudKnowledgeBaseResource`. Similarly, for `CollectionName`, double-click its type, select `Expression`, and assign it the value `TicketSolutions`.
9395

94-
You can keep the **Use return variable** as *Yes* and the object name `MxKnowledgeBaseConnection`.
96+
You can keep the **Use return variable** as *Yes* and the object name `DeployedKnowledgeBase`.
9597

9698
7. Add the `Embed & Repopulate Collection` action to insert your knowledge into the knowledge base:
9799

98-
To edit the parameter value for `Connection`, double-click its type, select `Variable`, and assign it the value `MxKnowledgeBaseConnection`. Similarly, for `ChunkCollection`, double-click its type, select `Variable`, and assign it the value `GenAICommons.ChunkCollection`.
100+
To edit the parameter value for `DeployedKnowledgeBase`, double-click its type, select `Variable`, and assign it the value `DeployedKnowledgeBase`. Similarly, for `ChunkCollection`, double-click its type, select `Variable`, and assign it the value `GenAICommons.ChunkCollection`.
99101

100102
You can keep the **Use return variable** as *Yes* and the variable name `IsSuccess`.
101103

@@ -186,9 +188,9 @@ To use the knowledge in a chat interface, create and adjust certain microflows a
186188
5. After the `Request found` decision, add a `Retrieve` action. In this example, the first entry found in the database is used, just as in the insertion microflow.
187189

188190
* **Source**: `From database`
189-
* **Entity**: `MxGenAIConnector.MxCloudKnowledgeBase`
191+
* **Entity**: `MxGenAIConnector.MxCloudKnowledgeBaseResource`
190192
* **Range**: `First`
191-
* **Object name**: `MxCloudKnowledgeBase`
193+
* **Object name**: `MxCloudKnowledgeBaseResource`
192194

193195
6. Add the `Tools: Add Mendix Cloud Knowledge Base` action with the settings shown in the image below:
194196

content/en/docs/appstore/use-content/platform-supported-content/modules/genai/mendix-cloud-genai/Mx GenAI Connector.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Knowledge bases are often used for:
4141
1. [Retrieval Augmented Generation (RAG)](https://docs.mendix.com/appstore/modules/genai/rag/) retrieves relevant knowledge from the knowledge base, incorporates it into a prompt, and sends it to the model to generate a response.
4242
2. Semantic search enables advanced search capabilities by considering the semantic meaning of the text, going beyond exact and approximate matching. It allows the knowledge base to be searched for similar chunks effectively.
4343

44+
If you are looking for a step-by-step guide on how to get your application data into a Mendix Cloud Knowledge Base, refer [Grounding Your Large Language Model in Data – Mendix Cloud GenAI](/appstore/modules/genai/how-to/howto-groundllm/). Note that the Mendix Portal also provides options for importing data into your knowledge base, such as file uploads. For more information, see [Navigate through the Mendix Cloud GenAI Portal](/appstore/modules/genai/mx-cloud-genai/Navigate-MxGenAI/). This documentation focuses solely on adding data from an application using the connector.
45+
4446
#### Embeddings
4547

4648
Convert strings into vector embeddings for various purposes based on the relatedness of texts.
@@ -87,15 +89,17 @@ Follow the steps below to get started:
8789
* Make sure to configure the [Encryption module](/appstore/modules/encryption/#configuration) before you connect your app to Mendix Cloud GenAI.
8890
* Add the module role `MxGenAIConnector.Administrator` to your Administrator **User roles** in the **Security** settings of your app.
8991
* Add the `Configuration_Overview` page (**USE_ME** > **Configuration**) to your navigation, or add the `Snippet_Configuration` to a page that is already part of your navigation. Alternatively, you can register your key by using the `Configuration_RegisterByString` microflow.
90-
* Complete the runtime setup of Mendix Cloud GenAI configuration by navigating to the page mentioned above. Import a key generated in the [portal](https://genai.home.mendix.com) or provided to you and click **Test Key** to validate its functionality.
92+
* Complete the runtime setup of Mendix Cloud GenAI configuration by navigating to the page mentioned above. Import a key generated in the [portal](https://genai.home.mendix.com) or provided to you and click **Test Key** to validate its functionality. Note that this key establishes a connection between the Mendix Cloud resources and your application. It contains all the information required to set up the connection.
9193

9294
## Operations
9395

9496
{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/mxgenAI-connector/MxGenAIConnector_Configuration.png" >}}
9597

9698
Configuration keys are stored persistently after they are imported (either via the UI or the exposed microflow). There are three different types of configurations that reflect the use cases this service supports. The specific operations are described below.
9799

98-
To use the operations, either a `DeployedModel` (text, embeddings) or a `MxKnowledgebaseConnection` must always be passed as input. The DeployedModel will be created automatically when importing keys at runtime and needs to be retrieved from the database. To initialize a knowledge base operation, use the `Connection: Get` toolbox action to create the `MxKnowledgebaseConnection` object. It requires a `CollectionName` (string) for the right collection inside of the knowledge base resource to be used.
100+
To use the operations, either a `DeployedModel` (text, embeddings) or a `DeployedKnowledgeBase` must always be passed as input. The DeployedModel will be created automatically when importing keys at runtime and needs to be retrieved from the database. To initialize a knowledge base operation, use the `DeployedKnowledgeBase: Get` toolbox action to retrieve the DeployedKnowledgeBase object for a specified collection. It requires the collection's Name (string) as input.
101+
102+
In Mendix Cloud GenAI, a single knowledge base resource (MxCloudKnowledgeBaseResource) can contain multiple collections (tables). As a result, several DeployedKnowledgeBase objects may belong to the same resource.
99103

100104
### Chat Completions Operation
101105

@@ -119,7 +123,7 @@ The microflow activity [Chat completions (with history)](/appstore/modules/genai
119123

120124
#### Retrieve & Generate {#retrieve-and-generate}
121125

122-
To use retrieval and generation in a single operation, an internally predefined tool can be added to the [Request](/appstore/modules/genai/genai-for-mx/commons/#request) via the `Tools: Add Mendix Cloud Knowledge Base` action . The model can then decide whether to use the [knowledge base retrieval](/appstore/modules/genai/genai-for-mx/commons/#knowledge-base-retrieval) tool when handling the request. This functionality is supported in both with-history and without-history operations. Additionally, you may apply optional filters, such as `MaxNumberOfResults` or `MinimumSimilarity`, or pass a [MetadataCollection](/appstore/modules/genai/genai-for-mx/commons/#metadatacollection-entity). The optional `Description` can help the model understand the knowledge base content and decide whether it should be called in the current chat context.
126+
To use retrieval and generation in a single operation, an internally predefined tool can be added to the [Request](/appstore/modules/genai/genai-for-mx/commons/#request) via the `Tools: Add Knowledge Base` action . The model can then decide whether to use the [knowledge base retrieval](/appstore/modules/genai/genai-for-mx/commons/#knowledge-base-retrieval) tool when handling the request. This functionality is supported in both with-history and without-history operations. The (optional) `Description` helps the model to understand the knowledge base content and decide whether it should be called in the current chat context. Additionally, you may apply optional filters, such as `MaxNumberOfResults` or `MinimumSimilarity`, or pass a [MetadataCollection](/appstore/modules/genai/genai-for-mx/commons/#metadatacollection-entity).
123127

124128
{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/mxgenAI-connector/MxGenAIConnector_ConfigureRAG.png" >}}
125129

@@ -166,7 +170,7 @@ The model uses the file name when analyzing documents, which may introduce a pot
166170

167171
### Knowledge Base Operations
168172

169-
To implement knowledge base logic into your Mendix application, you can use the actions in the **USE_ME** > **Knowledge Base** folder or under the **GenAI Knowledge Base (Content)** or **Mendix Cloud Knowledge Base** categories in the **Toolbox**. These actions require a specialized [Connection](/appstore/modules/genai/genai-for-mx/commons/#connection) of type `MxKnowledgeBaseConnection` that determines the model and endpoint to use. Additionally, the collection name must be passed when creating the object and it must be associated with a `Configuration` object. Please note that for Mendix Cloud GenAI a knowledge base resource may contain several collections (tables).
173+
To implement knowledge base logic into your Mendix application, you can use the actions in the **USE_ME** > **Knowledge Base** folder or under the **GenAI Knowledge Base (Content)** or **Mendix Cloud Knowledge Base** categories in the **Toolbox**. These actions require a specialized [DeployedKnowledgeBase](/appstore/modules/genai/genai-for-mx/commons/#deployed-knowledge-base) of type `Collection` that determines the model and endpoint to use. Additionally, the collection name must be passed when creating the object and it must be associated with a `Configuration` object. Please note that for Mendix Cloud GenAI a knowledge base resource may contain several collections (tables).
170174

171175
Dealing with knowledge bases involves two main stages:
172176

@@ -193,7 +197,7 @@ The chunk collection can then be stored in the knowledge base using one of the f
193197

194198
##### Add Data Chunks to Your Knowledge Base
195199

196-
Use the following toolbox actions inside the **Mendix Cloud Knowledge Base** toolbox category to populate knowledge data into the knowledge base:
200+
Use the following toolbox actions inside the **Mendix Cloud Knowledge Base** toolbox category to populate knowledge data into a collection:
197201

198202
1. `Embed & Insert` embeds a list of chunks (passed via a [ChunkCollection](/appstore/modules/genai/genai-for-mx/commons/#chunkcollection)) and inserts them into the knowledge base.
199203
2. `Embed & repopulate KB` is similar to the `Embed & Insert`, but deletes all existing chunks from the knowledge base before inserting the new chunks.
@@ -206,15 +210,11 @@ Additionally, use the following toolbox actions to delete chunks:
206210

207211
When data in your Mendix app that is relevant to the knowledge base changes, it is usually necessary to keep the knowledge base chunks in sync. Whenever a Mendix Object changes, the affected chunks must be updated. Depending on your use case, the `Embed & Replace` and `Delete for Objects` can be conveniently used in event handler microflows.
208212

209-
The example below shows how to repopulate a knowledge base using a list of Mendix objects:
210-
211-
{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/mxgenAI-connector/PushTicketstoMxKB.png" >}}
212-
213213
##### Knowledge Base Retrieval{#knowledge-base-retrieval}
214214

215-
The following toolbox actions can be used to retrieve knowledge data from the knowledge base (and associate it with your Mendix data):
215+
The following toolbox actions can be used to retrieve knowledge data from a collection (and associate it with your Mendix data):
216216

217-
1. `Retrieve` retrieves knowledge base chunks from the knowledge base. You can use pagination via the `Offset` and `MaxNumberOfResults` parameters or apply filtering via a `MetadataCollection` or `MxObject`. (Scroll down to see all available input parameters of this operation)
217+
1. `Retrieve` retrieves knowledge base chunks from the knowledge base. You can use pagination via the `Offset` and `MaxNumberOfResults` parameters or apply filtering via a `MetadataCollection` or `MxObject`.
218218
2. `Retrieve & Associate` is similar to the `Retrieve` but associates the returned chunks with a Mendix object if they were linked at the insertion stage.
219219

220220
{{% alert color="info" %}}You must define your entity specialized from `KnowledgeBaseChunk`, which is associated to the entity that was used to pass a MendixObject during the [insertion stage](#knowledge-base-insertion).

0 commit comments

Comments
 (0)