Giter Site home page Giter Site logo

chatsonic's Introduction

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

GitHub license [Maintainability RuboCop Ruby

Use the ChatSonic API with Ruby! ๐Ÿค–โค๏ธ

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

1. Write Factual Trending Content

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.

chatsonic's People

Contributors

dependabot[bot] avatar samalasumanth0262 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

yz vineetp6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.