I'm trying to create a custom slot for a UK postcode (e.g. CB1 1PT). I managed to get this working around October time, however, I've come back to the project and it looks like Amazon have updated a number of things.
Here is my Intent Schema:
{
"intents": [
{
"intent": "GetOutages",
"slots": [
{
"name": "postcode",
"type": "LIST_OF_POSTCODES"
}
]
},
{
"intent": "GetCoverage",
"slots": [
{
"name": "postcode",
"type": "LIST_OF_POSTCODES"
}
]
},
{
"intent": "AMAZON.StopIntent",
"slots": []
},
{
"intent": "AMAZON.CancelIntent",
"slots": []
}
]
}
The Custom Slot type:
LIST_OF_POSTCODES S L six six D Y | C B one one P T | R G five four W L | G U one five one P B
A few sample utterances:
GetOutages outage info for {postcode}
GetOutages fault info for {postcode}
GetOutages information for {postcode}
GetOutages outage information for {postcode}
GetOutages fault information for {postcode}
The problem is, when I try to retrieve the value from the slot, it appears to be picking up the full sentence:
{
name:'GetOutages',
slots:{
postcode:{
name:'postcode',
value:'information for r g 54 w l'
}
}
}
Does anyone have any advice?
Not really a proper answer, but some thoughts...
You provide sample utterences, but in the rest of your utterances are there any that are so short/generic that they could get inadvertently matched, and then most of the user's actual utterance getting put in postcode?
Also, I gotta wonder what your list of words is for that slot? Since it is limited to 65K items you can't supply all the postcodes, so what shortcut are you taking?
Finally, what you really need, of course, is a built-in slot type for UK postcode like they have for US zipcode. Here is the ASK feature request for it, and note the link to the suggested stop gap:
https://forums.developer.amazon.com/content/idea/41072/built-in-slot-type-for-uk-postcodes.html
correction: there are various address and city built-ins, but they don't support US zipcode either, so I guess people must be using AMAZON.NUMBER.
Related
Has anyone here used the PUT /MoveEntry call successfully before? I can make the call to create the record, but I was expecting the API to populate the lot number and it is not. It does by UI, but not by API. Is there a trick that I'm missing?
Update 1:
PUT /MoveEntry
{
"Hold": {
"value": true
},
"Details": [
{
"OrderType": {
"value": "RO"
},
"ProductionNbr": {
"value": "RO0000001"
},
"Quantity": {
"value": 1
},
"Location": {
"value": "PRODRECPT"
},
"Warehouse": {
"value": "ABBOTSFORD"
}
}
]
}
It always records the document successfully, but never has the lot number.
Could it be a lot class configuration issue?
Update 2:
Acu support agrees this looks like a defect and has passed the case on to Acu development.
I would take a look at the Numbering Sequence called AMBatch as that is the one that seems to be used by default for me on the Move Entry screen.
After working with Acu Support, it came back the API requires the "OperationNbr" field to be populated with the Bill of Materials operation number. Then the lot number is generated as expected.
Below is some of the data I'm putting into an Azure search index:
I could go with this rigid structure but it needs to support different data types. I could keep adding fields - i.e. Field4, Field5, ... but I wondered if I could have something like a JSON field? So the index could be modelled like below:
[
{
"entityId":"dba656d3-f044-4cc0-9930-b5e77e664a8f",
"entityName":"character",
"data":{
"name":"Luke Skywalker",
"role":"Jedi"
}
},
{
"entityId":"b37bf987-0978-4fc4-9a51-b02b4a5eed53",
"entityName":"character",
"data":{
"name":"C-3PO",
"role":"Droid"
}
},
{
"entityId":"b161b9dc-552b-4744-b2d7-4584a9673669",
"entityName":"film",
"data":{
"name":"A new hope"
}
},
{
"entityId":"e59acdaf-5bcd-4536-a8e9-4f3502cc7d85",
"entityName":"film",
"data":{
"name":"The Empire Strikes Back"
}
},
{
"entityId":"00501b4a-5279-41e9-899d-a914ddcc562e",
"entityName":"vehicle",
"data":{
"name":"Sand Crawler",
"model":"Digger Crawler",
"manufacturer":"Corellia Mining Corporation"
}
},
{
"entityId":"fe815cb6-b03c-401e-a871-396f2cd3eaba",
"entityName":"vehicle",
"data":{
"name":"TIE/LN starfighter",
"model":"win Ion Engine/Ln Starfighter",
"manufacturer":"Sienar Fleet Systems"
}
}
]
I know that I can put JSON in a string field, but that would negatively impact the search matching and also filtering.
Is this possible in Azure search or is there a different way to achieve this kind of requirement?
See the article How to model complex data types. The hotel example data translates nicely to your use-case I believe. If your different entities have different sets of properties you can create a "complex type" similar to the Address or Amenities example below.
Structural updates
You can add new sub-fields to a complex field at any time without the
need for an index rebuild. For example, adding "ZipCode" to Address or
"Amenities" to Rooms is allowed, just like adding a top-level field to
an index.
{
"HotelId": "1",
"HotelName": "Secret Point Motel",
"Description": "Ideally located on the main commercial artery of the city in the heart of New York.",
"Tags": ["Free wifi", "on-site parking", "indoor pool", "continental breakfast"]
"Address": {
"StreetAddress": "677 5th Ave",
"City": "New York",
"StateProvince": "NY"
},
"Rooms": [
{
"Description": "Budget Room, 1 Queen Bed (Cityside)",
"RoomNumber": 1105,
"BaseRate": 96.99,
},
{
"Description": "Deluxe Room, 2 Double Beds (City View)",
"Type": "Deluxe Room",
"BaseRate": 150.99,
}
. . .
]
}
I'm testing out the Azure Boards rest API. I can currently create, delete and get items successfully, however I can't seem to move them between columns.
This is my request
https://{{AzureBoardsToken}}#{{AzureBoardsPath}}/_apis/wit/workitems/8907?api-version=6.0-preview.3
with a payload of
[
{
"op": "move",
"path": "{no idea what to put here}",
"from": "{no idea what to put here}",
"value": "{not sure if this is relevant for this operation}"
}
]
I don't find the documentation particularly useful as it assumes you know what those properties mean and where to get them.
Any help would be highly appreciated! The idea is to then integrate it in nodejs
Solution 1
To move workitem to another column you have to change "WEF_{id}_Kanban.Column" field.
Use PATCH to update your workitem with body:
[
{
"op": "replace",
"path": "/fields/WEF_F9DCD9224F6E466499435017DB7D2D07_Kanban.Column",
"value": "<column name>"
}
]
Solution 2
To move workitem to another column you have to change it "state". This only works if you assigned that state to the column.
Use PATCH to update your workitem with body:
[
{
"op": "replace",
"path": "/fields/System.State",
"value": "<column name>"
}
]
doc: https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/update?view=azure-devops-rest-6.0
EDIT (Adding new state):
Go to organization settings -> Process -> choose your workflow -> choose item type -> states -> new state (Add "In progress" here)
Tutorial: https://learn.microsoft.com/en-us/azure/devops/organizations/settings/work/customize-process-workflow?view=azure-devops#add-a-workflow-state
Then go to column setting on Kanban Board and associate new state with column
Tutorial: https://learn.microsoft.com/en-us/azure/devops/boards/boards/add-columns?view=azure-devops#update-kanban-column-to-state-mappings
After that try using API REST to change state, it should work
To alter the System.State of a task I had to alter the System.Reason as well. For some reason the two fields are connected and both changes are necessary to trigger a transition from one column to the other.
For example to change a task from the state To Do to In Progress use the Work Items - Update REST API with the following request body:
[
{
"op": "replace",
"path": "/fields/System.State",
"value": "In Progress"
},
{
"op": "replace",
"path": "/fields/System.Reason",
"value": "Work started"
}
]
I am working on a skill, which asks the user for selection of an item from a particular list. Now user's most intuitive response will be to say something like first or second. But built in slots AMAZON.Number only does not capture input like first or second. Am I doing something wrong? Is it possible with some other hack?
Akshay,
AMAZON.Number is really only for numbers, where first, second and such are strings.
To do this, in the Developer console you would need to create a custom slot type called something like "positionChioces". Then enter in first, second, third, fourth, etc. Then add that slot type to your intent naming it choices, then picking "positionChioces".
This is from the JSON editor:
"types": [
{
"name": "positionChioces",
"values": [
{
"name": {
"value": "fourth"
}
},
{
"name": {
"value": "third"
}
},
{
"name": {
"value": "second"
}
},
{
"name": {
"value": "first"
}
}
]
From that point it would all depend on your code. You can pull that slot from your user then use some logic saying if response was first, it will be the fist item in your array and so on. Hope this helps.
D
I have an intent where I might say 'Transfer 4 to Bob' and it identifies this as 'Transfer for to Bob'
Also I might say 'Transfer 10 to Bob and it identifies this as 'Transfer 102 Bob' treating to word to as 2 on the end of the previous number.
What is the best way to get API.AI to recognise these parts correctly so 4 is not for and to is not 2?
You mentioned that you're using the Actions on Google platform. This means that speech recognition - the process of translating what the user says into text - is happening before the data gets to API.AI.
The problem you're experiencing is that Actions on Google is misrecognizing some numbers as words, e.g. four becomes for.
Because this happens before - and separately from - API.AI, you won't be able to fix the misrecognition.
Below, I'll explain how you can work around this issue in API.AI. However, it's also worth thinking about how you could make your conversation design as robust as possible so that issues like this are less likely to cause problems.
One way you could increase robustness would be to mark the number as a required parameter in API.AI so the user is prompted if it isn't detected due to a recognition error. In that case, the dialog would go like this:
User: Give me four lattes.
App: Sure, four lattes coming up.
User: Give me for lattes.
App: How many do you want?
User: Four.
App: Sure, four lattes coming up.
Regardless, here's a workaround you can use to help recover from misrecognition:
In your intent, provide examples of these commonly misrecognized values. Highlight and mark them as numbers.
Test out your intent out in the console and you'll see that "for" is now matched as a "number" entity with value "for".
In your fulfillment webhook, check the parameter for this value and convert it to the appropriate number using a dictionary. Here's the JSON for the above query:
{
"id": "994c4e39-be49-4eae-94b0-077700ef87a3",
"timestamp": "2017-08-03T19:50:26.314Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "Get me for lattes",
"action": "",
"actionIncomplete": false,
"parameters": {
"drink": "lattes",
"number": "for" // NOTE: Convert this to "4" in your webhook
},
"contexts": [],
"metadata": {
"intentId": "0e1b0e72-78ba-4c61-a4fd-a73788034de1",
"webhookUsed": "false",
"webhookForSlotFillingUsed": "false",
"intentName": "get drink"
},
"fulfillment": {
"speech": "",
"messages": [
{
"type": 0,
"speech": ""
}
]
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": "8b0891c1-50c8-43c6-99c4-8f77261acf86"
}