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

iprog_chatgpt

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iprog_chatgpt

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Iprog ChatGPT

IPROG TECH

This gem is provided by IPROG TECH, an information technology company specializing in web development services using Ruby on Rails. IPROG TECH also offers free programming tutorials.

Providing Good Quality Web Services:

  • Startup
  • Maintenance
  • Upgrading & Conversion

Buy Me A Coffee

Installation

To install the gem, add this line to your application's Gemfile:

gem 'iprog_chatgpt'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install iprog_chatgpt

Usage

require 'iprog_chatgpt'

client = IprogChatgpt::Client.new("your_openai_api_key")
# or
# client = IprogChatgpt::Client.new("your_openai_api_key", "gpt-4o")
# default model: "gpt-3.5-turbo"

response = client.chat("Hello, how are you?")
puts response

Rspec Testing

Export OpenAI API Key:

export OPENAI_API_KEY=your_secret_api_key

Run Spec:

$ rspec spec/iprog_chatgpt/client_spec.rb

Response:

{"id"=>"chatcmpl-A7W1GixPUxu5qYsGf6cEb5TQZs4DL", "object"=>"chat.completion", "created"=>1726354742, "model"=>"gpt-3.5-turbo-0125", "choices"=>[{"index"=>0, "message"=>{"role"=>"assistant", "content"=>"Hello! How can I assist you today?", "refusal"=>nil}, "logprobs"=>nil, "finish_reason"=>"stop"}], "usage"=>{"prompt_tokens"=>12, "completion_tokens"=>9, "total_tokens"=>21, "completion_tokens_details"=>{"reasoning_tokens"=>0}}, "system_fingerprint"=>nil}
.

Finished in 1.25 seconds (files took 0.09689 seconds to load)
1 example, 0 failures

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/iprog21/iprog_chatgpt.

License

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

Code of Conduct

This project has adopted the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to iprog.tech@gmail.com.

FAQs

Package last updated on 16 Sep 2024

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