Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
AskGpt is a Ruby Gem that enables users to ask questions to ChatGPT with context.
To install AskGpt, add the following line to your Gemfile:
gem 'ask_gpt'
Then run bundle install
to install the gem.
After installation, import AskGpt into your Ruby program:
require 'ask_gpt'
Next, create a new instance of the AskGpt::GPT
class:
gpt = AskGpt::GPT.new(api_key)
The api_key
parameter is required and represents your OpenAI API key. You can get it from here.
The model
parameter is optional and represents the GPT model that you want to use. The default value is gpt-3.5-turbo
. You can use gpt-4
if you have access to it.
The temperature
parameter is also optional and represents the "creativity" of the model's responses. The default value is 0.7
, which should provide a good balance between creativity and accuracy. Value ranges from 0.0 - 1.0
and the higher the value, the more creative the model's responses will be.
The unable_to_get_answer_text
parameter is optional and represents the message that will be returned if the model is unable to generate a response. The default value is 'Unable to get answer from ChatGPT. Make sure API key is valid and has enough credits.'
Once you have created a new instance of the GPT class, you can ask questions by calling the ask
method:
answer = gpt.ask("What is the capital of France?")
The ask
method takes a single parameter, which is the question that you want to ask the model. If the question is empty, the method will return nil
. Otherwise, it will use the context of previous questions and answers to generate a response. If the model is unable to generate a response, the ask
method will return the unable_to_get_answer_text
message.
If the model is able to generate a response, the ask
method will return the answer as a string.
Here's an example of how you can use AskGpt to ask a series of questions and get answers:
require 'ask_gpt'
api_key = 'your_api_key_here'
gpt = AskGpt::GPT.new(api_key)
questions = [
"What is the capital of France?",
"Who was the first president of the United States?",
"What is the tallest mountain in the world?"
]
questions.each do |question|
answer = gpt.ask(question)
puts "Q: #{question}\nA: #{answer}\n\n"
end
In this example, we first create a new instance of the GPT class using our API key. We then define an array of questions that we want to ask the model. Finally, we loop through each question, ask the model for an answer, and print the question and answer to the console.
This readme was generated by ChatGPT with some guidance and modifications.
FAQs
Unknown package
We found that ask_gpt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.