langchainrb 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5a782dd2282ab5dd4aed3f1d0e421a4f9b227fa4c5450ed27f2f98a86af74f4
4
- data.tar.gz: b47bb5d6789d7abb81f56ee1beb0b52323184f578475aec3e92fcc19b4a1314a
3
+ metadata.gz: 252bfabecd9100d29bab8be718ba43421369812a6f02d4526970fcef85a7617e
4
+ data.tar.gz: 468cdbb3a31238b5dfc53d4dbd22d5d00e2d0347a3482660361841f6663bc1da
5
5
  SHA512:
6
- metadata.gz: 4e918b49b2b04a0e7009db732a5b24ab080a0d8d6b4c3be4084aa3a1492ddd6c1627d467b8bff4b34e1e5160b71622a75772ef92658dce2589b9542b8b0a8137
7
- data.tar.gz: 3b465f1a05e614d64d416582aeaf7d998bf51422705331b220e08b00774d4beed4dcbc4e2a71b81bad87cddfe8c8f4c8db421d650e7161f16b26a1259922f71c
6
+ metadata.gz: deed8fc8b33c590b1c057a53985295a2447e11f0917c3646b03f592035c15f00fe27b852bc6f6e8455e79a604ac699252720cc84d4d011c69b1b1f71a7047d81
7
+ data.tar.gz: f6681fdd1ffcc468bb515c3bae1231c17d85c59925305a698be4766bb8beb29b0a748b088c8943b012a01da7d6c38744b7e46efb7ad4fd6f9245f9a634dffcf9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.5] - 2023-05-16
4
+ - Bug fixes
5
+
3
6
  ## [0.3.4] - 2023-05-16
4
7
  - LLMs
5
8
  - Introducing support for HuggingFace
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- langchainrb (0.3.4)
4
+ langchainrb (0.3.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/llm/base.rb CHANGED
@@ -8,7 +8,8 @@ module LLM
8
8
  # TODO: Add support for HuggingFace and other LLMs
9
9
  LLMS = {
10
10
  openai: "OpenAI",
11
- cohere: "Cohere"
11
+ cohere: "Cohere",
12
+ huggingface: "HuggingFace"
12
13
  }.freeze
13
14
 
14
15
  def default_dimension
@@ -2,16 +2,18 @@
2
2
 
3
3
  module LLM
4
4
  class HuggingFace < Base
5
- # The gem does not currently accept other models:
5
+ # The gem does not currently accept other models:
6
6
  # https://github.com/alchaplinsky/hugging-face/blob/main/lib/hugging_face/inference_api.rb#L32-L34
7
7
  DEFAULTS = {
8
- embeddings_model_name: "sentence-transformers/all-MiniLM-L6-v2"
8
+ temperature: 0.0,
9
+ embeddings_model_name: "sentence-transformers/all-MiniLM-L6-v2",
10
+ dimension: 384 # Vector size generated by the above model
9
11
  }.freeze
10
-
11
- #
12
+
13
+ #
12
14
  # Intialize the HuggingFace LLM
13
15
  # @param api_key [String] The API key to use
14
- #
16
+ #
15
17
  def initialize(api_key:)
16
18
  depends_on "hugging-face"
17
19
  require "hugging_face"
@@ -24,9 +26,8 @@ module LLM
24
26
  # @return [Array] The embedding
25
27
  def embed(text:)
26
28
  response = client.embedding(
27
- input: text,
28
- model: DEFAULTS[:embeddings_model_name]
29
+ input: text
29
30
  )
30
31
  end
31
32
  end
32
- end
33
+ end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Langchain
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: langchainrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Bondarev