Skip to content

grammatek/rasa-http-api

Repository files navigation

rasa-http-api

Rasa::HTTP - Ruby gem for Rasa - RESTful server endpoints

The Rasa server provides endpoints to retrieve trackers of conversations as well as endpoints to modify them. Additionally, endpoints for training and testing models are provided.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 0.1
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build rasa-http-api.gemspec

Then either install the gem locally:

gem install ./rasa-http-api-0.1.gem

(for development, run gem install --dev ./rasa-http-api-0.1.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'rasa-http-api', '~> 0.1'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'rasa-http-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'rasa-http-api'

# Setup authorization
Rasa::HTTP.configure do |config|
  # Configure Bearer authorization (JWT): JWT
  config.access_token = 'YOUR_BEARER_TOKEN'

  # Configure API key authorization: TokenAuth
  config.api_key['TokenAuth'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['TokenAuth'] = 'Bearer'

  # Configure host name, base path and scheme
  config.host = 'localhost:5005'
  config.base_path = '/'
  config.scheme = 'http'
end

api_instance = Rasa::HTTP::DomainApi.new

begin
  #Retrieve the loaded domain
  result = api_instance.get_domain
  p result
rescue Rasa::HTTP::ApiError => e
  puts "Exception when calling DomainApi->get_domain: #{e}"
end

Documentation for API Endpoints

All URIs are relative to http://localhost:5005

Class Method HTTP request Description
Rasa::HTTP::DomainApi get_domain GET /domain Retrieve the loaded domain
Rasa::HTTP::ModelApi parse_model_message POST /model/parse Parse a message using the Rasa model
Rasa::HTTP::ModelApi predict_model_action POST /model/predict Predict an action on a temporary state
Rasa::HTTP::ModelApi replace_model PUT /model Replace the currently loaded model
Rasa::HTTP::ModelApi test_model_intent POST /model/test/intents Perform an intent evaluation
Rasa::HTTP::ModelApi test_model_stories POST /model/test/stories Evaluate stories
Rasa::HTTP::ModelApi train_model POST /model/train Train a Rasa model
Rasa::HTTP::ModelApi unload_model DELETE /model Unload the trained model
Rasa::HTTP::ServerInformationApi get_health GET / Health endpoint of Rasa Server
Rasa::HTTP::ServerInformationApi get_status GET /status Status of the Rasa server
Rasa::HTTP::ServerInformationApi get_version GET /version Version of Rasa
Rasa::HTTP::TrackerApi add_conversation_message POST /conversations/{conversation_id}/messages Add a message to a tracker
Rasa::HTTP::TrackerApi add_conversation_tracker_events POST /conversations/{conversation_id}/tracker/events Append events to a tracker
Rasa::HTTP::TrackerApi execute_conversation_action POST /conversations/{conversation_id}/execute Run an action in a conversation
Rasa::HTTP::TrackerApi get_conversation_story GET /conversations/{conversation_id}/story Retrieve an end-to-end story corresponding to a conversation
Rasa::HTTP::TrackerApi get_conversation_tracker GET /conversations/{conversation_id}/tracker Retrieve a conversations tracker
Rasa::HTTP::TrackerApi predict_conversation_action POST /conversations/{conversation_id}/predict Predict the next action
Rasa::HTTP::TrackerApi replace_conversation_tracker_events PUT /conversations/{conversation_id}/tracker/events Replace a trackers events
Rasa::HTTP::TrackerApi trigger_conversation_intent POST /conversations/{conversation_id}/trigger_intent Inject an intent into a conversation

Documentation for Models

Documentation for Authorization

JWT

  • Type: Bearer authentication (JWT)

TokenAuth

  • Type: API key
  • API key parameter name: token
  • Location: URL query string

About

Ruby Gem for the RESTful Rasa HTTP api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published