Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chatsonic

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chatsonic

  • 1.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

ChatGPT Alternative Built With Superpowers - ChatSonic (Now GPT-4 Powered) Rails Gem

GitHub license Maintainability

Use the ChatSonic API with Ruby! 🤖❤️

Trusted by 1,000,000+ marketing teams, agencies, and freelancers. 10,000+ 5-star ratings.

2. Generate AI Art

3. Write anywhere and everywhere

How to Use ?

Bundler

Add this line to your application's Gemfile:

gem "chatsonic"

And then execute:

$ bundle install

Gem install

Or install with:

$ gem install chatsonic

and require with:

require "chatsonic"

Usage

Quickstart

For a quick test you can pass your token directly to a new client:

client = ChatSonic::Client.new(access_token: "Your API Key")

With Config

For a more robust setup, you can configure the gem with your API keys, for example in an chatsonic.rb initializer file. Never hardcode secrets into your codebase - instead use something like dotenv to pass the keys safely into your environments.

ChatSonic.configure do |config|
    config.access_token = ENV.fetch('API-KEY')
end

Then you can create a client like this:

client = ChatSonic::Client.new
Custom timeout or base URI

The default timeout for any ChatSonic request is 120 seconds. You can change that passing the request_timeout when initializing the client. You can also change the base URI used for all requests.

client = ChatSonic::Client.new(
    access_token: "access_token_goes_here",
    uri_base: "https://api.writesonic.com/",
    request_timeout: 240
)

or when configuring the gem:

ChatSonic.configure do |config|
    config.access_token = ENV.fetch("API_KEY")
    config.uri_base = "https://api.writesonic.com/" # Optional
    config.request_timeout = 240 # Optional
end

ChatSonic

ChatSonic is a model that can be used to generate text in a conversational style.


client.prompt(parameters: {
    enable_google_results: true,
    enable_memory: true,
    input_text: 'Hi'
  })
# => "Hello! How may I assist you today?"

input_text can be your prompt

Rspec ( Test Cases )

For Specs you can run bundle rake rspec. Make sure all the specs are passed before raising a PR. PR template can be found here Pull Request Template

Feature Request

You can raise a feature request in this mentioned format Feature Request Format

Bug Report

You can raise a Bug report in this mentioned format Bug Report Format

License

The gem is available as open source under the terms of the MIT License.

ToDo: Implement

  1. Create a pull request template
  2. Create a circle CI for CI/CD
  3. Rspec to be implemented
  4. Code of Coduct
  5. Contributing

FAQs

Package last updated on 15 Apr 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc