Skip to content

Commit ea6c3d1

Browse files
koicandreibondarev
andauthored
[Doc] Move Langchain::Vectorsearch class documentation to correct locations (patterns-ai-core#989)
This PR moves documentation for classes under `Langchain::Vectorsearch` module to their proper locations. Co-authored-by: Andrei Bondarev <[email protected]>
1 parent 99c5a5b commit ea6c3d1

File tree

8 files changed

+92
-97
lines changed

8 files changed

+92
-97
lines changed

lib/langchain/vectorsearch/chroma.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# frozen_string_literal: true
22

33
module Langchain::Vectorsearch
4+
#
5+
# Wrapper around Chroma DB
6+
#
7+
# Gem requirements:
8+
# gem "chroma-db", "~> 0.6.0"
9+
#
10+
# Usage:
11+
# chroma = Langchain::Vectorsearch::Chroma.new(url:, index_name:, llm:, api_key: nil)
12+
#
413
class Chroma < Base
5-
#
6-
# Wrapper around Chroma DB
7-
#
8-
# Gem requirements:
9-
# gem "chroma-db", "~> 0.6.0"
10-
#
11-
# Usage:
12-
# chroma = Langchain::Vectorsearch::Chroma.new(url:, index_name:, llm:, api_key: nil)
13-
#
14-
1514
# Initialize the Chroma client
1615
# @param url [String] The URL of the Chroma server
1716
# @param index_name [String] The name of the index to use

lib/langchain/vectorsearch/elasticsearch.rb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
# frozen_string_literal: true
22

33
module Langchain::Vectorsearch
4+
#
5+
# Wrapper around Elasticsearch vector search capabilities.
6+
#
7+
# Setting up Elasticsearch:
8+
# 1. Get Elasticsearch up and running with Docker: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
9+
# 2. Copy the HTTP CA certificate SHA-256 fingerprint and set the ELASTICSEARCH_CA_FINGERPRINT environment variable
10+
# 3. Set the ELASTICSEARCH_URL environment variable
11+
#
12+
# Gem requirements:
13+
# gem "elasticsearch", "~> 8.0.0"
14+
#
15+
# Usage:
16+
# llm = Langchain::LLM::OpenAI.new(api_key: ENV["OPENAI_API_KEY"])
17+
# es = Langchain::Vectorsearch::Elasticsearch.new(
18+
# url: ENV["ELASTICSEARCH_URL"],
19+
# index_name: "docs",
20+
# llm: llm,
21+
# es_options: {
22+
# transport_options: {ssl: {verify: false}},
23+
# ca_fingerprint: ENV["ELASTICSEARCH_CA_FINGERPRINT"]
24+
# }
25+
# )
26+
#
27+
# es.create_default_schema
28+
# es.add_texts(texts: ["..."])
29+
# es.similarity_search(text: "...")
30+
#
431
class Elasticsearch < Base
5-
#
6-
# Wrapper around Elasticsearch vector search capabilities.
7-
#
8-
# Setting up Elasticsearch:
9-
# 1. Get Elasticsearch up and running with Docker: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
10-
# 2. Copy the HTTP CA certificate SHA-256 fingerprint and set the ELASTICSEARCH_CA_FINGERPRINT environment variable
11-
# 3. Set the ELASTICSEARCH_URL environment variable
12-
#
13-
# Gem requirements:
14-
# gem "elasticsearch", "~> 8.0.0"
15-
#
16-
# Usage:
17-
# llm = Langchain::LLM::OpenAI.new(api_key: ENV["OPENAI_API_KEY"])
18-
# es = Langchain::Vectorsearch::Elasticsearch.new(
19-
# url: ENV["ELASTICSEARCH_URL"],
20-
# index_name: "docs",
21-
# llm: llm,
22-
# es_options: {
23-
# transport_options: {ssl: {verify: false}},
24-
# ca_fingerprint: ENV["ELASTICSEARCH_CA_FINGERPRINT"]
25-
# }
26-
# )
27-
#
28-
# es.create_default_schema
29-
# es.add_texts(texts: ["..."])
30-
# es.similarity_search(text: "...")
31-
#
3232
attr_accessor :es_client, :index_name, :options
3333

3434
def initialize(url:, index_name:, llm:, api_key: nil, es_options: {})

lib/langchain/vectorsearch/hnswlib.rb

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

33
module Langchain::Vectorsearch
4+
#
5+
# Wrapper around HNSW (Hierarchical Navigable Small World) library.
6+
# HNSWLib is an in-memory vectorstore that can be saved to a file on disk.
7+
#
8+
# Gem requirements:
9+
# gem "hnswlib", "~> 0.8.1"
10+
#
11+
# Usage:
12+
# hnsw = Langchain::Vectorsearch::Hnswlib.new(llm:, path_to_index:)
13+
#
414
class Hnswlib < Base
5-
#
6-
# Wrapper around HNSW (Hierarchical Navigable Small World) library.
7-
# HNSWLib is an in-memory vectorstore that can be saved to a file on disk.
8-
#
9-
# Gem requirements:
10-
# gem "hnswlib", "~> 0.8.1"
11-
#
12-
# Usage:
13-
# hnsw = Langchain::Vectorsearch::Hnswlib.new(llm:, path_to_index:)
14-
1515
attr_reader :client, :path_to_index
1616

1717
#

lib/langchain/vectorsearch/milvus.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# frozen_string_literal: true
22

33
module Langchain::Vectorsearch
4+
#
5+
# Wrapper around Milvus REST APIs.
6+
#
7+
# Gem requirements:
8+
# gem "milvus", "~> 0.10.3"
9+
#
10+
# Usage:
11+
# milvus = Langchain::Vectorsearch::Milvus.new(url:, index_name:, llm:, api_key:)
12+
#
413
class Milvus < Base
5-
#
6-
# Wrapper around Milvus REST APIs.
7-
#
8-
# Gem requirements:
9-
# gem "milvus", "~> 0.10.3"
10-
#
11-
# Usage:
12-
# milvus = Langchain::Vectorsearch::Milvus.new(url:, index_name:, llm:, api_key:)
13-
#
1414
def initialize(url:, index_name:, llm:, api_key: nil)
1515
depends_on "milvus"
1616

lib/langchain/vectorsearch/pgvector.rb

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

33
module Langchain::Vectorsearch
4+
#
5+
# The PostgreSQL vector search adapter
6+
#
7+
# Gem requirements:
8+
# gem "sequel", "~> 5.87.0"
9+
# gem "pgvector", "~> 0.2"
10+
#
11+
# Usage:
12+
# pgvector = Langchain::Vectorsearch::Pgvector.new(url:, index_name:, llm:, namespace: nil)
13+
#
414
class Pgvector < Base
5-
#
6-
# The PostgreSQL vector search adapter
7-
#
8-
# Gem requirements:
9-
# gem "sequel", "~> 5.87.0"
10-
# gem "pgvector", "~> 0.2"
11-
#
12-
# Usage:
13-
# pgvector = Langchain::Vectorsearch::Pgvector.new(url:, index_name:, llm:, namespace: nil)
14-
#
15-
1615
# The operators supported by the PostgreSQL vector search adapter
1716
OPERATORS = {
1817
"cosine_distance" => "cosine",

lib/langchain/vectorsearch/pinecone.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# frozen_string_literal: true
22

33
module Langchain::Vectorsearch
4+
#
5+
# Wrapper around Pinecone API.
6+
#
7+
# Gem requirements:
8+
# gem "pinecone", "~> 0.1.6"
9+
#
10+
# Usage:
11+
# pinecone = Langchain::Vectorsearch::Pinecone.new(environment:, api_key:, index_name:, llm:)
12+
#
413
class Pinecone < Base
5-
#
6-
# Wrapper around Pinecone API.
7-
#
8-
# Gem requirements:
9-
# gem "pinecone", "~> 0.1.6"
10-
#
11-
# Usage:
12-
# pinecone = Langchain::Vectorsearch::Pinecone.new(environment:, api_key:, index_name:, llm:)
13-
#
14-
1514
# Initialize the Pinecone client
1615
# @param environment [String] The environment to use
1716
# @param api_key [String] The API key to use

lib/langchain/vectorsearch/qdrant.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# frozen_string_literal: true
22

33
module Langchain::Vectorsearch
4+
#
5+
# Wrapper around Qdrant
6+
#
7+
# Gem requirements:
8+
# gem "qdrant-ruby", "~> 0.9.8"
9+
#
10+
# Usage:
11+
# qdrant = Langchain::Vectorsearch::Qdrant.new(url:, api_key:, index_name:, llm:)
12+
#
413
class Qdrant < Base
5-
#
6-
# Wrapper around Qdrant
7-
#
8-
# Gem requirements:
9-
# gem "qdrant-ruby", "~> 0.9.8"
10-
#
11-
# Usage:
12-
# qdrant = Langchain::Vectorsearch::Qdrant.new(url:, api_key:, index_name:, llm:)
13-
#
14-
1514
# Initialize the Qdrant client
1615
# @param url [String] The URL of the Qdrant server
1716
# @param api_key [String] The API key to use

lib/langchain/vectorsearch/weaviate.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# frozen_string_literal: true
22

33
module Langchain::Vectorsearch
4+
#
5+
# Wrapper around Weaviate
6+
#
7+
# Gem requirements:
8+
# gem "weaviate-ruby", "~> 0.9.2"
9+
#
10+
# Usage:
11+
# weaviate = Langchain::Vectorsearch::Weaviate.new(url: ENV["WEAVIATE_URL"], api_key: ENV["WEAVIATE_API_KEY"], index_name: "Docs", llm: llm)
12+
#
413
class Weaviate < Base
5-
#
6-
# Wrapper around Weaviate
7-
#
8-
# Gem requirements:
9-
# gem "weaviate-ruby", "~> 0.9.2"
10-
#
11-
# Usage:
12-
# weaviate = Langchain::Vectorsearch::Weaviate.new(url: ENV["WEAVIATE_URL"], api_key: ENV["WEAVIATE_API_KEY"], index_name: "Docs", llm: llm)
13-
#
14-
1514
# Initialize the Weaviate adapter
1615
# @param url [String] The URL of the Weaviate instance
1716
# @param api_key [String] The API key to use

0 commit comments

Comments
 (0)