
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
wit-ruby
is the Ruby SDK for Wit.ai.
From RubyGems:
gem install wit
From source:
git clone https://github.com/wit-ai/wit-ruby
gem build wit.gemspec
gem install wit-*.gem
Run in your terminal:
ruby examples/basic.rb <your_token>
See the examples
folder for more examples.
wit-ruby
provides a Wit class with the following methods:
message
- the Wit message APIinteractive
- starts an interactive conversation with your botThe Wit constructor takes a Hash
with the following symbol keys:
:access_token
- the access token of your Wit instanceA minimal example looks like this:
require 'wit'
client = Wit.new(access_token: access_token)
client.message('set an alarm tomorrow at 7am')
Creates new app using the server token. See POST /apps.
new_app_payload = {name: "new-app-1", lang: "en", private: true}
# set_new_app_token will make the client use the new app's token.
# that flag is set to false by default.
client.create_new_app(new_app_payload, set_new_app_token = true)
Trains and annotates an utterance or more. See POST /utterances.
# you have to create the intent and entity before using any of them.
utterance_payload = {
text: "I want to fly to china",
intent: "flight_request",
entities: [
{
"entity": "wit$location:to",
"start": 17,
"end": 22,
"body": "china",
"entities": []
}
],
traits: []
}
# utterance payload can be a list of utterances or a single one
client.post_utterances(utterance_payload)
The Wit message API.
Takes the following parameters:
msg
- the text you want Wit.ai to extract the information fromExample:
rsp = client.message('what is the weather in London?')
puts("Yay, got Wit.ai response: #{rsp}")
Starts an interactive conversation with your bot.
Example:
client.interactive
payload
in the parameters is a hash containing API arguments.
Returns a list of available intents for the app. See GET /intents.
Returns all available information about an intent. See GET /intents/:intent.
Creates a new intent. See POST /intents.
Permanently deletes the intent. See DELETE /intents/:intent.
payload
in the parameters is a hash containing API arguments.
Returns a list of available entities for the app.
See GET /entities
Creates a new entity with the given attributes.
See POST /entities
Returns all the information available for an entity.
See GET /entities/:entity
Updates an entity with the given attributes.
See PUT /entities/:entity
Permanently removes the entity.
See DELETE /entities/:entity
Adds a possible value into the list of keywords for the keywords entity. See POST /entities/:entity/keywords
Deletes a keyword from the entity.
See DELETE /entities/:entity/keywords/:keyword
Creates a new synonym for the keyword of the entity.
See POST /entities/:entity/keywords/:keyword/synonyms
Deletes a synonym of the keyword of the entity.
See DELETE /entities/:entity/keywords/:keyword/synonyms/:synonym
payload
in the parameters is a hash containing API arguments.
Returns a list of available traits for the app. See GET /traits.
Returns all available information about a trait. See GET /traits/:trait.
Creates a new trait. See POST /traits.
Adds a new value to an existing trait. See POST /traits/:trait/values.
Permanently deletes a value of an existing trait. See POST /traits/:trait/values.
Permanently deletes the trait. See DELETE /traits/:trait.
See the docs for more information.
Default logging is to STDOUT
with INFO
level.
You can setup your logging level as follows:
Wit.logger.level = Logger::WARN
See the Logger class docs for more information.
Thanks to Justin Workman for releasing a first version in October 2013. We really appreciate!
The license for wit-ruby can be found in LICENSE file in the root directory of this source tree.
Our terms of use can be found at https://opensource.facebook.com/legal/terms.
Our privacy policy can be found at https://opensource.facebook.com/legal/privacy.
FAQs
Unknown package
We found that wit_ai demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.