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.
UNDER DEVELOPMENT
Store activerecord models in vector stores and query them with LLMs!
Add the gem to your Gemfile:
gem 'speaky'
Install the gem:
bundle install
Create a new configuration initializer:
# config/initializers/speaky.rb
Speaky.configure do |config|
# Set the LLM type to use for querying the vector store.
# - 'openai' -> require 'ruby-openai' gem
config.llm_type = 'openai'
# Set the LLM configuration options.
# - for 'openai' LLMs, view https://github.com/alexrudall/ruby-openai for configuration options
config.llm_config = {
access_token: 'YOUR_ACCESS_TOKEN',
organization_id: 'YOUR_ORGANIZATION_ID',
}
# Set the vector store type to use for storing model instances.
# - 'qdrant' -> require 'qdrant-ruby' gem
config.vectorstore_type = 'qdrant'
# Set the vector store configuration options.
# - for 'qdrant' vector stores, :url, :api_key, :collection_name are required
config.vectorstore_config = {
url: 'YOUR_URL',
api_key: 'YOUR_API_KEY',
collection_name: 'YOUR_COLLECTION_NAME',
}
end
To use the gem, include the Speaky::Concern
module in your ActiveRecord models that should be stored in the vector store:
class MyModel < ApplicationRecord
include Speaky::Concern
def as_speaky
# This method should return a string representation of the model instance data that should be stored in the vector store. The default implementation is to call `to_json` on the model instance data.
end
# Add any callbacks that should update the model instance data in the vector store.
after_save :save_for_speaky
after_destroy :destroy_for_speaky
end
To chat with the LLM, use the Speaky.chat
method:
# Using default prompt template
Speaky.ask('What is the capital of France?')
# Using custom prompt template
Speaky.ask(
'What is the capital of France?',
template: 'You are a chatbot. Please answer the following question: {{question}} using this context: {{context}}.'
)
Clone the repo
Install dependencies with bundle install
Create your local .env
file with cp .env.example .env
Run the tests with bundle exec rspec
Update the version in lib/speaky/version.rb
Run ruby bin/publish
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that speaky demonstrated a healthy version release cadence and project activity because the last version was released less than 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.