{"id":20398901,"url":"https://github.com/wit-ai/wit-ruby","last_synced_at":"2025-04-06T13:10:33.119Z","repository":{"id":21343185,"uuid":"24660182","full_name":"wit-ai/wit-ruby","owner":"wit-ai","description":"Ruby library for Wit.ai","archived":false,"fork":false,"pushed_at":"2022-05-09T17:49:39.000Z","size":36448,"stargazers_count":283,"open_issues_count":1,"forks_count":66,"subscribers_count":49,"default_branch":"main","last_synced_at":"2025-03-30T11:10:00.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wit-ai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-01T00:05:53.000Z","updated_at":"2025-03-22T00:59:46.000Z","dependencies_parsed_at":"2022-08-21T02:20:40.615Z","dependency_job_id":null,"html_url":"https://github.com/wit-ai/wit-ruby","commit_stats":null,"previous_names":["wit-ai/libwit-ruby"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wit-ai%2Fwit-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wit-ai%2Fwit-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wit-ai%2Fwit-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wit-ai%2Fwit-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wit-ai","download_url":"https://codeload.github.com/wit-ai/wit-ruby/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247485287,"owners_count":20946398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T04:24:56.453Z","updated_at":"2025-04-06T13:10:33.099Z","avatar_url":"https://github.com/wit-ai.png","language":"Ruby","readme":"# wit-ruby\n\n`wit-ruby` is the Ruby SDK for [Wit.ai](http://wit.ai).\n\n## Install\n\nFrom RubyGems:\n```bash\ngem install wit\n```\n\nFrom source:\n```bash\ngit clone https://github.com/wit-ai/wit-ruby\ngem build wit.gemspec\ngem install wit-*.gem\n```\n\n## Quickstart\n\nRun in your terminal:\n\n```bash\nruby examples/basic.rb \u003cyour_token\u003e\n```\n\nSee the `examples` folder for more examples.\n\n## API\n\n### Overview\n\n`wit-ruby` provides a Wit class with the following methods:\n* `message` - the Wit [message API](https://wit.ai/docs/http/20200513#get-intent-via-text-link)\n* `interactive` - starts an interactive conversation with your bot\n\n### Wit class\n\nThe Wit constructor takes a `Hash` with the following symbol keys:\n* `:access_token` - the access token of your Wit instance\n\nA minimal example looks like this:\n```ruby\nrequire 'wit'\n\nclient = Wit.new(access_token: access_token)\nclient.message('set an alarm tomorrow at 7am')\n```\n\n### Create new App Using the Access Token\n\nCreates new app using the server token.\nSee [POST /apps](https://wit.ai/docs/http/20200513#post__apps_link).\n\n```ruby\nnew_app_payload = {name: \"new-app-1\", lang: \"en\", private: true}\n# set_new_app_token will make the client use the new app's token.\n# that flag is set to false by default.\nclient.create_new_app(new_app_payload, set_new_app_token = true)\n```\n\n### Train the app programatically using '/utterances'\n\nTrains and annotates an utterance or more.\nSee [POST /utterances](https://wit.ai/docs/http/20200513#post__utterances_link).\n\n```ruby\n# you have to create the intent and entity before using any of them.\nutterance_payload = {\n  text: \"I want to fly to china\",\n  intent: \"flight_request\",\n  entities: [\n    {\n      \"entity\": \"wit$location:to\",\n      \"start\": 17,\n      \"end\": 22,\n      \"body\": \"china\",\n      \"entities\": []\n    }\n  ],\n  traits: []\n}\n\n# utterance payload can be a list of utterances or a single one\nclient.post_utterances(utterance_payload)\n```\n\n### .message()\n\nThe Wit [message API](https://wit.ai/docs/http/20200513#get-intent-via-text-link).\n\nTakes the following parameters:\n* `msg` - the text you want Wit.ai to extract the information from\n\nExample:\n```ruby\nrsp = client.message('what is the weather in London?')\nputs(\"Yay, got Wit.ai response: #{rsp}\")\n```\n\n### .interactive()\n\nStarts an interactive conversation with your bot.\n\nExample:\n```ruby\nclient.interactive\n```\n\n### CRUD operations for intents\n`payload` in the parameters is a hash containing API arguments.\n\n#### .get_intents()\nReturns a list of available intents for the app.\nSee [GET /intents](https://wit.ai/docs/http/20200513#get__intents_link).\n\n#### .get_intent(intent)\nReturns all available information about an intent.\nSee [GET /intents/:intent](https://wit.ai/docs/http/20200513#get__intents__intent_link).\n\n#### .post_intents(payload)\nCreates a new intent.\nSee [POST /intents](https://wit.ai/docs/http/20200513#post__intents_link).\n\n#### .delete_intents(intent)\nPermanently deletes the intent.\nSee [DELETE /intents/:intent](https://wit.ai/docs/http/20200513#delete__intents__intent_link).\n\n### CRUD operations for entities\n`payload` in the parameters is a hash containing API arguments.\n\n#### .get_entities()\nReturns a list of available entities for the app.  \nSee [GET /entities](https://wit.ai/docs/http/20200513#get--entities-link)\n\n#### .post_entities(payload)\nCreates a new entity with the given attributes.  \nSee [POST /entities](https://wit.ai/docs/http/20200513#post--entities-link)\n\n#### .get_entity(entity)\nReturns all the information available for an entity.  \nSee [GET /entities/:entity](https://wit.ai/docs/http/20200513#get--entities-:entity-link)\n\n#### .put_entities(entity, payload)\nUpdates an entity with the given attributes.  \nSee [PUT /entities/:entity](https://wit.ai/docs/http/20200513#put--entities-:entity-link)\n\n#### .delete_entities(entity)\nPermanently removes the entity.  \nSee [DELETE /entities/:entity](https://wit.ai/docs/http/20200513#delete--entities-:entity-link)\n\n#### .post_entities_keywords(entity, payload)\nAdds a possible value into the list of keywords for the keywords entity.\nSee [POST /entities/:entity/keywords](https://wit.ai/docs/http/20160526#post--entities-:entity-id-values-link)\n\n#### .delete_entities_keywords(entity, keyword)\nDeletes a keyword from the entity.  \nSee [DELETE /entities/:entity/keywords/:keyword](https://wit.ai/docs/http/20200513#delete--entities-:entity-keywords-link)\n\n#### .post_entities_keywords_synonyms(entity, keyword, payload)\nCreates a new synonym for the keyword of the entity.  \nSee [POST /entities/:entity/keywords/:keyword/synonyms](https://wit.ai/docs/http/20200513#post--entities-:entity-keywords-:keyword-synonyms-link)\n\n#### delete_entities_keywords_synonyms(entity, keyword, synonym)\nDeletes a synonym of the keyword of the entity.  \nSee [DELETE /entities/:entity/keywords/:keyword/synonyms/:synonym](https://wit.ai/docs/http/20200513#delete--entities-:entity-keywords-:keyword-synonyms-link)\n\n### CRUD operations for traits\n`payload` in the parameters is a hash containing API arguments.\n\n#### .get_traits()\nReturns a list of available traits for the app.\nSee [GET /traits](https://wit.ai/docs/http/20200513#get__traits_link).\n\n#### .get_trait(trait)\nReturns all available information about a trait.\nSee [GET /traits/:trait](https://wit.ai/docs/http/20200513#get__traits__trait_link).\n\n#### .post_traits(payload)\nCreates a new trait.\nSee [POST /traits](https://wit.ai/docs/http/20200513#post__traits_link).\n\n#### .post_traits_values(trait, payload)\nAdds a new value to an existing trait.\nSee [POST /traits/:trait/values](https://wit.ai/docs/http/20200513#post__traits__trait_values_link).\n\n#### .delete_traits_values(trait, value)\nPermanently deletes a value of an existing trait.\nSee [POST /traits/:trait/values](https://wit.ai/docs/http/20200513#delete__traits__trait_values_link).\n\n#### .delete_traits(trait)\nPermanently deletes the trait.\nSee [DELETE /traits/:trait](https://wit.ai/docs/http/20200513#delete__traits__trait_link).\n\n\nSee the [docs](https://wit.ai/docs) for more information.\n\n### Logging\n\nDefault logging is to `STDOUT` with `INFO` level.\n\nYou can setup your logging level as follows:\n```ruby\nWit.logger.level = Logger::WARN\n```\nSee the [Logger class](http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html) docs for more information.\n\n## Thanks\n\nThanks to [Justin Workman](http://github.com/xtagon) for releasing a first version in October 2013. We really appreciate!\n\n\n## License\n\nThe license for wit-ruby can be found in LICENSE file in the root directory of this source tree.\n\n\n## Terms of Use\n\nOur terms of use can be found at https://opensource.facebook.com/legal/terms.\n\n\n## Privacy Policy\n\nOur privacy policy can be found at https://opensource.facebook.com/legal/privacy.\n","funding_links":[],"categories":["NLP Pipeline Subtasks"],"sub_categories":["Multipurpose Engines"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwit-ai%2Fwit-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwit-ai%2Fwit-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwit-ai%2Fwit-ruby/lists"}