You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nlpcraft.apache.org by Ifropc <if...@protonmail.com.INVALID> on 2021/02/05 06:00:19 UTC

NCValue and ask endpoint

Hi all,

I have some points to discuss, after implementing intent for my Kotlin example.

1. Is it possible/feasible to add parameter for /ask endpoint? For example, if developers want to use some request metadata in their probe, it would be useful for them to receive it from client. It could be some dynamic characteristic of the user, which is used differently, depending on the intent.
2. There is an interface NCValue, which could be implemented and objects of the impl class are returned from NCValueLoader. But there is no point in it being an interface, because developer can't use any fields in child class. I think it'd be good, if original NCValue was returned in NCTokenImpl, so developer can store some additional loaded data there.

Any thoughts would be appreciated!

Thanks,
Gleb.

Re: NCValue and ask endpoint

Posted by Ifropc <if...@protonmail.com.INVALID>.
Hi Sergey,

1. Great!
2. I can give you an example from my code, in the loader I get dump from file, which is just a map (English word -> object entity).
(https://github.com/apache/incubator-nlpcraft/blob/91fb3578bf7d5161f4e827b7961ea0bb742ec80f/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/ValueLoaders.kt#L15)
Naturally, I want to use this object entity in my code. Right now, to do that, I need to create a singleton for that and access it from static context in model itself. (https://github.com/apache/incubator-nlpcraft/blob/91fb3578bf7d5161f4e827b7961ea0bb742ec80f/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt#L69)
However, in example above, if my custom value would've been included in NCToken, I could use it directly, without relying on my singleton.

I believe it's just a matter of clean access to some additional properties of NCValue. (Current implementation allows me to do what I want, in a roundabout way)

Thanks,
Gleb.


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, February 5, 2021 11:40 AM, Kamov Sergey <sk...@gmail.com> wrote:

> Hi Gleb
>
> 1.  https://issues.apache.org/jira/browse/NLPCRAFT-232 - ticket created
> 2.  Do we need metadata for NCValue?  We can add it, but could you
>     provide some example for such usecases (when element's metadata is not
>     enough)?
>
>     Regards,
>
>     Sergey
>
>     On 05.02.2021 19:12, Kamov Sergey wrote:
>
>
> > Hi, Gleb!
> >
> > > 1.  Is it possible/feasible to add parameter for /ask endpoint? For
> > >     example, if developers want to use some request metadata in their
> > >     probe, it would be useful for them to receive it from client. It
> > >     could be some dynamic characteristic of the user, which is used
> > >     differently, depending on the intent.
> > >
> >
> > Look please at `ask` request `data` parameter.
> > rest  -
> > https://app.swaggerhub.com/apis-docs/Apache-NLPCraft/apache-nlpcraft/0.7.4#/Asking/askSync
> > or
> > client  -
> > https://nlpcraft.apache.org/apis/java-client/latest/org/apache/nlpcraft/client/NCClient.html#ask-java.lang.String-java.lang.String-java.lang.String-boolean-java.lang.Long-java.lang.String-)
> > data  - optional JSON request parameter, is it enough for your case?
> >
> > > 2.  There is an interface NCValue, which could be implemented and
> > >     objects of the impl class are returned from NCValueLoader. But there
> > >     is no point in it being an interface, because developer can't use any
> > >     fields in child class. I think it'd be good, if original NCValue was
> > >     returned in NCTokenImpl, so developer can store some additional
> > >     loaded data there.
> > >
> >
> > We already have metadata for
> > - model
> > (https://javadoc.io/static/org.apache.nlpcraft/nlpcraft/0.7.3/org/apache/nlpcraft/model/NCModelView.html#getMetadata())
> > and
> > - it's elements
> > (https://javadoc.io/static/org.apache.nlpcraft/nlpcraft/0.7.3/org/apache/nlpcraft/model/NCElement.html#getMetadata()).
> > You suggested to add metadata also to NCValue
> > (https://javadoc.io/doc/org.apache.nlpcraft/nlpcraft/latest/org/apache/nlpcraft/model/NCValue.html),
> > right?
> > For first look it seems reasonable, we have to discuss how it can be
> > used in intent DSL.
> > Regards,
> > Sergey
> >
> > > Any thoughts would be appreciated!
> > > Thanks,
> > > Gleb.



Re: NCValue and ask endpoint

Posted by Kamov Sergey <sk...@gmail.com>.
Hi Gleb

1. https://issues.apache.org/jira/browse/NLPCRAFT-232 - ticket created

2. Do we need metadata for NCValue?  We can add it, but could you 
provide some example for such usecases (when element's metadata is not 
enough)?


Regards,

Sergey

On 05.02.2021 19:12, Kamov Sergey wrote:
> Hi, Gleb!
>
>
>> 1. Is it possible/feasible to add parameter for /ask endpoint? For 
>> example, if developers want to use some request metadata in their 
>> probe, it would be useful for them to receive it from client. It 
>> could be some dynamic characteristic of the user, which is used 
>> differently, depending on the intent.
>
> Look please at `ask` request `data` parameter.
>
> rest  - 
> https://app.swaggerhub.com/apis-docs/Apache-NLPCraft/apache-nlpcraft/0.7.4#/Asking/askSync 
> or
>
> client  - 
> https://nlpcraft.apache.org/apis/java-client/latest/org/apache/nlpcraft/client/NCClient.html#ask-java.lang.String-java.lang.String-java.lang.String-boolean-java.lang.Long-java.lang.String-)
>
> data  - optional JSON request parameter, is it enough for your case?
>
>> 2. There is an interface NCValue, which could be implemented and 
>> objects of the impl class are returned from NCValueLoader. But there 
>> is no point in it being an interface, because developer can't use any 
>> fields in child class. I think it'd be good, if original NCValue was 
>> returned in NCTokenImpl, so developer can store some additional 
>> loaded data there.
>
> We already have metadata for
>
>  - model 
> (https://javadoc.io/static/org.apache.nlpcraft/nlpcraft/0.7.3/org/apache/nlpcraft/model/NCModelView.html#getMetadata()) 
> and
>
>  - it's elements 
> (https://javadoc.io/static/org.apache.nlpcraft/nlpcraft/0.7.3/org/apache/nlpcraft/model/NCElement.html#getMetadata()). 
>
>
> You suggested to add metadata also to NCValue 
> (https://javadoc.io/doc/org.apache.nlpcraft/nlpcraft/latest/org/apache/nlpcraft/model/NCValue.html), 
> right?
>
> For first look it seems reasonable, we have to discuss how it can be 
> used in intent DSL.
>
>
> Regards,
>
> Sergey
>
>>
>> Any thoughts would be appreciated!
>>
>> Thanks,
>> Gleb.

Re: NCValue and ask endpoint

Posted by Kamov Sergey <sk...@gmail.com>.
Hi, Gleb!


> 1. Is it possible/feasible to add parameter for /ask endpoint? For example, if developers want to use some request metadata in their probe, it would be useful for them to receive it from client. It could be some dynamic characteristic of the user, which is used differently, depending on the intent.

Look please at `ask` request `data` parameter.

rest  - 
https://app.swaggerhub.com/apis-docs/Apache-NLPCraft/apache-nlpcraft/0.7.4#/Asking/askSync 
or

client  - 
https://nlpcraft.apache.org/apis/java-client/latest/org/apache/nlpcraft/client/NCClient.html#ask-java.lang.String-java.lang.String-java.lang.String-boolean-java.lang.Long-java.lang.String-)

data  - optional JSON request parameter, is it enough for your case?

> 2. There is an interface NCValue, which could be implemented and objects of the impl class are returned from NCValueLoader. But there is no point in it being an interface, because developer can't use any fields in child class. I think it'd be good, if original NCValue was returned in NCTokenImpl, so developer can store some additional loaded data there.

We already have metadata for

  - model 
(https://javadoc.io/static/org.apache.nlpcraft/nlpcraft/0.7.3/org/apache/nlpcraft/model/NCModelView.html#getMetadata()) 
and

  - it's elements 
(https://javadoc.io/static/org.apache.nlpcraft/nlpcraft/0.7.3/org/apache/nlpcraft/model/NCElement.html#getMetadata()). 


You suggested to add metadata also to NCValue 
(https://javadoc.io/doc/org.apache.nlpcraft/nlpcraft/latest/org/apache/nlpcraft/model/NCValue.html), 
right?

For first look it seems reasonable, we have to discuss how it can be 
used in intent DSL.


Regards,

Sergey

>
> Any thoughts would be appreciated!
>
> Thanks,
> Gleb.