ai物联网工程师_如何将Api.ai助手连接到物联网
ai物聯(lián)網(wǎng)工程師
If you’re keen to learn more on AI, check out our screencast Microsoft Cognitive Services and the Text Analytics API, for AI sentiment in your bot.
如果您想了解有關(guān)AI的更多信息,請(qǐng)查看我們的截屏視頻Microsoft Cognitive Services和Text Analytics API ,了解您機(jī)器人中的AI情緒。
The potential of a personal assistant gets exciting when it has access to personal data and the real world via the Internet of Things. New possibilities arise — from requesting your assistant turn on your lights to asking it how well you slept. We’ll be connecting your Api.ai assistant to the Jawbone Up API as an example of this.
當(dāng)個(gè)人助理可以通過(guò)物聯(lián)網(wǎng)訪問(wèn)個(gè)人數(shù)據(jù)和現(xiàn)實(shí)世界時(shí),其潛力會(huì)變得令人興奮。 出現(xiàn)了新的可能性-從要求您的助手打開(kāi)燈光到詢問(wèn)您的睡眠狀況如何。 作為示例,我們將把您的Api.ai助手連接到Jawbone Up API。
Note: this article was updated in 2017 to reflect recent changes to Api.ai.
注意:本文于2017年更新,以反映對(duì)Api.ai的最新更改。
您需要什么 (What You’ll Need)
This article builds upon a variety of concepts we’ve already covered in previous articles here at SitePoint. In order to follow along with this tutorial comfortably, you’ll need the following.
本文基于SitePoint先前文章中已經(jīng)介紹的各種概念。 為了舒適地遵循本教程,您需要以下內(nèi)容。
An Api.ai agent connected to a simple HTML web app. See this article if you’d like to understand this process. Otherwise, you can download the code from this guide and use it too.
連接到簡(jiǎn)單HTML Web應(yīng)用程序的Api.ai代理。 如果您想了解此過(guò)程,請(qǐng)參閱本文 。 否則,您可以從本指南中下載代碼并使用它。
An agent that has been taught the entity of “sleep”. We created this in Empowering Your Api.ai Assistant with Entities. It should understand concepts like “how much sleep did I have last night?” and “how much REM sleep did I get?” If you’re looking to adapt this to your own IoT device, you’ll need to have created your own custom entity that understands your IoT functionality.
已被告知“睡眠”實(shí)體的代理。 我們是在通過(guò)實(shí)體為您的Api.ai助手賦權(quán)的過(guò)程中創(chuàng)建的。 它應(yīng)該理解諸如“昨晚我睡了多少時(shí)間”之類的概念。 和“我獲得了多少REM睡眠?” 如果您想使其適應(yīng)自己的物聯(lián)網(wǎng)設(shè)備,則需要?jiǎng)?chuàng)建自己的自定義實(shí)體,以了解您的物聯(lián)網(wǎng)功能。
A general knowledge of Node.js and running a Node server. Without it, you won’t be able to get the server running!
Node.js和運(yùn)行節(jié)點(diǎn)服務(wù)器的一般知識(shí)。 沒(méi)有它,您將無(wú)法使服務(wù)器運(yùn)行!
Knowledge of how to use the Jawbone UP API (or another API you intend to use). We’ve covered the Jawbone Up API previously in Connecting to the Jawbone Up API with Node.js, and I’ll be referring to sections from that article throughout.
了解如何使用Jawbone UP API(或您打算使用的其他API)。 之前,我們?cè)谑褂肗ode.js連接到Jawbone Up API中已經(jīng)介紹了Jawbone Up API,并且我將始終引用該文章的各個(gè)部分。
An SSL certificate to run your site on HTTPS. You’ll need this if working with the Jawbone Up API. As mentioned at the start of this series, overall it’s a bit easier to do a lot of this on HTTPS. We cover how to set up a self signed certificate on the Jawbone Up API article if you’re interested, but it’s not the easiest option these days. You can do it really easily using Let’s Encrypt as mentioned in the first article in the series. Glitch.com also provides a great prototyping environment that comes with HTTPS by default.
用于在HTTPS上運(yùn)行您的站點(diǎn)的SSL證書。 如果使用Jawbone Up API,則需要此功能。 正如本系列文章開(kāi)頭提到的,總體上,在HTTPS上執(zhí)行許多操作要容易一些。 如果您有興趣,我們將在Jawbone Up API文章中介紹如何設(shè)置自簽名證書 ,但這不是當(dāng)前最簡(jiǎn)單的選擇。 您可以使用本系列第一篇文章中提到的“讓我們加密”來(lái)真正輕松地做到這一點(diǎn)。 默認(rèn)情況下, Glitch.com還提供了HTTPS隨附的出色原型開(kāi)發(fā)環(huán)境。
代碼 (The Code)
All code for this demo is available for you to download and use however you please! You can find it all on GitHub.
您可以下載和使用此演示的所有代碼,請(qǐng)您隨意使用! 您可以在GitHub上找到所有內(nèi)容 。
運(yùn)作方式 (How This Works)
Your Api.ai assistant is already connected to a simple web app that accepts statements via the HTML5 Speech Recognition API. From here, you need to add a new bit of functionality that listens for a specific action from your Api.ai agent. In your case, this is the action of “sleepHours”.
您的Api.ai助手已經(jīng)連接到一個(gè)簡(jiǎn)單的Web應(yīng)用程序,該應(yīng)用程序通過(guò)HTML5語(yǔ)音識(shí)別API接受語(yǔ)句。 從這里開(kāi)始,您需要添加一些新功能,以偵聽(tīng)來(lái)自Api.ai代理的特定操作。 在您的情況下,這是“ sleepHours”的動(dòng)作。
Whenever your JavaScript detects this action, it triggers a separate call to your Node.js app to ask the Jawbone API for that data. Once the web app receives this data, your web app turns it into a nice sentence and reads it out —?giving your assistant a whole new range of intelligence!
每當(dāng)您JavaScript檢測(cè)到此操作時(shí),它都會(huì)觸發(fā)對(duì)Node.js應(yīng)用的單獨(dú)調(diào)用,以要求Jawbone API提供該數(shù)據(jù)。 Web應(yīng)用程序接收到這些數(shù)據(jù)后,您的Web應(yīng)用程序會(huì)將其變成一個(gè)漂亮的句子并讀出來(lái)-為您的助手提供全新的智能范圍!
您的項(xiàng)目結(jié)構(gòu) (Your Project Structure)
I’ve adjusted the app from the initial HTML-only structure to one that uses EJS views so that you can switch pages in your web app when logging into the Jawbone Up API via OAuth. In reality, you only really have one page, but this method allows you to add more in future if needed for other IoT devices. This single view is at /views/index.ejs. You then have your Node server in the root folder as server.js and certificate files in root too. To keep things relatively simple and contained, all front-end JavaScript and CSS is inline. Feel free to move these into CSS and JS files as you prefer, minify them and make them pretty.
我已經(jīng)將應(yīng)用程序從最初的僅HTML結(jié)構(gòu)調(diào)整為使用EJS視圖的結(jié)構(gòu),以便在通過(guò)OAuth登錄Jawbone Up API時(shí)可以在Web應(yīng)用程序中切換頁(yè)面。 實(shí)際上,您實(shí)際上只有一頁(yè),但是此方法允許您將來(lái)在其他物聯(lián)網(wǎng)設(shè)備需要時(shí)添加更多頁(yè)面。 該單一視圖位于/views/index.ejs 。 然后,將節(jié)點(diǎn)服務(wù)器作為server.js放在根文件夾中,并將證書文件也放在根目錄中。 為了使事情相對(duì)簡(jiǎn)單和包含內(nèi)容,所有前端JavaScript和CSS都是內(nèi)聯(lián)的。 隨意將它們隨意移動(dòng)到CSS和JS文件中,將它們縮小并使其漂亮。
響應(yīng)JavaScript中的Api.ai操作 (Responding to Api.ai Actions in JavaScript)
As you might remember from the previous article, when Api.ai returns a response, it provides a JSON object that looks like so:
您可能還記得上一篇文章,當(dāng)Api.ai返回響應(yīng)時(shí),它提供了一個(gè)JSON對(duì)象,如下所示:
{"id": "6b42eb42-0ad2-4bab-b7ea-853773b90219","timestamp": "2016-02-12T01:25:09.173Z","result": {"source": "agent","resolvedQuery": "how did I sleep last night","speech": "I'll retrieve your sleep stats for you now, one moment!","action": "sleepHours","parameters": {"sleep": "sleep"},"metadata": {"intentId": "25d04dfc-c90c-4f55-a7bd-6681e83b45ec","inputContexts": [],"outputContexts": [],"contexts": [],"intentName": "How many hours of @sleep:sleep did I get last night?"}},"status": {"code": 200,"errorType": "success"} }Within that JSON object there are two bits of data you need to use — action and parameters.sleep:
在該JSON對(duì)象中,您需要使用兩位數(shù)據(jù)action和parameters.sleep :
"action": "sleepHours", "parameters": {"sleep": "sleep" },action is the name you gave to the Api.ai action that the user has triggered. In the case of your sleep example, you named it “sleepHours”. parameters contain the variables in your sentence that can change a few details. In the case of sleep, your parameter tells you what type of sleep — “sleep”, “deep sleep”, “l(fā)ight sleep” or “REM sleep” (or just “REM”).
action是您為用戶觸發(fā)的Api.ai操作指定的名稱。 在您的睡眠示例中,您將其命名為“ sleepHours”。 parameters包含句子中的變量,可以更改一些細(xì)節(jié)。 在睡眠的情況下,您的參數(shù)告訴您什么類型的睡眠-“睡眠”,“深度睡眠”,“輕度睡眠”或“ REM睡眠”(或簡(jiǎn)稱為“ REM”)。
Initially, in an earlier article on Api.ai, the prepareResponse() function took the JSON response from Api.ai, put the whole thing into your debug text field on the bottom right and took out Api.ai’s verbal response to display in the web app. You completely relied on what your Api.ai agent said, without adding any of your own functionality:
最初,在之前有關(guān)Api.ai的文章中, prepareResponse()函數(shù)從Api.ai接收J(rèn)SON響應(yīng),將整個(gè)內(nèi)容放入右下角的調(diào)試文本字段中,并取出Api.ai的口頭響應(yīng)以顯示在網(wǎng)絡(luò)應(yīng)用。 您完全依賴Api.ai代理所說(shuō)的內(nèi)容,而無(wú)需添加任何自己的功能:
function prepareResponse(val) {var debugJSON = JSON.stringify(val, undefined, 2),spokenResponse = val.result.speech;respond(spokenResponse);debugRespond(debugJSON); }This time around, keep an eye out for the action field and run your own function called requestSleepData() if the action contains "sleepHours". Within this function, pass in the sleep parameter so you know what type of sleep is being requested:
這一次,請(qǐng)注意action字段,如果該動(dòng)作包含"sleepHours" ,請(qǐng)運(yùn)行您自己的名為requestSleepData()的函數(shù)。 在此函數(shù)中,傳入sleep參數(shù),以便您知道請(qǐng)求哪種類型的睡眠:
function prepareResponse(val) {var debugJSON = JSON.stringify(val, undefined, 2),spokenResponse = val.result.speech;if (val.result.action == "sleepHours") {requestSleepData(val.result.parameters.sleep);} else {respond(spokenResponse);}debugRespond(debugJSON); }Within requestSleepData(), request all sleep data from your Node.js server and then filter it by looking at the very first value in the returned array of data (data.items[0].details): this would be last night’s sleep. Within these details, you have data.items[0].details.rem with your REM sleep, data.items[0].details.sound with your deep sleep, data.items[0].details.light with your light sleep and data.items[0].details.duration with the combined amount of sleep recorded:
在requestSleepData() ,從Node.js服務(wù)器請(qǐng)求所有睡眠數(shù)據(jù),然后通過(guò)查看返回的數(shù)據(jù)數(shù)組中的第一個(gè)值( data.items[0].details )進(jìn)行data.items[0].details :這將是昨晚的睡眠。 在這些細(xì)節(jié),你有data.items[0].details.rem與REM睡眠, data.items[0].details.sound與你的深度睡眠, data.items[0].details.light與淺睡眠和data.items[0].details.duration與記錄的總睡眠時(shí)間:
function requestSleepData(type) {$.ajax({type: "GET",url: "/sleep_data/",contentType: "application/json; charset=utf-8",dataType: "json",success: function(data) {console.log("Sleep data!", data);if (data.error) {respond(data.error);window.location.replace("/login/jawbone");}switch (type) {case "REM sleep":respond("You had " + toHours(data.items[0].details.rem) + " of REM sleep.");break;case "deep sleep":respond("You had " + toHours(data.items[0].details.sound) + " of deep sleep.");break;case "light sleep":respond("You had " + toHours(data.items[0].details.light) + " of light sleep.");break;case "sleep":respond("You had " + toHours(data.items[0].details.duration) + " of sleep last night. That includes " + toHours(data.items[0].details.rem) + " of REM sleep, " + toHours(data.items[0].details.sound) + " of deep sleep and " + toHours(data.items[0].details.light) + " of light sleep.");break;}},error: function() {respond(messageInternalError);}}); }toHours() is a crude and quick function that formats your times into sentences like “1 hour, 53 minutes and 59 seconds”:
toHours()是一種粗略而快捷的函數(shù),可將您的時(shí)間格式化為“ 1小時(shí)53分59秒”之類的句子:
function toHours(secs) {hours = Math.floor(secs / 3600),minutes = Math.floor((secs - (hours * 3600)) / 60),seconds = secs - (hours * 3600) - (minutes * 60);hourText = hours + (hours > 1 ? " hours, " : " hour, ");minuteText = minutes + (minutes > 1 ? " minutes " : " minute ");secondText = seconds + (seconds > 1 ? " seconds" : " second");return hourText + minuteText + "and " + secondText; }As you’ll see when looking into the requestSleepData() function, the end result is a call to respond() — the same function that previously took Api.ai’s voice response. You reuse your existing functionality to bring speech to your own response, allowing your assistant to tell the user this information once it’s ready.
正如您在查看requestSleepData()函數(shù)時(shí)所看到的那樣,最終結(jié)果是調(diào)用了response respond() ,該函數(shù)先前與Api.ai的語(yǔ)音響應(yīng)相同。 您可以重用現(xiàn)有功能,以使語(yǔ)音響應(yīng)自己的React,使您的助手在準(zhǔn)備好信息后就可以告訴用戶。
One last aspect of your front-end JavaScript to point out is error handling. If you have an issue with how Jawbone returns data (usually due to not being logged into the service), your server responds with a JSON value in the format of {"error" : "Your error message"}. The assistant sees this and automatically takes the user to your OAuth login page:
要指出的前端JavaScript的最后一個(gè)方面是錯(cuò)誤處理。 如果您對(duì)Jawbone返回?cái)?shù)據(jù)的方式有疑問(wèn)(通常是由于未登錄服務(wù)),則服務(wù)器將以{"error" : "Your error message"}格式返回JSON值。 助手會(huì)看到此情況,并自動(dòng)將用戶帶到您的OAuth登錄頁(yè)面:
if (data.error) {respond(data.error);window.location.replace("/login/jawbone"); }您的Node.js服務(wù)器 (Your Node.js Server)
Your Node.js server is based on the one used in Connecting to the Jawbone UP API with Node.js. If any of the code looks confusing, feel free to refer to that earlier article, as it explains all about connecting to the Jawbone API via OAuth and setting up an HTTPS server to run it. If you don’t have a Jawbone Up, the same concepts can be used for other IoT devices. You would just need to add your own methods of responding to GET requests with different data (and you may not need to worry about OAuth). The Jawbone Up data here is just an example.
您的Node.js服務(wù)器基于使用Node.js連接到Jawbone UP API中使用的服務(wù)器 。 如果任何代碼看起來(lái)令人困惑,請(qǐng)隨時(shí)參考該較早的文章,因?yàn)樗忉屃擞嘘P(guān)通過(guò)OAuth連接到Jawbone API以及設(shè)置HTTPS服務(wù)器以運(yùn)行它的所有內(nèi)容。 如果您沒(méi)有Jawbone Up,則可以將相同的概念用于其他IoT設(shè)備。 您只需要添加自己的方法即可使用不同的數(shù)據(jù)來(lái)響應(yīng)GET請(qǐng)求(并且您不必?fù)?dān)心OAuth)。 這里的Jawbone Up數(shù)據(jù)只是一個(gè)例子。
Your Jawbone data has been adjusted from the earlier article to provide a simple JSON response rather than formatting it all into a table template view. The variables of up and options have been moved to global variables so that they can be reused in multiple requests to the API (in that other SitePoint example, we only requested data in one big chunk each time).
您的Jawbone數(shù)據(jù)已根據(jù)上一篇文章進(jìn)行了調(diào)整,以提供簡(jiǎn)單的JSON響應(yīng),而不是將其全部格式化為表格模板視圖。 up和options變量已移至全局變量,以便可以在對(duì)API的多次請(qǐng)求中重復(fù)使用(在另一個(gè)SitePoint示例中,我們每次僅請(qǐng)求一大塊數(shù)據(jù))。
To log into the Jawbone API via OAuth, the user can go to /login/jawbone. However, as you saw above, they don’t need to know to do this. Your assistant can also redirect them if it notices they aren’t logged in. You could also add a new intent into your Api.ai agent that understands the phrase “l(fā)og me into my Jawbone Up data”, if you wanted to make this truly seamless. Your login route in Node.js looks like so:
要通過(guò)OAuth登錄Jawbone API,用戶可以轉(zhuǎn)到/login/jawbone 。 但是,正如您在上面看到的,他們不需要知道這樣做。 您的助手也可以重定向到它們,如果發(fā)現(xiàn)它們尚未登錄。您還可以在Api.ai代理中添加一個(gè)新意圖,該意圖可以理解“將我登錄到我的Jawbone Up數(shù)據(jù)中”這一短語(yǔ),如果您想真正做到這一點(diǎn)的話無(wú)縫。 您在Node.js中的登錄路線如下所示:
app.get("/login/jawbone",passport.authorize("jawbone", {scope: ["basic_read","sleep_read"],failureRedirect: "/"}) );Once you’ve logged into the Jawbone API via passport.use("jawbone", new JawboneStrategy()), assign this access to your up variable and direct the user to /barry. You could redirect the user to any path of your choice, as long as it’s different from your root directory (that seemed to just cause an endless struggle for my server). I chose /barry, as I named my assistant Barry and thought it self explanatory (the page shows the exact same index view and thus isn’t different in any way). You could also use this as a way of providing a different view for users who have logged into their Jawbone device successfully if you so desire. Once logged in, the user can go back to the root https://localhost:5000 page and use Up functionality as well.
通過(guò)passport.use("jawbone", new JawboneStrategy())登錄到Jawbone API后,將此訪問(wèn)權(quán)限分配給您的up變量,并將用戶定向到/barry 。 您可以將用戶重定向到您選擇的任何路徑,只要它與您的根目錄不同即可(這似乎為我的服務(wù)器帶來(lái)了無(wú)盡的麻煩)。 我選擇了/barry ,因?yàn)槲颐酥諦arry并認(rèn)為它可以自我解釋(該頁(yè)面顯示了完全相同的索引視圖,因此在任何方面都沒(méi)有區(qū)別)。 如果您愿意,也可以使用此方法為成功登錄其Jawbone設(shè)備的用戶提供不同的視圖。 登錄后,用戶可以返回到根https://localhost:5000頁(yè)面并使用Up功能。
發(fā)回您的物聯(lián)網(wǎng)數(shù)據(jù) (Sending Back Your IoT Data)
Your retrieval of Jawbone data is done in a very simple way upon receiving a GET request for /sleep_data. Check if the up variable is defined: if not, your user hasn’t logged in and you tell the web app this so that it can perform the redirection and tell the user they’ll need to log in. Do the same thing if Jawbone returns any errors when you call up.sleeps.get() and if jawboneData.items isn’t defined:
收到對(duì)/sleep_data的GET請(qǐng)求后,可以非常簡(jiǎn)單的方式檢索Jawbone數(shù)據(jù)。 檢查是否定義了up變量:如果未定義,則您的用戶尚未登錄,您將此通知Web應(yīng)用程序,以便它可以執(zhí)行重定向并告訴用戶他們需要登錄。如果Jawbone,請(qǐng)執(zhí)行相同的操作當(dāng)您調(diào)用up.sleeps.get()且未定義jawboneData.items時(shí),將返回任何錯(cuò)誤:
app.get("/sleep_data", function(req, resp) {if (up !== undefined) {up.sleeps.get({}, function(err, body) {if (err) {console.log("Error receiving Jawbone UP data");resp.send({"error": "Your sleep tracker isn't talking to me. Let's try logging in again."});} else {var jawboneData = JSON.parse(body).data;if (jawboneData.items) {resp.send(jawboneData);} else {console.log("Error: " + jawboneData);resp.send({"error": "Your sleep tracker isn't talking to me. Let's try logging in again."});}}});} else {console.log("Up is not ready, lets ask to log in.");resp.send({"error": "Your sleep tracker isn't talking to me. Let's try logging in again."});} });The errors here could be caused by other factors too, but to keep it simple, I’m focusing on getting them to try logging in again. In a production level app, you’d want to look into various causes and adjust your response.
這里的錯(cuò)誤也可能是由其他因素引起的,但是為了簡(jiǎn)單起見(jiàn),我專注于讓他們嘗試再次登錄。 在生產(chǎn)級(jí)應(yīng)用程序中,您需要調(diào)查各種原因并調(diào)整響應(yīng)。
If all is well and you receive a valid response, send it as a JSON response back to the web app to read and parse through nicely:
如果一切正常,并且您收到了有效的響應(yīng),請(qǐng)將其作為JSON響應(yīng)發(fā)送回Web應(yīng)用程序,以很好地閱讀和解析:
if (jawboneData.items) {resp.send(jawboneData); }With the web app and your Node.js server working together, you should be able to retrieve sleep data from your Jawbone Up device now. So let’s give it a go.
在Web應(yīng)用程序和Node.js服務(wù)器協(xié)同工作的情況下,您現(xiàn)在應(yīng)該能夠從Jawbone Up設(shè)備檢索睡眠數(shù)據(jù)。 因此,讓我們開(kāi)始吧。
行動(dòng)中 (In Action)
Run your server with the usual node server.js. Remember that you’ll need to have run npm install for your npm modules and will need to have a certificate on your server to run it via HTTPS.
使用通常的node server.js運(yùn)行服務(wù)器。 請(qǐng)記住,您需要為npm模塊運(yùn)行npm install ,并且需要在服務(wù)器上具有證書才能通過(guò)HTTPS運(yùn)行它。
Visiting https://localhost:5000 in your web browser should bring you to your AI assistant. (If you’re using a service like Glitch, you’ll have a Glitch URL instead.) Ask it how much sleep you’ve had:
在網(wǎng)絡(luò)瀏覽器中訪問(wèn)https://localhost:5000應(yīng)該會(huì)帶您進(jìn)入AI助手。 (如果您使用的是諸如Glitch之類的服務(wù),則將改為使用Glitch URL。)詢問(wèn)您已睡了多少時(shí)間:
Turns out you aren’t logged in yet. It directs you to the Jawbone Up OAuth login screen. Log in and agree to provide access to your data, then click “Agree”:
原來(lái)您尚未登錄。 它會(huì)將您定向到Jawbone Up OAuth登錄屏幕。 登錄并同意提供對(duì)您的數(shù)據(jù)的訪問(wèn),然后單擊“同意”:
If you ask it this time around, you’ll receive the right answer:
如果您這次要求這樣做,您將獲得正確的答案:
You can also ask it something more specific, such as “How much REM did I get?” to test out the parameters:
您還可以詢問(wèn)一些更具體的信息,例如“我獲得了多少REM?” 測(cè)試參數(shù):
結(jié)論 (Conclusion)
That concludes quite a varied exploration of Api.ai’s capabilities for now! You could expand upon this example to allow it to understand date ranges (e.g. “How much sleep did I get on Tuesday?”) or to format the time slightly better (notice a slight bug in one of the responses?). You might have much nicer and shorter ways of phrasing the responses too. Personalize it — make it your own!
到目前為止,對(duì)Api.ai的功能進(jìn)行了各種各樣的探索 ! 您可以擴(kuò)展此示例,以使其理解日期范圍(例如“星期二我睡了多少時(shí)間?”)或略微改善時(shí)間格式(注意其中一個(gè)響應(yīng)中的錯(cuò)誤)。 您也可能有更好和更短的短語(yǔ)表達(dá)方式。 個(gè)性化-自己制作!
As you can see, by using these methods you can connect up any Node.js compatible or web API compatible service to your Node.js server, hook it up to an intent in your Api.ai agent and teach it all sorts of things! You could connect up plenty of IoT devices via IFTTT, connect up your LIFX smart lights via IFTTT or even connect up your very own Nodebot. Possibilities are limited only by the devices you have at your disposal!
如您所見(jiàn),通過(guò)使用這些方法,您可以將任何與Node.js兼容或與Web API兼容的服務(wù)連接到Node.js服務(wù)器,將其與Api.ai代理中的意圖掛鉤并進(jìn)行各種操作! 您可以通過(guò)IFTTT連接大量物聯(lián)網(wǎng)設(shè)備,通過(guò)IFTTT 連接LIFX智能燈,甚至可以連接自己的Nodebot 。 可能性僅受您擁有的設(shè)備限制!
If you’ve been following along and building your own personal assistant using Api.ai, I’d love to hear how you went! What have you connected it to? Let me know in the comments below, or get in touch with me on Twitter at @thatpatrickguy.
如果您一直在使用Api.ai并建立自己的私人助理,我很想聽(tīng)聽(tīng)您的情況! 您連接了什么? 在下面的評(píng)論中讓我知道,或者在Twitter上通過(guò)@thatpatrickguy與我聯(lián)系 。
Give your AI the human touch with a sentiment tool. Check out our screencasts on the Microsoft Cognitive Services and the Text Analytics API.
使用情感工具讓您的AI具有人性化的感覺(jué)。 查看我們有關(guān)Microsoft Cognitive Services和Text Analytics API的截屏視頻。
翻譯自: https://www.sitepoint.com/how-to-connect-your-api-ai-assistant-to-the-iot/
ai物聯(lián)網(wǎng)工程師
總結(jié)
以上是生活随笔為你收集整理的ai物联网工程师_如何将Api.ai助手连接到物联网的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
                            
                        - 上一篇: springboot学习(六十七) sp
 - 下一篇: 解决ubuntu16.04插耳机没有声音