Yeah, developer access is currently restricted on the dev website. I gave you permission now.
I tried using the syntax you used to name the entity, however, it seems that it causes an error as follows in the manifest.tt:
When I tried to shortened it to only article
, the parameters for the functions raise a different error message:
When I tried to change the parameters as well, a different error is raised:
How should I fix this issue?
in the type declaration, that is, in the entity
statetement, you should use only the local part of the name, and you should include a description:
entity article #_[description="News Article"];
in uses of the type, that is, in Entity()
type references, you should use the fully-qualified name:
query article(out id : Entity(org.itspersonal.newsfilter:article))
Also, the name of the query must be the same as the name of the entity. Thatâs how the system recognize that the query is the âmainâ query for a given entity.
It seems that I have successfully created the device called Simple News Filter as shown here:
But when I try to add it in the enable skills part of my Almond it redirects to an error page:
And trying the input in My Almond doesnât work as well:
Is there something wrong with my code? This part works fine in the old Almond website (it should just show a random article at the moment, it doesnât use the entity part yet).
Update:
It seems that it automatically added the smartnews device for some reason, which was the source of the replies. So the problem is that my new device cannot be added to the skills for some reason.
Yeah sorry it seems there are some problems with the automatic training of basic natural language at the moment. I will need to deploy a new fixed version on the website. Meanwhile you might be able to use ThingTalk commands (prefixed with \t
) instead.
Ok, how can we use the ThingTalk commands, just input them straight to my Almond? and where can we find the commands for the device?
You input in the normal command prefixed them with \t
. For example:
\t @org.itspersonal.newsfilter.article();
The commands are those you defined in your manifest. If you havenât already, I recommend reading through the ThingTalk guide
You need to specify the right type:
\t @org.itspersonal.newsfilter.article(topic = enum test);
See the ThingTalk Reference to see how each type is specified in ThingTalk.
You might also need to refresh the page if you get no response to a command.
That means there is some other error in the system at the moment. Iâll check and let you knowâŚ
I just updated dev.almond, and tested your skill, it seems to work now with ThingTalk code.
I managed to get the query part working properly but now Iâm stuck with linking it to the action. Iâm not sure how to get the id from the query to the action and how to ask the user for their input. I checked that the id is indeed returned from the function from the console.
How should it work with the ThingTalk code? I was under the impression that it would then automatically call the marking function and ask the user for true/false or yes/no.
Here is the action function for reference:
I see you created two queries, one list query and one that is not a list. At the moment, the Genie dialogue model does not add a action to the result of a non-list query.
You can find all the templates that Genie uses to generate the agent replies here genie-toolkit/languages/thingtalk at master ¡ stanford-oval/genie-toolkit ¡ GitHub in the .genie files.
In particular, the templates used for talking about the top result of a query are here: genie-toolkit/recommendation.genie at master ¡ stanford-oval/genie-toolkit ¡ GitHub
You can see that there is a template of the form ["${proposal}. ${action}"]
in system_recommendation
(which is used for list results), but one in system_nonlist_result
.
You essentially now have two options.
- You can modify the Genie dialogue model to have it do what you want precisely. You can point your almond-cloud installation to your modified Genie using
npm link
. This is not easy to do, but it gives you the most freedom to implement whatever you want in terms of dialogue. - You can tweak your manifest until Genie will give you the behavior you want. In this case, I think marking the
training_news_article
query aslist
and then only returning one result should get the user to ask the user something along the lines of âWould you like to mark this article as relevant?â. Then the user says âyesâ, and the agent asks, âIs this article relevant?â and the user answers yes/no.
By the way, you will need to add primitive templates in dataset.tt for the action. You almost always need primitive templates for actions so you can express the grammatical relationship between the action verb and the parameters correctly. You definitely need primitive templates to generate a phrase like âmark this as relevantâ, which you need. (That would be "mark $p_article as relevant"
in dataset.tt)
I think we will be better off with option 2 then, I want to get it working as fast as possible and this seems to be the less complicated of the two.
I tried changing the query to also return list as follows:
But now the output also prints the title and description for some reason:
I also still donât understand what we have to add to the manifest/dataset to get the Almond to ask whether we want to mark or not, as in where should we put the âWould you like to mark?â and âIs this article relevant?â statements. So far I have added a template in the dataset for the action as follows:
Yeah Genie is trying to be âhelpfulâ add as much information as possible about the articles, given what the query returns.
I think you can suppress that with a result phrase like:
#_[result=["Here is a random article { |. ${title} ${description}}"]]
(The result phrase has two variants inside the {}
, separated by |. The first is clean, the second includes the title and description. Because some variant includes title and description, Genie will not add them separately after the phrase. But then agent always speaks the first variant so they never show up.)
As for the action, what you want is exactly:
action (p_id : Entity(org.itspersonal.newsfilter:training_news_article)) = @org.itspersonal.newsfilter.mark_training_news_article(id=p_id)
#_[utterances=["mark $p_id article"]]
#[name="MarkTrainingNewsArticleWithId"];
Do not include the relevant
argument. Genie will ask the user for it.
(Also, why are you posting code as pictures? This forum supports markdownâŚ)
Sorry, I keep forgetting about the codeblock function in the post editor, Iâm not used to posting on forums with markdown.
Well, the results are now showing in the format I want, but it still doesnât call the action function:
Iâm not sure exactly why it doesnât show the action then. I think everything in your manifest and dataset looks correct. Iâll have to debug it a bit, and get back to you.
Could it be because the NLP as you said isnât working? So maybe it bugs the dataset understanding by Almond?
No this is about the agent side of things, not the interpretation. Anyway Iâll take a closer look locally and see what I dig upâŚ