From d2eee433ee6abf569478c96aa65e46117fe262bd Mon Sep 17 00:00:00 2001 From: Gajithra Date: Wed, 26 Apr 2023 12:45:30 +0530 Subject: [PATCH 1/3] modified content to include information on improvements related to querying knowledge base for an attribute of an object --- docs/docs/action-server/knowledge-base-actions.mdx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/docs/action-server/knowledge-base-actions.mdx b/docs/docs/action-server/knowledge-base-actions.mdx index 554984a6f4c3..ef3248666f73 100644 --- a/docs/docs/action-server/knowledge-base-actions.mdx +++ b/docs/docs/action-server/knowledge-base-actions.mdx @@ -280,7 +280,7 @@ previously set slots to decide what to query for. ### Query the Knowledge Base for Objects -In order to query the knowledge base for any kind of object, the user's request needs to include the object type. +In order to query the knowledge base to list objects, the user's request needs to include the object type. Let's look at an example: Can you please name some restaurants? @@ -311,7 +311,9 @@ You also need to add those as entities and slots to the domain file. ### Query the Knowledge Base for an Attribute of an Object If the user wants to obtain specific information about an object, the request should include both the object and -attribute of interest. +attribute of interest. The user is not required to query the knowledge base for objects prior to this. +The `ActionQueryKnowledgeBase` will extract the object type from user's request and query the knowledge base for an attribute of an object. + For example, if the user asks something like: What is the cuisine of Berlin Burrito Company? @@ -328,7 +330,8 @@ intents: - What is the [cuisine](attribute) of [Berlin Burrito Company](restaurant)? ``` -Make sure to add the object type, “restaurant,” to the domain file as entity and slot. +Make sure to add the object type, “restaurant,” to the domain file as entity and slot. This will support `ActionQueryKnowledgeBase` +to extract the object type of the object user is interested in. @@ -568,7 +571,7 @@ The implementation of the `InMemoryKnowledgeBase` itself can be found in the If you have more data or if you want to use a more complex data structure that, for example, involves relations between different objects, you can create your own knowledge base implementation. -Just inherit `KnowledgeBase` and implement the methods `get_objects()`, `get_object()`, and +Just inherit `KnowledgeBase` and implement the methods `get_objects()`, `get_object()`, `get_object_types()` and `get_attributes_of_object()`. The [knowledge base code](https://github.com/RasaHQ/rasa-sdk/tree/main/rasa_sdk/knowledge_base/) provides more information on what those methods should do. From 9559a3f9d17022c9ed656dba6447a657ce59538d Mon Sep 17 00:00:00 2001 From: Gajithra Date: Wed, 3 May 2023 13:29:34 +0530 Subject: [PATCH 2/3] modified line 283 and 314 to rephrase the sentence better --- docs/docs/action-server/knowledge-base-actions.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/action-server/knowledge-base-actions.mdx b/docs/docs/action-server/knowledge-base-actions.mdx index ef3248666f73..bae0cb95e2af 100644 --- a/docs/docs/action-server/knowledge-base-actions.mdx +++ b/docs/docs/action-server/knowledge-base-actions.mdx @@ -280,7 +280,7 @@ previously set slots to decide what to query for. ### Query the Knowledge Base for Objects -In order to query the knowledge base to list objects, the user's request needs to include the object type. +In order to query the knowledge base to list down any kind of object, the user's request needs to include the object type. Let's look at an example: Can you please name some restaurants? @@ -311,7 +311,7 @@ You also need to add those as entities and slots to the domain file. ### Query the Knowledge Base for an Attribute of an Object If the user wants to obtain specific information about an object, the request should include both the object and -attribute of interest. The user is not required to query the knowledge base for objects prior to this. +attribute of interest. The user is not required to query the knowledge base to list down objects of any type prior to this. The `ActionQueryKnowledgeBase` will extract the object type from user's request and query the knowledge base for an attribute of an object. For example, if the user asks something like: From e723996ce546a86aa65d78533b4a4b9ce48d24b5 Mon Sep 17 00:00:00 2001 From: Gajithra Date: Wed, 3 May 2023 13:41:25 +0530 Subject: [PATCH 3/3] modified line 283 and 314 to rephrase the sentence better --- docs/docs/action-server/knowledge-base-actions.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/action-server/knowledge-base-actions.mdx b/docs/docs/action-server/knowledge-base-actions.mdx index bae0cb95e2af..9ef7edbcc531 100644 --- a/docs/docs/action-server/knowledge-base-actions.mdx +++ b/docs/docs/action-server/knowledge-base-actions.mdx @@ -311,7 +311,7 @@ You also need to add those as entities and slots to the domain file. ### Query the Knowledge Base for an Attribute of an Object If the user wants to obtain specific information about an object, the request should include both the object and -attribute of interest. The user is not required to query the knowledge base to list down objects of any type prior to this. +attribute of interest. The user is not required to query the knowledge base to list down any kind of object prior to this. The `ActionQueryKnowledgeBase` will extract the object type from user's request and query the knowledge base for an attribute of an object. For example, if the user asks something like: