-
Notifications
You must be signed in to change notification settings - Fork 135
External_Services
External services are those services which can be called from the sraix
tag. How to use the tag is described in SRAIX Tag. The sraix tag was originally designed to only called other bots but I felt that this was a short-sighted limitation as the interface is about making a REST API call to an appropriate end point. Therefore with a little refactoring and better documentation you can use the sraix tag to call any external service exposed as a REST GET or POST endpoint.
The list of available endpoints that have been implemented and tested with Program-Y are currently
Each external service is represented by a Python Object which must inherit from
programy.services.service.Service
This is a simple class which requires the implementation of a single method ask_question.
class Service(object):
__metaclass__ = ABCMeta
def __init__(self, config: BrainServiceConfiguration):
self._config = config
@property
def configuration(self):
return self._config
def load_additional_config(self, service_config):
pass
@abstractmethod
def ask_question(self, bot, clientid: str, question: str):
"""
Never knowingly Implemented
"""
Configuration is down by adding an entry to the services section of config.yaml as follows
myservice:
classname: programy.services.myservice.StatusCheck
url: http://myservice.com/api/statuscheck
When a sraix tag is encountered the the class defined in classname is loaded and ask_question() is called with question contained in the node.
<category>
<pattern>CHECK STATUS OF *<pattern>
<template>
Status of <star /> is <sraix service="myservice"><star/></sraix>
</template>
</category>
Email: [email protected] | Twitter: @keiffster | Facebook: keith.sterling | LinkedIn: keithsterling | My Blog
- Home
- Background
- Guiding Principles
- Reporting an Issue
- Installation
- You And Your Bot
- Bots
- Clients
- Configuration
- AIML
- Sentence Splitting
- Natural Langauge Processing
- Normalization
- Spelling
- Sentiment Analysis
- Translation
- Security
- Hot Reload
- Logging
- Out of Band
- Multi Language
- RDF Support
- Rich Media
- Asynchronous Events
- Triggers
- External Services
- Dynamic Sets, Maps & Vars
- Extensions
- Pre & Post Processors
- Custom Nodes
- The Brain Tree
- Utilities
- Building It Yourself
- Creating Your Own Bot
- Contributing
- Performance Testing
- FAQ
- History
- Website