watson_developer_cloud.conversation_v1 module¶
The IBM Watson Conversation service combines machine learning, natural language understanding, and integrated dialog tools to create conversation flows between your apps and your users.
-
class
ConversationV1
(version, url='https://gateway.watsonplatform.net/conversation/api', username=None, password=None)[source]¶ Bases:
watson_developer_cloud.watson_service.WatsonService
The Conversation V1 service.
-
default_url
= 'https://gateway.watsonplatform.net/conversation/api'¶
-
VERSION_DATE_2017_05_26
= '2017-05-26'¶
-
VERSION_DATE_2017_04_21
= '2017-04-21'¶
-
VERSION_DATE_2017_02_03
= '2017-02-03'¶
-
VERSION_DATE_2016_09_20
= '2016-09-20'¶
-
VERSION_DATE_2016_07_11
= '2016-07-11'¶
-
create_workspace
(name=None, description=None, language=None, intents=None, entities=None, dialog_nodes=None, counterexamples=None, metadata=None, learning_opt_out=None)[source]¶ Create workspace.
Create a workspace based on component objects. You must provide workspace components defining the content of the new workspace.
Parameters: - name (str) – The name of the workspace.
- description (str) – The description of the workspace.
- language (str) – The language of the workspace.
- intents (list[CreateIntent]) – An array of objects defining the intents for the workspace.
- entities (list[CreateEntity]) – An array of objects defining the entities for the workspace.
- dialog_nodes (list[CreateDialogNode]) – An array of objects defining the nodes in the workspace dialog.
- counterexamples (list[CreateCounterexample]) – An array of objects defining input examples that have been marked as irrelevant input.
- metadata (object) – Any metadata related to the workspace.
- learning_opt_out (bool) – Whether training data from the workspace can be used by IBM for general service improvements. true indicates that workspace training data is not to be used.
Returns: A dict containing the Workspace response.
Return type:
-
delete_workspace
(workspace_id)[source]¶ Delete workspace.
Delete a workspace from the service instance.
Parameters: workspace_id (str) – The workspace ID. Return type: None
-
get_workspace
(workspace_id, export=None)[source]¶ Get information about a workspace.
Get information about a workspace, optionally including all workspace content.
Parameters: Returns: A dict containing the WorkspaceExport response.
Return type:
-
list_workspaces
(page_limit=None, include_count=None, sort=None, cursor=None)[source]¶ List workspaces.
List the workspaces associated with a Conversation service instance.
Parameters: - page_limit (int) – The number of records to return in each page of results. The default page limit is 100.
- include_count (bool) – Whether to include information about the number of records returned.
- sort (str) – Sorts the response according to the value of the specified property, in ascending or descending order.
- cursor (str) – A token identifying the last value from the previous page of results.
Returns: A dict containing the WorkspaceCollection response.
Return type:
-
update_workspace
(workspace_id, name=None, description=None, language=None, intents=None, entities=None, dialog_nodes=None, counterexamples=None, metadata=None, learning_opt_out=None)[source]¶ Update workspace.
Update an existing workspace with new or modified data. You must provide component objects defining the content of the updated workspace.
Parameters: - workspace_id (str) – The workspace ID.
- name (str) – The name of the workspace.
- description (str) – The description of the workspace.
- language (str) – The language of the workspace.
- intents (list[CreateIntent]) – An array of objects defining the intents for the workspace.
- entities (list[CreateEntity]) – An array of objects defining the entities for the workspace.
- dialog_nodes (list[CreateDialogNode]) – An array of objects defining the nodes in the workspace dialog.
- counterexamples (list[CreateCounterexample]) – An array of objects defining input examples that have been marked as irrelevant input.
- metadata (object) – Any metadata related to the workspace.
- learning_opt_out (bool) – Whether training data from the workspace can be used by IBM for general service improvements. true indicates that workspace training data is not to be used.
Returns: A dict containing the Workspace response.
Return type:
-
message
(workspace_id, input=None, alternate_intents=None, context=None, entities=None, intents=None, output=None)[source]¶ Get a response to a user’s input.
Parameters: - workspace_id (str) – Unique identifier of the workspace.
- input (InputData) – An input object that includes the input text.
- alternate_intents (bool) – Whether to return more than one intent. Set to true to return all matching intents.
- context (Context) – State information for the conversation. Continue a conversation by including the context object from the previous response.
- entities (list[RuntimeEntity]) – Include the entities from the previous response when they do not need to change and to prevent Watson from trying to identify them.
- intents (list[RuntimeIntent]) – An array of name-confidence pairs for the user input. Include the intents from the previous response when they do not need to change and to prevent Watson from trying to identify them.
- output (OutputData) – System output. Include the output from the request when you have several requests within the same Dialog turn to pass back in the intermediate information.
Returns: A dict containing the MessageResponse response.
Return type:
-
create_intent
(workspace_id, intent, description=None, examples=None)[source]¶ Create intent.
Create a new intent.
Parameters: - workspace_id (str) – The workspace ID.
- intent (str) – The name of the intent.
- description (str) – The description of the intent.
- examples (list[CreateExample]) – An array of user input examples.
Returns: A dict containing the Intent response.
Return type:
-
delete_intent
(workspace_id, intent)[source]¶ Delete intent.
Delete an intent from a workspace.
Parameters: Return type:
-
get_intent
(workspace_id, intent, export=None)[source]¶ Get intent.
Get information about an intent, optionally including all intent content.
Parameters: - workspace_id (str) – The workspace ID.
- intent (str) – The intent name (for example, pizza_order).
- export (bool) – Whether to include all element content in the returned data. If export=`false`, the returned data includes only information about the element itself. If export=`true`, all content, including subelements, is included. The default value is false.
Returns: A dict containing the IntentExport response.
Return type:
-
list_intents
(workspace_id, export=None, page_limit=None, include_count=None, sort=None, cursor=None)[source]¶ List intents.
List the intents for a workspace.
Parameters: - workspace_id (str) – The workspace ID.
- export (bool) – Whether to include all element content in the returned data. If export=`false`, the returned data includes only information about the element itself. If export=`true`, all content, including subelements, is included. The default value is false.
- page_limit (int) – The number of records to return in each page of results. The default page limit is 100.
- include_count (bool) – Whether to include information about the number of records returned.
- sort (str) – Sorts the response according to the value of the specified property, in ascending or descending order.
- cursor (str) – A token identifying the last value from the previous page of results.
Returns: A dict containing the IntentCollection response.
Return type:
-
update_intent
(workspace_id, intent, new_intent=None, new_description=None, new_examples=None)[source]¶ Update intent.
Update an existing intent with new or modified data. You must provide data defining the content of the updated intent.
Parameters: - workspace_id (str) – The workspace ID.
- intent (str) – The intent name (for example, pizza_order).
- new_intent (str) – The name of the intent.
- new_description (str) – The description of the intent.
- new_examples (list[CreateExample]) – An array of user input examples for the intent.
Returns: A dict containing the Intent response.
Return type:
-
create_example
(workspace_id, intent, text)[source]¶ Create user input example.
Add a new user input example to an intent.
Parameters: Returns: A dict containing the Example response.
Return type:
-
delete_example
(workspace_id, intent, text)[source]¶ Delete user input example.
Delete a user input example from an intent.
Parameters: Return type:
-
get_example
(workspace_id, intent, text)[source]¶ Get user input example.
Get information about a user input example.
Parameters: Returns: A dict containing the Example response.
Return type:
-
list_examples
(workspace_id, intent, page_limit=None, include_count=None, sort=None, cursor=None)[source]¶ List user input examples.
List the user input examples for an intent.
Parameters: - workspace_id (str) – The workspace ID.
- intent (str) – The intent name (for example, pizza_order).
- page_limit (int) – The number of records to return in each page of results. The default page limit is 100.
- include_count (bool) – Whether to include information about the number of records returned.
- sort (str) – Sorts the response according to the value of the specified property, in ascending or descending order.
- cursor (str) – A token identifying the last value from the previous page of results.
Returns: A dict containing the ExampleCollection response.
Return type:
-
update_example
(workspace_id, intent, text, new_text=None)[source]¶ Update user input example.
Update the text of a user input example.
Parameters: Returns: A dict containing the Example response.
Return type:
-
create_entity
(workspace_id, entity, description=None, metadata=None, values=None, fuzzy_match=None)[source]¶ Create entity.
Create a new entity.
Parameters: - workspace_id (str) – The workspace ID.
- entity (str) – The name of the entity.
- description (str) – The description of the entity.
- metadata (object) – Any metadata related to the value.
- values (list[CreateValue]) – An array of entity values.
- fuzzy_match (bool) – Whether to use fuzzy matching for the entity.
Returns: A dict containing the Entity response.
Return type:
-
delete_entity
(workspace_id, entity)[source]¶ Delete entity.
Delete an entity from a workspace.
Parameters: Return type:
-
get_entity
(workspace_id, entity, export=None)[source]¶ Get entity.
Get information about an entity, optionally including all entity content.
Parameters: - workspace_id (str) – The workspace ID.
- entity (str) – The name of the entity.
- export (bool) – Whether to include all element content in the returned data. If export=`false`, the returned data includes only information about the element itself. If export=`true`, all content, including subelements, is included. The default value is false.
Returns: A dict containing the EntityExport response.
Return type:
-
list_entities
(workspace_id, export=None, page_limit=None, include_count=None, sort=None, cursor=None)[source]¶ List entities.
List the entities for a workspace.
Parameters: - workspace_id (str) – The workspace ID.
- export (bool) – Whether to include all element content in the returned data. If export=`false`, the returned data includes only information about the element itself. If export=`true`, all content, including subelements, is included. The default value is false.
- page_limit (int) – The number of records to return in each page of results. The default page limit is 100.
- include_count (bool) – Whether to include information about the number of records returned.
- sort (str) – Sorts the response according to the value of the specified property, in ascending or descending order.
- cursor (str) – A token identifying the last value from the previous page of results.
Returns: A dict containing the EntityCollection response.
Return type:
-
update_entity
(workspace_id, entity, new_entity=None, new_description=None, new_metadata=None, new_fuzzy_match=None, new_values=None)[source]¶ Update entity.
Update an existing entity with new or modified data.
Parameters: - workspace_id (str) – The workspace ID.
- entity (str) – The name of the entity.
- new_entity (str) – The name of the entity.
- new_description (str) – The description of the entity.
- new_metadata (object) – Any metadata related to the entity.
- new_fuzzy_match (bool) – Whether to use fuzzy matching for the entity.
- new_values (list[CreateValue]) – An array of entity values.
Returns: A dict containing the Entity response.
Return type:
-
create_value
(workspace_id, entity, value, metadata=None, synonyms=None, patterns=None, value_type=None)[source]¶ Add entity value.
Create a new value for an entity.
Parameters: - workspace_id (str) – The workspace ID.
- entity (str) – The name of the entity.
- value (str) – The text of the entity value.
- metadata (object) – Any metadata related to the entity value.
- synonyms (list[str]) – An array of synonyms for the entity value.
- patterns (list[str]) – An array of patterns for the entity value. A pattern is specified as a regular expression.
- value_type (str) – Specifies the type of value (synonyms or patterns). The default value is synonyms.
Returns: A dict containing the Value response.
Return type:
-
delete_value
(workspace_id, entity, value)[source]¶ Delete entity value.
Delete a value for an entity.
Parameters: Return type:
-
get_value
(workspace_id, entity, value, export=None)[source]¶ Get entity value.
Get information about an entity value.
Parameters: - workspace_id (str) – The workspace ID.
- entity (str) – The name of the entity.
- value (str) – The text of the entity value.
- export (bool) – Whether to include all element content in the returned data. If export=`false`, the returned data includes only information about the element itself. If export=`true`, all content, including subelements, is included. The default value is false.
Returns: A dict containing the ValueExport response.
Return type:
-
list_values
(workspace_id, entity, export=None, page_limit=None, include_count=None, sort=None, cursor=None)[source]¶ List entity values.
List the values for an entity.
Parameters: - workspace_id (str) – The workspace ID.
- entity (str) – The name of the entity.
- export (bool) – Whether to include all element content in the returned data. If export=`false`, the returned data includes only information about the element itself. If export=`true`, all content, including subelements, is included. The default value is false.
- page_limit (int) – The number of records to return in each page of results. The default page limit is 100.
- include_count (bool) – Whether to include information about the number of records returned.
- sort (str) – Sorts the response according to the value of the specified property, in ascending or descending order.
- cursor (str) – A token identifying the last value from the previous page of results.
Returns: A dict containing the ValueCollection response.
Return type:
-
update_value
(workspace_id, entity, value, new_value=None, new_metadata=None, new_type=None, new_synonyms=None, new_patterns=None)[source]¶ Update entity value.
Update the content of a value for an entity.
Parameters: - workspace_id (str) – The workspace ID.
- entity (str) – The name of the entity.
- value (str) – The text of the entity value.
- new_value (str) – The text of the entity value.
- new_metadata (object) – Any metadata related to the entity value.
- new_type (str) – Specifies the type of value (synonyms or patterns). The default value is synonyms.
- new_synonyms (list[str]) – An array of synonyms for the entity value.
- new_patterns (list[str]) – An array of patterns for the entity value. A pattern is specified as a regular expression.
Returns: A dict containing the Value response.
Return type:
-
create_synonym
(workspace_id, entity, value, synonym)[source]¶ Add entity value synonym.
Add a new synonym to an entity value.
Parameters: Returns: A dict containing the Synonym response.
Return type:
-
delete_synonym
(workspace_id, entity, value, synonym)[source]¶ Delete entity value synonym.
Delete a synonym for an entity value.
Parameters: Return type:
-
get_synonym
(workspace_id, entity, value, synonym)[source]¶ Get entity value synonym.
Get information about a synonym for an entity value.
Parameters: Returns: A dict containing the Synonym response.
Return type:
-
list_synonyms
(workspace_id, entity, value, page_limit=None, include_count=None, sort=None, cursor=None)[source]¶ List entity value synonyms.
List the synonyms for an entity value.
Parameters: - workspace_id (str) – The workspace ID.
- entity (str) – The name of the entity.
- value (str) – The text of the entity value.
- page_limit (int) – The number of records to return in each page of results. The default page limit is 100.
- include_count (bool) – Whether to include information about the number of records returned.
- sort (str) – Sorts the response according to the value of the specified property, in ascending or descending order.
- cursor (str) – A token identifying the last value from the previous page of results.
Returns: A dict containing the SynonymCollection response.
Return type:
-
update_synonym
(workspace_id, entity, value, synonym, new_synonym=None)[source]¶ Update entity value synonym.
Update the information about a synonym for an entity value.
Parameters: Returns: A dict containing the Synonym response.
Return type:
-
create_dialog_node
(workspace_id, dialog_node, description=None, conditions=None, parent=None, previous_sibling=None, output=None, context=None, metadata=None, next_step=None, actions=None, title=None, node_type=None, event_name=None, variable=None)[source]¶ Create dialog node.
Create a dialog node.
Parameters: - workspace_id (str) – The workspace ID.
- dialog_node (str) – The dialog node ID.
- description (str) – The description of the dialog node.
- conditions (str) – The condition that will trigger the dialog node.
- parent (str) – The ID of the parent dialog node (if any).
- previous_sibling (str) – The previous dialog node.
- output (object) – The output of the dialog node.
- context (object) – The context for the dialog node.
- metadata (object) – The metadata for the dialog node.
- next_step (DialogNodeNextStep) – The next step to execute following this dialog node.
- actions (list[DialogNodeAction]) – The actions for the dialog node.
- title (str) – The alias used to identify the dialog node.
- node_type (str) – How the dialog node is processed.
- event_name (str) – How an event_handler node is processed.
- variable (str) – The location in the dialog context where output is stored.
Returns: A dict containing the DialogNode response.
Return type:
-
delete_dialog_node
(workspace_id, dialog_node)[source]¶ Delete dialog node.
Delete a dialog node from the workspace.
Parameters: Return type:
-
get_dialog_node
(workspace_id, dialog_node)[source]¶ Get dialog node.
Get information about a dialog node.
Parameters: Returns: A dict containing the DialogNode response.
Return type:
-
list_dialog_nodes
(workspace_id, page_limit=None, include_count=None, sort=None, cursor=None)[source]¶ List dialog nodes.
List the dialog nodes in the workspace.
Parameters: - workspace_id (str) – The workspace ID.
- page_limit (int) – The number of records to return in each page of results. The default page limit is 100.
- include_count (bool) – Whether to include information about the number of records returned.
- sort (str) – Sorts the response according to the value of the specified property, in ascending or descending order.
- cursor (str) – A token identifying the last value from the previous page of results.
Returns: A dict containing the DialogNodeCollection response.
Return type:
-
update_dialog_node
(workspace_id, dialog_node, new_dialog_node, new_description=None, new_conditions=None, new_parent=None, new_previous_sibling=None, new_output=None, new_context=None, new_metadata=None, new_next_step=None, new_title=None, new_type=None, new_event_name=None, new_variable=None, new_actions=None)[source]¶ Update dialog node.
Update information for a dialog node.
Parameters: - workspace_id (str) – The workspace ID.
- dialog_node (str) – The dialog node ID (for example, get_order).
- new_dialog_node (str) – The dialog node ID.
- new_description (str) – The description of the dialog node.
- new_conditions (str) – The condition that will trigger the dialog node.
- new_parent (str) – The ID of the parent dialog node (if any).
- new_previous_sibling (str) – The previous dialog node.
- new_output (object) – The output of the dialog node.
- new_context (object) – The context for the dialog node.
- new_metadata (object) – The metadata for the dialog node.
- new_next_step (DialogNodeNextStep) – The next step to execute following this dialog node.
- new_title (str) – The alias used to identify the dialog node.
- new_type (str) – How the node is processed.
- new_event_name (str) – How an event_handler node is processed.
- new_variable (str) – The location in the dialog context where output is stored.
- new_actions (list[DialogNodeAction]) – The actions for the dialog node.
Returns: A dict containing the DialogNode response.
Return type:
-
list_logs
(workspace_id, sort=None, filter=None, page_limit=None, cursor=None)[source]¶ List log events in a workspace.
List log events in a specific workspace.
Parameters: - workspace_id (str) – The workspace ID.
- sort (str) – Sorts the response according to the value of the specified property, in ascending or descending order.
- filter (str) – A cacheable parameter that limits the results to those matching the specified filter. For more information, see the [documentation](https://console.bluemix.net/docs/services/conversation/filter-reference.html#filter-query-syntax).
- page_limit (int) – The number of records to return in each page of results. The default page limit is 100.
- cursor (str) – A token identifying the last value from the previous page of results.
Returns: A dict containing the LogCollection response.
Return type:
-
create_counterexample
(workspace_id, text)[source]¶ Create counterexample.
Add a new counterexample to a workspace. Counterexamples are examples that have been marked as irrelevant input.
Parameters: Returns: A dict containing the Counterexample response.
Return type:
-
delete_counterexample
(workspace_id, text)[source]¶ Delete counterexample.
Delete a counterexample from a workspace. Counterexamples are examples that have been marked as irrelevant input.
Parameters: Return type:
-
get_counterexample
(workspace_id, text)[source]¶ Get counterexample.
Get information about a counterexample. Counterexamples are examples that have been marked as irrelevant input.
Parameters: Returns: A dict containing the Counterexample response.
Return type:
-
list_counterexamples
(workspace_id, page_limit=None, include_count=None, sort=None, cursor=None)[source]¶ List counterexamples.
List the counterexamples for a workspace. Counterexamples are examples that have been marked as irrelevant input.
Parameters: - workspace_id (str) – The workspace ID.
- page_limit (int) – The number of records to return in each page of results. The default page limit is 100.
- include_count (bool) – Whether to include information about the number of records returned.
- sort (str) – Sorts the response according to the value of the specified property, in ascending or descending order.
- cursor (str) – A token identifying the last value from the previous page of results.
Returns: A dict containing the CounterexampleCollection response.
Return type:
-
-
class
Context
(conversation_id, system, **kwargs)[source]¶ Bases:
object
Context information for the message. Include the context from the previous response to maintain state for the conversation.
Attr str conversation_id: The unique identifier of the conversation. Attr SystemResponse system: For internal use only.
-
class
Counterexample
(text, created, updated)[source]¶ Bases:
object
Counterexample.
Attr str text: The text of the counterexample. Attr datetime created: The timestamp for creation of the counterexample. Attr datetime updated: The timestamp for the last update to the counterexample.
-
class
CounterexampleCollection
(counterexamples, pagination)[source]¶ Bases:
object
CounterexampleCollection.
Attr list[Counterexample] counterexamples: An array of objects describing the examples marked as irrelevant input. Attr Pagination pagination: An object defining the pagination data for the returned objects.
-
class
CreateCounterexample
(text)[source]¶ Bases:
object
CreateCounterexample.
Attr str text: The text of a user input marked as irrelevant input.
-
class
CreateDialogNode
(dialog_node, description=None, conditions=None, parent=None, previous_sibling=None, output=None, context=None, metadata=None, next_step=None, actions=None, title=None, node_type=None, event_name=None, variable=None)[source]¶ Bases:
object
CreateDialogNode.
Attr str dialog_node: The dialog node ID. Attr str description: (optional) The description of the dialog node. Attr str conditions: (optional) The condition that will trigger the dialog node. Attr str parent: (optional) The ID of the parent dialog node (if any). Attr str previous_sibling: (optional) The previous dialog node. Attr object output: (optional) The output of the dialog node. Attr object context: (optional) The context for the dialog node. Attr object metadata: (optional) The metadata for the dialog node. Attr DialogNodeNextStep next_step: (optional) The next step to execute following this dialog node. Attr list[DialogNodeAction] actions: (optional) The actions for the dialog node. Attr str title: (optional) The alias used to identify the dialog node. Attr str node_type: (optional) How the dialog node is processed. Attr str event_name: (optional) How an event_handler node is processed. Attr str variable: (optional) The location in the dialog context where output is stored.
-
class
CreateEntity
(entity, description=None, metadata=None, values=None, fuzzy_match=None)[source]¶ Bases:
object
CreateEntity.
Attr str entity: The name of the entity. Attr str description: (optional) The description of the entity. Attr object metadata: (optional) Any metadata related to the value. Attr list[CreateValue] values: (optional) An array of entity values. Attr bool fuzzy_match: (optional) Whether to use fuzzy matching for the entity.
-
class
CreateExample
(text)[source]¶ Bases:
object
CreateExample.
Attr str text: The text of a user input example.
-
class
CreateIntent
(intent, description=None, examples=None)[source]¶ Bases:
object
CreateIntent.
Attr str intent: The name of the intent. Attr str description: (optional) The description of the intent. Attr list[CreateExample] examples: (optional) An array of user input examples.
-
class
CreateValue
(value, metadata=None, synonyms=None, patterns=None, value_type=None)[source]¶ Bases:
object
CreateValue.
Attr str value: The text of the entity value. Attr object metadata: (optional) Any metadata related to the entity value. Attr list[str] synonyms: (optional) An array of synonyms for the entity value. Attr list[str] patterns: (optional) An array of patterns for the entity value. A pattern is specified as a regular expression. Attr str value_type: (optional) Specifies the type of value (synonyms or patterns). The default value is synonyms.
-
class
DialogNode
(dialog_node_id, description, conditions, parent, previous_sibling, output, context, metadata, next_step, created, title, updated=None, actions=None, node_type=None, event_name=None, variable=None)[source]¶ Bases:
object
DialogNode.
Attr str dialog_node_id: The dialog node ID. Attr str description: The description of the dialog node. Attr str conditions: The condition that triggers the dialog node. Attr str parent: The ID of the parent dialog node. Attr str previous_sibling: The ID of the previous sibling dialog node. Attr object output: The output of the dialog node. Attr object context: The context (if defined) for the dialog node. Attr object metadata: The metadata (if any) for the dialog node. Attr DialogNodeNextStep next_step: The next step to execute following this dialog node. Attr datetime created: The timestamp for creation of the dialog node. Attr datetime updated: (optional) The timestamp for the most recent update to the dialog node. Attr list[DialogNodeAction] actions: (optional) The actions for the dialog node. Attr str title: The alias used to identify the dialog node. Attr str node_type: (optional) How the dialog node is processed. Attr str event_name: (optional) How an event_handler node is processed. Attr str variable: (optional) The location in the dialog context where output is stored.
-
class
DialogNodeAction
(name, result_variable, action_type=None, parameters=None, credentials=None)[source]¶ Bases:
object
DialogNodeAction.
Attr str name: The name of the action. Attr str action_type: (optional) The type of action to invoke. Attr object parameters: (optional) A map of key/value pairs to be provided to the action. Attr str result_variable: The location in the dialog context where the result of the action is stored. Attr str credentials: (optional) The name of the context variable that the client application will use to pass in credentials for the action.
-
class
DialogNodeCollection
(dialog_nodes, pagination)[source]¶ Bases:
object
DialogNodeCollection.
Attr list[DialogNode] dialog_nodes: Attr Pagination pagination: An object defining the pagination data for the returned objects.
-
class
DialogNodeNextStep
(behavior, dialog_node=None, selector=None)[source]¶ Bases:
object
The next step to execute following this dialog node.
Attr str behavior: How the next_step reference is processed. Attr str dialog_node: (optional) The ID of the dialog node to process next. Attr str selector: (optional) Which part of the dialog node to process next.
-
class
Entity
(entity_name, created, updated, description=None, metadata=None, fuzzy_match=None)[source]¶ Bases:
object
Entity.
Attr str entity_name: The name of the entity. Attr datetime created: The timestamp for creation of the entity. Attr datetime updated: The timestamp for the last update to the entity. Attr str description: (optional) The description of the entity. Attr object metadata: (optional) Any metadata related to the entity. Attr bool fuzzy_match: (optional) Whether fuzzy matching is used for the entity.
-
class
EntityCollection
(entities, pagination)[source]¶ Bases:
object
An array of entities.
Attr list[EntityExport] entities: An array of entities. Attr Pagination pagination: An object defining the pagination data for the returned objects.
-
class
EntityExport
(entity_name, created, updated, description=None, metadata=None, fuzzy_match=None, values=None)[source]¶ Bases:
object
EntityExport.
Attr str entity_name: The name of the entity. Attr datetime created: The timestamp for creation of the entity. Attr datetime updated: The timestamp for the last update to the entity. Attr str description: (optional) The description of the entity. Attr object metadata: (optional) Any metadata related to the entity. Attr bool fuzzy_match: (optional) Whether fuzzy matching is used for the entity. Attr list[ValueExport] values: (optional) An array of entity values.
-
class
Example
(example_text, created, updated)[source]¶ Bases:
object
Example.
Attr str example_text: The text of the example. Attr datetime created: The timestamp for creation of the example. Attr datetime updated: The timestamp for the last update to the example.
-
class
ExampleCollection
(examples, pagination)[source]¶ Bases:
object
ExampleCollection.
Attr list[Example] examples: An array of Example objects describing the examples defined for the intent. Attr Pagination pagination: An object defining the pagination data for the returned objects.
-
class
InputData
(text)[source]¶ Bases:
object
An object defining the user input.
Attr str text: The text of the user input.
-
class
Intent
(intent_name, created, updated, description=None)[source]¶ Bases:
object
Intent.
Attr str intent_name: The name of the intent. Attr datetime created: The timestamp for creation of the intent. Attr datetime updated: The timestamp for the last update to the intent. Attr str description: (optional) The description of the intent.
-
class
IntentCollection
(intents, pagination)[source]¶ Bases:
object
IntentCollection.
Attr list[IntentExport] intents: An array of intents. Attr Pagination pagination: An object defining the pagination data for the returned objects.
-
class
IntentExport
(intent_name, created, updated, description=None, examples=None)[source]¶ Bases:
object
IntentExport.
Attr str intent_name: The name of the intent. Attr datetime created: The timestamp for creation of the intent. Attr datetime updated: The timestamp for the last update to the intent. Attr str description: (optional) The description of the intent. Attr list[Example] examples: (optional) An array of user input examples.
-
class
LogCollection
(logs, pagination)[source]¶ Bases:
object
LogCollection.
Attr list[LogExport] logs: An array of log events. Attr LogPagination pagination: An object defining the pagination data for the returned objects.
-
class
LogExport
(request, response, log_id, request_timestamp, response_timestamp, workspace_id, language)[source]¶ Bases:
object
LogExport.
Attr MessageRequest request: A request formatted for the Conversation service. Attr MessageResponse response: A response from the Conversation service. Attr str log_id: A unique identifier for the logged message. Attr str request_timestamp: The timestamp for receipt of the message. Attr str response_timestamp: The timestamp for the system response to the message. Attr str workspace_id: The workspace ID. Attr str language: The language of the workspace where the message request was made.
-
class
LogMessage
(level, msg, **kwargs)[source]¶ Bases:
object
Log message details.
Attr str level: The severity of the message. Attr str msg: The text of the message.
-
class
LogPagination
(next_url=None, matched=None)[source]¶ Bases:
object
The pagination data for the returned objects.
Attr str next_url: (optional) The URL that will return the next page of results. Attr int matched: (optional) Reserved for future use.
-
class
MessageInput
(text=None)[source]¶ Bases:
object
An input object that includes the input text.
Attr str text: (optional) The user’s input.
-
class
MessageRequest
(input=None, alternate_intents=None, context=None, entities=None, intents=None, output=None)[source]¶ Bases:
object
A request formatted for the Conversation service.
Attr InputData input: (optional) An input object that includes the input text. Attr bool alternate_intents: (optional) Whether to return more than one intent. Set to true to return all matching intents. Attr Context context: (optional) State information for the conversation. Continue a conversation by including the context object from the previous response. Attr list[RuntimeEntity] entities: (optional) Include the entities from the previous response when they do not need to change and to prevent Watson from trying to identify them. Attr list[RuntimeIntent] intents: (optional) An array of name-confidence pairs for the user input. Include the intents from the previous response when they do not need to change and to prevent Watson from trying to identify them. Attr OutputData output: (optional) System output. Include the output from the request when you have several requests within the same Dialog turn to pass back in the intermediate information.
-
class
MessageResponse
(intents, entities, context, output, input=None, alternate_intents=None, **kwargs)[source]¶ Bases:
object
A response from the Conversation service.
Attr MessageInput input: (optional) The user input from the request. Attr list[RuntimeIntent] intents: An array of intents recognized in the user input, sorted in descending order of confidence. Attr list[RuntimeEntity] entities: An array of entities identified in the user input. Attr bool alternate_intents: (optional) Whether to return more than one intent. true indicates that all matching intents are returned. Attr Context context: State information for the conversation. Attr OutputData output: Output from the dialog, including the response to the user, the nodes that were triggered, and log messages.
-
class
OutputData
(log_messages, text, nodes_visited=None, **kwargs)[source]¶ Bases:
object
An output object that includes the response to the user, the nodes that were hit, and messages from the log.
Attr list[LogMessage] log_messages: Up to 50 messages logged with the request. Attr list[str] text: An array of responses to the user. Attr list[str] nodes_visited: (optional) An array of the nodes that were triggered to create the response.
-
class
Pagination
(refresh_url, next_url=None, total=None, matched=None)[source]¶ Bases:
object
The pagination data for the returned objects.
Attr str refresh_url: The URL that will return the same page of results. Attr str next_url: (optional) The URL that will return the next page of results. Attr int total: (optional) Reserved for future use. Attr int matched: (optional) Reserved for future use.
-
class
RuntimeEntity
(entity, location, value, confidence=None, metadata=None, **kwargs)[source]¶ Bases:
object
A term from the request that was identified as an entity.
Attr str entity: The recognized entity from a term in the input. Attr list[int] location: Zero-based character offsets that indicate where the entity value begins and ends in the input text. Attr str value: The term in the input text that was recognized. Attr float confidence: (optional) A decimal percentage that represents Watson’s confidence in the entity. Attr object metadata: (optional) The metadata for the entity.
-
class
RuntimeIntent
(intent, confidence, **kwargs)[source]¶ Bases:
object
An intent identified in the user input.
Attr str intent: The name of the recognized intent. Attr float confidence: A decimal percentage that represents Watson’s confidence in the intent.
-
class
Synonym
(synonym_text, created, updated)[source]¶ Bases:
object
Synonym.
Attr str synonym_text: The text of the synonym. Attr datetime created: The timestamp for creation of the synonym. Attr datetime updated: The timestamp for the most recent update to the synonym.
-
class
SynonymCollection
(synonyms, pagination)[source]¶ Bases:
object
SynonymCollection.
Attr list[Synonym] synonyms: An array of synonyms. Attr Pagination pagination: An object defining the pagination data for the returned objects.
-
class
Value
(value_text, created, updated, value_type, metadata=None, synonyms=None, patterns=None)[source]¶ Bases:
object
Value.
Attr str value_text: The text of the entity value. Attr object metadata: (optional) Any metadata related to the entity value. Attr datetime created: The timestamp for creation of the entity value. Attr datetime updated: The timestamp for the last update to the entity value. Attr list[str] synonyms: (optional) An array of synonyms for the entity value. Attr list[str] patterns: (optional) An array of patterns for the entity value. A pattern is specified as a regular expression. Attr str value_type: Specifies the type of value (synonyms or patterns). The default value is synonyms.
-
class
ValueCollection
(values, pagination)[source]¶ Bases:
object
ValueCollection.
Attr list[ValueExport] values: An array of entity values. Attr Pagination pagination: An object defining the pagination data for the returned objects.
-
class
ValueExport
(value_text, created, updated, value_type, metadata=None, synonyms=None, patterns=None)[source]¶ Bases:
object
ValueExport.
Attr str value_text: The text of the entity value. Attr object metadata: (optional) Any metadata related to the entity value. Attr datetime created: The timestamp for creation of the entity value. Attr datetime updated: The timestamp for the last update to the entity value. Attr list[str] synonyms: (optional) An array of synonyms. Attr list[str] patterns: (optional) An array of patterns for the entity value. A pattern is specified as a regular expression. Attr str value_type: Specifies the type of value (synonyms or patterns). The default value is synonyms.
-
class
Workspace
(name, language, created, updated, workspace_id, description=None, metadata=None, learning_opt_out=None)[source]¶ Bases:
object
Workspace.
Attr str name: The name of the workspace. Attr str language: The language of the workspace. Attr datetime created: The timestamp for creation of the workspace. Attr datetime updated: The timestamp for the last update to the workspace. Attr str workspace_id: The workspace ID. Attr str description: (optional) The description of the workspace. Attr object metadata: (optional) Any metadata that is required by the workspace. Attr bool learning_opt_out: (optional) Whether training data from the workspace can be used by IBM for general service improvements. true indicates that workspace training data is not to be used.
-
class
WorkspaceCollection
(workspaces, pagination)[source]¶ Bases:
object
WorkspaceCollection.
Attr list[Workspace] workspaces: An array of workspaces. Attr Pagination pagination: An object defining the pagination data for the returned objects.
-
class
WorkspaceExport
(name, description, language, metadata, created, updated, workspace_id, status, learning_opt_out, intents=None, entities=None, counterexamples=None, dialog_nodes=None)[source]¶ Bases:
object
WorkspaceExport.
Attr str name: The name of the workspace. Attr str description: The description of the workspace. Attr str language: The language of the workspace. Attr object metadata: Any metadata that is required by the workspace. Attr datetime created: The timestamp for creation of the workspace. Attr datetime updated: The timestamp for the last update to the workspace. Attr str workspace_id: The workspace ID. Attr str status: The current status of the workspace. Attr bool learning_opt_out: Whether training data from the workspace can be used by IBM for general service improvements. true indicates that workspace training data is not to be used. Attr list[IntentExport] intents: (optional) An array of intents. Attr list[EntityExport] entities: (optional) An array of entities. Attr list[Counterexample] counterexamples: (optional) An array of counterexamples. Attr list[DialogNode] dialog_nodes: (optional) An array of objects describing the dialog nodes in the workspace.