Skip to content

Commit 9198ed0

Browse files
committed
feat(Assistant): Add mentions and new_mentions parameters to create_example/update_example
1 parent 4e22c56 commit 9198ed0

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/ibm_watson/assistant_v1.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,8 @@ def delete_intent(workspace_id:, intent:)
639639
##
640640
# @!method list_examples(workspace_id:, intent:, page_limit: nil, include_count: nil, sort: nil, cursor: nil, include_audit: nil)
641641
# List user input examples.
642-
# List the user input examples for an intent.
642+
# List the user input examples for an intent, optionally including contextual entity
643+
# mentions.
643644
#
644645
# This operation is limited to 2500 requests per 30 minutes. For more information,
645646
# see **Rate limiting**.
@@ -679,7 +680,7 @@ def list_examples(workspace_id:, intent:, page_limit: nil, include_count: nil, s
679680
end
680681

681682
##
682-
# @!method create_example(workspace_id:, intent:, text:)
683+
# @!method create_example(workspace_id:, intent:, text:, mentions: nil)
683684
# Create user input example.
684685
# Add a new user input example to an intent.
685686
#
@@ -692,8 +693,9 @@ def list_examples(workspace_id:, intent:, page_limit: nil, include_count: nil, s
692693
# - It cannot contain carriage return, newline, or tab characters.
693694
# - It cannot consist of only whitespace characters.
694695
# - It must be no longer than 1024 characters.
696+
# @param mentions [Array[Mentions]] An array of contextual entity mentions.
695697
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
696-
def create_example(workspace_id:, intent:, text:)
698+
def create_example(workspace_id:, intent:, text:, mentions: nil)
697699
raise ArgumentError("workspace_id must be provided") if workspace_id.nil?
698700
raise ArgumentError("intent must be provided") if intent.nil?
699701
raise ArgumentError("text must be provided") if text.nil?
@@ -703,7 +705,8 @@ def create_example(workspace_id:, intent:, text:)
703705
"version" => @version
704706
}
705707
data = {
706-
"text" => text
708+
"text" => text,
709+
"mentions" => mentions
707710
}
708711
method_url = "/v1/workspaces/%s/intents/%s/examples" % [ERB::Util.url_encode(workspace_id), ERB::Util.url_encode(intent)]
709712
response = request(
@@ -752,7 +755,7 @@ def get_example(workspace_id:, intent:, text:, include_audit: nil)
752755
end
753756

754757
##
755-
# @!method update_example(workspace_id:, intent:, text:, new_text: nil)
758+
# @!method update_example(workspace_id:, intent:, text:, new_text: nil, new_mentions: nil)
756759
# Update user input example.
757760
# Update the text of a user input example.
758761
#
@@ -766,8 +769,9 @@ def get_example(workspace_id:, intent:, text:, include_audit: nil)
766769
# - It cannot contain carriage return, newline, or tab characters.
767770
# - It cannot consist of only whitespace characters.
768771
# - It must be no longer than 1024 characters.
772+
# @param new_mentions [Array[Mentions]] An array of contextual entity mentions.
769773
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
770-
def update_example(workspace_id:, intent:, text:, new_text: nil)
774+
def update_example(workspace_id:, intent:, text:, new_text: nil, new_mentions: nil)
771775
raise ArgumentError("workspace_id must be provided") if workspace_id.nil?
772776
raise ArgumentError("intent must be provided") if intent.nil?
773777
raise ArgumentError("text must be provided") if text.nil?
@@ -777,7 +781,8 @@ def update_example(workspace_id:, intent:, text:, new_text: nil)
777781
"version" => @version
778782
}
779783
data = {
780-
"text" => new_text
784+
"text" => new_text,
785+
"mentions" => new_mentions
781786
}
782787
method_url = "/v1/workspaces/%s/intents/%s/examples/%s" % [ERB::Util.url_encode(workspace_id), ERB::Util.url_encode(intent), ERB::Util.url_encode(text)]
783788
response = request(

0 commit comments

Comments
 (0)