Skip to content

Commit e1b9f39

Browse files
authored
Refactor to Rails::Engine (#1003)
1 parent d092327 commit e1b9f39

File tree

184 files changed

+1619
-303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+1619
-303
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,13 @@
1616
.idea
1717
test.ann
1818
Gemfile.lock
19+
20+
/log/*.log
21+
test/dummy/db/*.sqlite3
22+
test/dummy/db/*.sqlite3-*
23+
test/dummy/log/*.log
24+
test/dummy/storage/
25+
test/dummy/tmp/
26+
*.keep
27+
28+
tags

.rspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
--format documentation
2-
--color
31
--require spec_helper
2+
--require rails_helper
3+
--format documentation
4+
--color

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruby 3.4
1+
ruby 3.4.4

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
## [Unreleased]
1313
- [COMPAT] [https://github.com/patterns-ai-core/langchainrb/pull/980] Suppress a Ruby 3.4 warning for URI parser.
1414
- [BREAKING] [https://github.com/patterns-ai-core/langchainrb/pull/997] Remove `Langchain::Vectorsearch::Epsilla` class
15+
- [BREAKING] [https://github.com/patterns-ai-core/langchainrb/pull/1003] Response classes are now namespaced under `Langchain::LLM::Response`, converted to Rails engine
1516

1617
## [0.19.5]
1718
- [BREAKING] [https://github.com/patterns-ai-core/langchainrb/pull/859] Add metadata support to PgVector storage
@@ -238,7 +239,7 @@
238239

239240
## [0.8.0]
240241
- [BREAKING] Updated llama_cpp.rb to 0.9.4. The model file format used by the underlying llama.cpp library has changed to GGUF. llama.cpp ships with scripts to convert existing files and GGUF format models can be downloaded from HuggingFace.
241-
- Introducing Langchain::LLM::GoogleVertexAi LLM provider
242+
- Introducing Langchain::LLM::GoogleVertexAI LLM provider
242243

243244
## [0.7.5] - 2023-11-13
244245
- Fixes

Gemfile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33
source "https://rubygems.org"
44

5-
# Specify your gem's dependencies in langchain.gemspec
5+
# Specify your gem's dependencies in langchain.gemspec.
66
gemspec
77

8-
gem "rake", "~> 13.0"
8+
group :test do
9+
gem "sqlite3"
10+
end
911

10-
gem "rspec", "~> 3.0"
11-
12-
gem "standard", ">= 1.35.1"
13-
# Lets add rubocop explicitly here, we are using only standardrb rules in .rubocop.yml
14-
gem "rubocop"
12+
# Development and test dependencies
13+
group :development, :test do
14+
gem "rspec", "~> 3.0"
15+
gem "rspec-rails"
16+
gem "standard", ">= 1.35.1"
17+
gem "rubocop"
18+
gem "rubocop-rails-omakase", require: false
19+
gem "rake", "~> 13.0"
20+
end

Rakefile

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
# frozen_string_literal: true
22

3-
require "bundler/gem_tasks"
4-
require "rspec/core/rake_task"
5-
require "standard/rake"
6-
require "yard"
7-
8-
RSpec::Core::RakeTask.new(:spec)
3+
require "bundler/setup"
94

10-
task default: :spec
5+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
116

12-
Rake::Task["spec"].enhance do
13-
Rake::Task["standard:fix"].invoke
14-
end
15-
16-
YARD::Rake::YardocTask.new do |t|
17-
end
7+
require "bundler/gem_tasks"

bin/console

Lines changed: 0 additions & 51 deletions
This file was deleted.

bin/rails

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env ruby
2+
# This command will automatically be run when you run "rails" with Rails gems
3+
# installed from the root of your application.
4+
5+
ENGINE_ROOT = File.expand_path("..", __dir__)
6+
ENGINE_PATH = File.expand_path("../lib/langchain/engine", __dir__)
7+
APP_PATH = File.expand_path("../test/dummy/config/application", __dir__)
8+
9+
# Set up gems listed in the Gemfile.
10+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
11+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
12+
13+
require "rails"
14+
# Pick the frameworks you want:
15+
# require "active_model/railtie"
16+
# require "active_job/railtie"
17+
# require "active_record/railtie"
18+
# require "active_storage/engine"
19+
# require "action_controller/railtie"
20+
# require "action_mailer/railtie"
21+
# require "action_mailbox/engine"
22+
# require "action_text/engine"
23+
# require "action_view/railtie"
24+
# require "action_cable/engine"
25+
# require "rails/test_unit/railtie"
26+
require "rails/engine/commands"

bin/rubocop

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env ruby
2+
require "rubygems"
3+
require "bundler/setup"
4+
5+
# explicit rubocop config increases performance slightly while avoiding config confusion.
6+
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
7+
8+
load Gem.bin_path("rubocop", "rubocop")

bin/setup

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)