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.
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.
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'
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'
EasyAccessGpt::Communication.new('your message').call
Usage example:
request: EasyAccessGpt::Communication.new('hello').call
response: 'Hello! How can I assist you today?'
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"}}
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}