Class: AiClient
- Inherits:
-
Object
- Object
- AiClient
- Defined in:
- lib/ai_client.rb
Class Method Summary collapse
- .import(path) ⇒ Object
- .learn_answer(utterances, response) ⇒ Object
- .learn_script(utterances, script) ⇒ Object
- .list_answers ⇒ Object
- .list_scripts ⇒ Object
Class Method Details
.import(path) ⇒ Object
5 6 7 8 9 |
# File 'lib/ai_client.rb', line 5 def self.import(path) data = { knowledge: JSON.parse(File.read(path)) } WebClient.post(BASE_URL + '/api/v1/direct_responses/import', data) end |
.learn_answer(utterances, response) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ai_client.rb', line 11 def self.learn_answer(utterances, response) body = { knowledge: { "knowledge" => [ { "utterances" => utterances, "response": response } ] } } WebClient.post(BASE_URL + '/api/v1/direct_responses/import', body) end |
.learn_script(utterances, script) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ai_client.rb', line 25 def self.learn_script(utterances, script) body = { knowledge: { "scripts" => [ { "utterances" => utterances, "script": script } ] } } WebClient.post(BASE_URL + '/api/v1/direct_responses/import', body) end |