-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service vs extension #50
Comments
Hey Sean, As you say extensions are late binding, only called when the grammar resolves to an tag, but they also provide the greatest amount of flexibility, in that you can pretty much get them to do anything you want. They are not exclusive to calling external services, in fact they were originally designed to provide a way to create new tags. This may have been superseded by some of the work I did in the past couple of releases which allow you to built your own tags and dynamically add them, but I still see the extension as an easy interface driven way of calling out to Python and them allowing that Python class to do what you want. Services are my implementation of the AIML 2.0 sraix tag, which personally I think is broken. It was added by Dr Wallace to support Pandora bots and their very specific implementation of sraix and their API service. I don't even implement it 100% preferring to push config into the config file rather than the sraix definition. Having said that, Services are indeed early binding and therefore provide a way to do early init and configuration that might not be possible with an extension For the work that I think you are doing, I think services are probably the best way, as you can push all config into config.yaml and license.keys, do early initiation and even caching/connection pooling if needed |
Agreed. I have started moving the other interfaces to services, and using extensions to do things that seem easier to achieve in Python. |
Hi Keith,
Would be good to get your views on whether to use a service or extension for integrating with back-end systems. I started writing as extensions (eg to query a ticket system), but now realise that extensions are kind of "late binding" - only instantiated at runtime.
I wrote another backend interface as a service (querying a CDMB), as it is "early binding" and the object is always "in memory". It allows using init to do some initial configuration. Potentially this could then be used for caching some content or doing connection pooling, as some of my backend servers are slow or have high connection time costs.
Would be good to get your thoughts on extensions vs services, when to use either, and if there is a best "example" of your model for integrating services (I used wikipedia as the template)
Another potential benefit of the service is perhaps it could also contribute more patterns or sets to the brain by calling the internal functions at init time, or would it be too late at this stage?
Cheers
Sean
The text was updated successfully, but these errors were encountered: