Skip to content

Commit

Permalink
Fix railtie not being loaded (#360)
Browse files Browse the repository at this point in the history
* Fix railtie not being loaded

* Get rid of Forwardable

* Format code comments

* fix linter
  • Loading branch information
andreibondarev committed Oct 18, 2023
1 parent 1a03ca9 commit b4ab702
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 12 deletions.
2 changes: 2 additions & 0 deletions lib/langchain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ module Errors
class BaseError < StandardError; end
end
end

require "langchain/railtie" if defined?(Rails)
2 changes: 0 additions & 2 deletions lib/langchain/vectorsearch/base.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "forwardable"

module Langchain::Vectorsearch
# = Vector Databases
# A vector database a type of database that stores data as high-dimensional vectors, which are mathematical representations of features or attributes. Each vector has a certain number of dimensions, which can range from tens to thousands, depending on the complexity and granularity of the data.
Expand Down
3 changes: 2 additions & 1 deletion lib/langchain/vectorsearch/chroma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class Chroma < Base
#
# Wrapper around Chroma DB
#
# Gem requirements: gem "chroma-db", "~> 0.6.0"
# Gem requirements:
# gem "chroma-db", "~> 0.6.0"
#
# Usage:
# chroma = Langchain::Vectorsearch::Chroma.new(url:, index_name:, llm:, llm_api_key:, api_key: nil)
Expand Down
3 changes: 2 additions & 1 deletion lib/langchain/vectorsearch/milvus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class Milvus < Base
#
# Wrapper around Milvus REST APIs.
#
# Gem requirements: gem "milvus", "~> 0.9.2"
# Gem requirements:
# gem "milvus", "~> 0.9.2"
#
# Usage:
# milvus = Langchain::Vectorsearch::Milvus.new(url:, index_name:, llm:, api_key:)
Expand Down
10 changes: 8 additions & 2 deletions lib/langchain/vectorsearch/pgvector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ class Pgvector < Base
#
# The PostgreSQL vector search adapter
#
# Gem requirements: gem "pgvector", "~> 0.2"
# Gem requirements:
# gem "sequel", "~> 5.68.0"
# gem "pgvector", "~> 0.2"
#
# Usage:
# pgvector = Langchain::Vectorsearch::Pgvector.new(url:, index_name:, llm:, namespace: nil)
# pgvector = Langchain::Vectorsearch::Pgvector.new(url:, index_name:, llm:, namespace: nil)
#

# The operators supported by the PostgreSQL vector search adapter
Expand Down Expand Up @@ -150,3 +152,7 @@ def ask(question:, k: 4, &block)
end
end
end

# Rails connection when configuring vectorsearch
# Update READMEs
# Rails migration to create a migration
5 changes: 3 additions & 2 deletions lib/langchain/vectorsearch/pinecone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ class Pinecone < Base
#
# Wrapper around Pinecone API.
#
# Gem requirements: gem "pinecone", "~> 0.1.6"
# Gem requirements:
# gem "pinecone", "~> 0.1.6"
#
# Usage:
# pinecone = Langchain::Vectorsearch::Pinecone.new(environment:, api_key:, index_name:, llm:, llm_api_key:)
# pinecone = Langchain::Vectorsearch::Pinecone.new(environment:, api_key:, index_name:, llm:, llm_api_key:)
#

# Initialize the Pinecone client
Expand Down
5 changes: 3 additions & 2 deletions lib/langchain/vectorsearch/qdrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ class Qdrant < Base
#
# Wrapper around Qdrant
#
# Gem requirements: gem "qdrant-ruby", "~> 0.9.3"
# Gem requirements:
# gem "qdrant-ruby", "~> 0.9.3"
#
# Usage:
# qdrant = Langchain::Vectorsearch::Qdrant.new(url:, api_key:, index_name:, llm:, llm_api_key:)
# qdrant = Langchain::Vectorsearch::Qdrant.new(url:, api_key:, index_name:, llm:, llm_api_key:)
#

# Initialize the Qdrant client
Expand Down
5 changes: 3 additions & 2 deletions lib/langchain/vectorsearch/weaviate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ class Weaviate < Base
#
# Wrapper around Weaviate
#
# Gem requirements: gem "weaviate-ruby", "~> 0.8.3"
# Gem requirements:
# gem "weaviate-ruby", "~> 0.8.3"
#
# Usage:
# weaviate = Langchain::Vectorsearch::Weaviate.new(url:, api_key:, index_name:, llm:, llm_api_key:)
# weaviate = Langchain::Vectorsearch::Weaviate.new(url:, api_key:, index_name:, llm:, llm_api_key:)
#

# Initialize the Weaviate adapter
Expand Down

0 comments on commit b4ab702

Please sign in to comment.