Skip to content

WebgateSystems/EasyAccessGPT

EasyAccessGpt

Welcome, the 'Easy access gpt' gem is designed to easily enable gpt chat, translate text using gpt chat, check content for obscene language and other purpose.

Installation

Install the gem and add to the application's Gemfile by executing:

gem 'easy_access_gpt', git: 'https://github.com/WebgateSystems/EasyAccessGPT.git'

Run the bundle command to install it.

Initial setup with Rails:

To set the default Api key, create a initializer in config/initializers/easy_access_gpt.rb:

EasyAccessGpt::Configure.api_key = 'your api key'

There is also a chat search model setting gpt

EasyAccessGpt::Configure.gpt_model = 'default value:  gpt-3.5-turbo'

And changing the locales to which the text needs to be translated:

EasyAccessGpt::Configure.available_locales = 'default values:  [de en es fr it pl ru ua]'

Setting to increase the number of tokens in the response:

EasyAccessGpt::Configure.max_tokens = 'default value 1000'

Initial setup without Rails:

require_relative 'lib/easy_access_gpt'

EasyAccessGpt::Configure.api_key = 'your api key'
EasyAccessGpt::Configure.gpt_model = 'default value:  gpt-3.5-turbo'
EasyAccessGpt::Configure.available_locales = 'default values:  [de en es fr it pl ru ua]'
EasyAccessGpt::Configure.max_tokens = 'default value 1000'

Usage

For normal chat use just call the command:

EasyAccessGpt::Communication.new('your message').call

Usage example:

request: EasyAccessGpt::Communication.new('hello').call

response: 'Hello! How can I assist you today?'

To use gems to translate text:

Run command:

EasyAccessGpt::Translation::ScopeLocales.new({body: 'your message'}).call

Usage example:

request: EasyAccessGpt::Translation::ScopeLocales.new({body: 'hello'}).call

response: {"en"=>{"body"=>"hello"},
           "pl"=>{"body"=>"cześć"},
           "fr"=>{"body"=>"bonjour"},
           "ua"=>{"body"=>"привіт"},
           "de"=>{"body"=>"hallo"},
           "ru"=>{"body"=>"привет"},
           "es"=>{"body"=>"hola"},
           "it"=>{"body"=>"ciao"}}

Translation object columns with single locale:

EasyAccessGpt::Translation::SingleLocale.new({body: 'your message'}, 'locale').call

Usage example:

request: EasyAccessGpt::Translation::SingleLocales.new({body: 'hello'}, :en).call
response: {"en"=>{"body"=>"hello"}}

Using Gems to check text for offensive content

Run command:

EasyAccessGpt::Filter.new({body: 'your message'}).call

Usage excample:

request: EasyAccessGpt::Filter.new('hello').call

response: {"message_include_profanity"=>false}
request: EasyAccessGpt::Filter.new('text included bad words, for example f@ck').call

response: {"message_include_profanity"=>true}

About

No description, website, or topics provided.

Resources

License

BSD-3-Clause, MIT licenses found

Licenses found

BSD-3-Clause
LICENSE
MIT
LICENSE.txt

Code of conduct

Stars

Watchers

Forks

Packages

No packages published