1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
(**
Watson Conversation Service data structures.
Data srcutures used in Watson Conversation Service.
Based on the documentation available at:
https://www.ibm.com/watson/developercloud/conversation/api/v1/
Version 2017-05-26.
*)
type workspace_status =
Ws_non_existent | Ws_training | Ws_failed | Ws_available | Ws_unavailable
(** Type of arbitraty JSON values. *)
type json = Json_t.json
(** A workspace metadata. *)
type workspace_response = {
ws_rsp_name : string option;
ws_rsp_description : string option;
ws_rsp_language : string option;
ws_rsp_metadata : json option;
ws_rsp_created : string option;
ws_rsp_updated : string option;
ws_rsp_workspace_id : string
}
(** Type of Spel expressions. *)
type spel = Spel_t.expression
(** Goto selector. *)
type selector = Goto_user_input | Goto_client | Goto_condition | Goto_body
(** Type of arbitraty JSON values with embedded Spel expressions. *)
type json_spel = Json_spel_t.json_spel
(** Type of outputs of a dialog node. *)
type output_def = json_spel
(** Type of goto definitions. *)
type next_step = {
next_behavior : string;
next_selector : selector;
next_dialog_node : string
}
(** Type of intent examples. *)
type intent_example = {
ex_text : string;
ex_created : string option;
ex_updated : string option
}
(** Type of intent definitions. *)
type intent_def = {
i_def_intent : string;
i_def_description : string option;
i_def_examples : intent_example list;
i_def_created : string option;
i_def_updated : string option
}
(** Type of entity values. *)
type entity_value = {
e_val_value : string;
e_val_metadata : json option;
e_val_synonyms : string list;
e_val_created : string option;
e_val_updated : string option
}
(** Type of entity definitions. *)
type entity_def = {
e_def_entity : string;
e_def_description : string option;
e_def_metadata : json option;
e_def_source : string option;
e_def_open_list : bool option;
e_def_values : entity_value list;
e_def_created : string option;
e_def_updated : string option;
e_def_fuzzy_match : bool option
}
(** Dialog node type. *)
type dialog_node_type =
Node_response_condition | Node_frame | Node_event_handler | Node_slot
type dialog_node_event_name =
Evt_focus | Evt_input | Evt_nomatch | Evt_filled | Evt_generic
(** Type of dialog nodes. *)
type dialog_node = {
node_dialog_node : string;
node_type_ : dialog_node_type option;
node_description : string option;
node_conditions : spel option;
node_parent : string option;
node_previous_sibling : string option;
node_output : output_def option;
node_context : json_spel option;
node_metadata : json option;
node_next_step : next_step option;
node_child_input_kind : string option;
node_created : string option;
node_updated : string option;
node_event_name : dialog_node_event_name option;
node_variable : string option
}
(** Type of workspaces *)
type workspace = {
ws_name : string option;
ws_description : string option;
ws_language : string option;
ws_metadata : json option;
ws_counterexamples : intent_example list;
ws_dialog_nodes : dialog_node list;
ws_entities : entity_def list;
ws_intents : intent_def list;
ws_created : string option;
ws_updated : string option;
ws_modified : string option;
ws_created_by : string option;
ws_modified_by : string option;
ws_workspace_id : string option;
ws_status : workspace_status option
}
(** Supported versions *)
type version = V_2017_05_26
(** Sorting criteria for list of workspaces. *)
type sort_workspace_criteria =
Sort_name_incr | Sort_modified_incr | Sort_workspace_id_incr
| Sort_name_decr | Sort_modified_decr | Sort_workspace_id_decr
(** Sorting criteria for logs. *)
type sort_logs_criteria =
Sort_request_timestamp_incr | Sort_request_timestamp_decr
(** Pagination information *)
type pagination_response = {
pag_refresh_url : string option;
pag_next_url : string option;
pag_total : int option;
pag_matched : int option
}
type log_message = {
log_msg__level : string;
log_msg__msg : string
}
type output = {
out_log_messages : log_message list;
out_text : string list;
out_nodes_visited : string list;
out_error : string option
}
type intent = {
i_intent : string;
i_confidence : float
}
type input = { in_text : string }
type entity = {
e_entity : string;
e_location : int list;
e_value : string;
e_confidence : float
}
type message_response = {
msg_rsp_input : input;
msg_rsp_alternate_intents : bool;
msg_rsp_context : json;
msg_rsp_entities : entity list;
msg_rsp_intents : intent list;
msg_rsp_output : output
}
type message_request = {
msg_req_input : input;
msg_req_alternate_intents : bool;
msg_req_context : json option;
msg_req_entities : entity list option;
msg_req_intents : intent list option;
msg_req_output : output option
}
type log_entry = {
log_request : message_request;
log_response : message_response;
log_log_id : string;
log_request_timestamp : string;
log_response_timestamp : string
}
type logs_response = {
logs_rsp_logs : log_entry list;
logs_rsp_pagination : pagination_response
}
(** Request for the list the events from the log of a workspace. *)
type logs_request = {
logs_filter : string option;
logs_sort : sort_logs_criteria option;
logs_page_limit : int option;
logs_cursor : string option
}
(** Response to the list of workspaces request. *)
type list_workspaces_response = {
list_ws_rsp_workspaces : workspace_response list;
list_ws_rsp_pagination : pagination_response
}
(** Request the list of workspaces. *)
type list_workspaces_request = {
list_ws_req_page_limit : int option;
list_ws_req_include_count : bool option;
list_ws_req_sort : sort_workspace_criteria option;
list_ws_req_cursor : string option
}
type get_workspace_request = {
get_ws_req_workspace_id : string;
get_ws_req_export : bool option
}
(** Watson Conversation Service credentials. *)
type credential = {
cred_url : string;
cred_password : string;
cred_username : string
}
type create_response = {
crea_rsp_name : string option;
crea_rsp_description : string option;
crea_rsp_language : string option;
crea_rsp_metadata : json option;
crea_rsp_created : string option;
crea_rsp_updated : string option;
crea_rsp_workspace_id : string option
}
type context = {
ctx_conversation_id : string;
ctx_system : json
}
type action_def = {
act_def_name : string;
act_def_agent : string;
act_def_type_ : string;
act_def_parameters : json_spel;
act_def_result_variable : string option
}
type action = {
act_name : string;
act_agent : string;
act_type_ : string;
act_parameters : json;
act_result_variable : string option
}