Skip to content

Commit

Permalink
Langchain::Tool::Database#describe_table with COMMENT
Browse files Browse the repository at this point in the history
Allows LLM to make use of columns' comments.
Possible since Sequel 5.87.0.
  • Loading branch information
Bahanix committed Dec 1, 2024
1 parent 4b447e3 commit 4a3d3bc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ GEM
rubyzip (2.3.2)
safe_ruby (1.0.4)
childprocess (>= 0.3.9)
sequel (5.68.0)
sequel (5.87.0)
signet (0.19.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
Expand Down Expand Up @@ -480,7 +480,7 @@ DEPENDENCIES
rubocop
ruby-openai (~> 7.1.0)
safe_ruby (~> 1.0.4)
sequel (~> 5.68.0)
sequel (~> 5.87.0)
standard (>= 1.35.1)
vcr
weaviate-ruby (~> 0.9.2)
Expand Down
2 changes: 1 addition & 1 deletion langchain.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "roo-xls", "~> 1.2.0"
spec.add_development_dependency "ruby-openai", "~> 7.1.0"
spec.add_development_dependency "safe_ruby", "~> 1.0.4"
spec.add_development_dependency "sequel", "~> 5.68.0"
spec.add_development_dependency "sequel", "~> 5.87.0"
spec.add_development_dependency "weaviate-ruby", "~> 0.9.2"
spec.add_development_dependency "wikipedia-client", "~> 1.17.0"
spec.add_development_dependency "power_point_pptx", "~> 0.1.0"
Expand Down
1 change: 1 addition & 0 deletions lib/langchain/tool/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def describe_table(table)
else
primary_key_columns << column[0]
end
schema << " COMMENT '#{column[1][:comment]}'" if column[1][:comment]
schema << ",\n" unless column == db.schema(table).last && primary_key_column_count == 1
end
if primary_key_column_count > 1
Expand Down
2 changes: 1 addition & 1 deletion lib/langchain/vectorsearch/pgvector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Pgvector < Base
# The PostgreSQL vector search adapter
#
# Gem requirements:
# gem "sequel", "~> 5.68.0"
# gem "sequel", "~> 5.87.0"
# gem "pgvector", "~> 0.2"
#
# Usage:
Expand Down

0 comments on commit 4a3d3bc

Please sign in to comment.