Skip to content

Commit

Permalink
Require common libs at top-leve (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibondarev authored Sep 2, 2024
1 parent 0355dcf commit db8336a
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 9 deletions.
4 changes: 4 additions & 0 deletions lib/langchain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
require "pathname"
require "rainbow"
require "zeitwerk"
require "uri"
require "json"

loader = Zeitwerk::Loader.for_gem
loader.ignore("#{__dir__}/langchainrb.rb")
loader.inflector.inflect(
Expand All @@ -30,6 +33,7 @@

loader.collapse("#{__dir__}/langchain/tool/calculator")
loader.collapse("#{__dir__}/langchain/tool/database")
loader.collapse("#{__dir__}/langchain/tool/docs_tool")
loader.collapse("#{__dir__}/langchain/tool/file_system")
loader.collapse("#{__dir__}/langchain/tool/google_search")
loader.collapse("#{__dir__}/langchain/tool/ruby_code_interpreter")
Expand Down
1 change: 0 additions & 1 deletion lib/langchain/output_parsers/structured_output_parser.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "json"
require "json-schema"

module Langchain::OutputParsers
Expand Down
2 changes: 1 addition & 1 deletion lib/langchain/processors/eml.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "uri"
# frozen_string_literal: true

module Langchain
module Processors
Expand Down
1 change: 0 additions & 1 deletion lib/langchain/prompt/base.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "strscan"
require "json"
require "yaml"

module Langchain::Prompt
Expand Down
1 change: 0 additions & 1 deletion lib/langchain/prompt/loading.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require "strscan"
require "pathname"
require "json"
require "yaml"

module Langchain::Prompt
Expand Down
2 changes: 0 additions & 2 deletions lib/langchain/tool_definition.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "json"

#
# Extends a class to be used as a tool in the assistant.
# A tool is a collection of functions (methods) used to perform specific tasks.
Expand Down
2 changes: 0 additions & 2 deletions lib/langchain/vectorsearch/epsilla.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# frozen_string_literal: true

require "securerandom"
require "json"
require "timeout"
require "uri"

module Langchain::Vectorsearch
class Epsilla < Base
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "pathname"
require "json"
require "yaml"
require "langchain"
require "pry-byebug"
Expand Down

0 comments on commit db8336a

Please sign in to comment.