langchainrb 0.19.2 → 0.19.3
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/langchain/assistant/messages/anthropic_message.rb +6 -6
- data/lib/langchain/llm/ollama.rb +4 -3
- data/lib/langchain/tool/database.rb +2 -1
- data/lib/langchain/vectorsearch/chroma.rb +2 -1
- data/lib/langchain/vectorsearch/pgvector.rb +1 -1
- data/lib/langchain/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5567aa14daf63f120a6c2b2b2991fbd85b650b4cb4e2ac49703736dacd46197e
|
4
|
+
data.tar.gz: ee71c45590998793c343c9620565cfcfdff5cd2d715091f3ad6804d54b814444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5d212aadfef3ca07a6c9dc517141f0e6dedb1e414b0e8bbcbc0b7abddd5e2405a8a07ab6cc10efd66ee8997c41b5c8bd82ea8755d0f8e5fea7728db94f82379
|
7
|
+
data.tar.gz: a3a5a5c62cc075e8d09c0e6b629e1ec8b118d35d98e4de107c48d779d8b35261de3ad0061e22a4be4b2aefc15bbb25c20f658fe1f0a694ecc87279cd21309ff8
|
data/CHANGELOG.md
CHANGED
@@ -11,6 +11,9 @@
|
|
11
11
|
|
12
12
|
## [Unreleased]
|
13
13
|
|
14
|
+
## [0.19.3] - 2025-01-13
|
15
|
+
- [BUGFIX] [https://github.com/patterns-ai-core/langchainrb/pull/900] Empty text content should not be set when content is nil when using AnthropicMessage
|
16
|
+
|
14
17
|
## [0.19.2] - 2024-11-26
|
15
18
|
- [FEATURE] [https://github.com/patterns-ai-core/langchainrb/pull/884] Add `tool_execution_callback` to `Langchain::Assistant`, a callback function (proc, lambda) that is called right before a tool is executed
|
16
19
|
|
@@ -53,14 +53,14 @@ module Langchain
|
|
53
53
|
#
|
54
54
|
# @return [Hash] The message as an Anthropic API-compatible hash, with the role as "assistant"
|
55
55
|
def assistant_hash
|
56
|
+
content_array = []
|
57
|
+
if content && !content.empty?
|
58
|
+
content_array << {type: "text", text: content}
|
59
|
+
end
|
60
|
+
|
56
61
|
{
|
57
62
|
role: "assistant",
|
58
|
-
content:
|
59
|
-
{
|
60
|
-
type: "text",
|
61
|
-
text: content
|
62
|
-
}
|
63
|
-
].concat(tool_calls)
|
63
|
+
content: content_array.concat(tool_calls)
|
64
64
|
}
|
65
65
|
end
|
66
66
|
|
data/lib/langchain/llm/ollama.rb
CHANGED
@@ -12,9 +12,9 @@ module Langchain::LLM
|
|
12
12
|
|
13
13
|
DEFAULTS = {
|
14
14
|
temperature: 0.0,
|
15
|
-
completion_model: "llama3.
|
16
|
-
embedding_model: "llama3.
|
17
|
-
chat_model: "llama3.
|
15
|
+
completion_model: "llama3.2",
|
16
|
+
embedding_model: "llama3.2",
|
17
|
+
chat_model: "llama3.2",
|
18
18
|
options: {}
|
19
19
|
}.freeze
|
20
20
|
|
@@ -24,6 +24,7 @@ module Langchain::LLM
|
|
24
24
|
llama2: 4_096,
|
25
25
|
llama3: 4_096,
|
26
26
|
"llama3.1": 4_096,
|
27
|
+
"llama3.2": 4_096,
|
27
28
|
llava: 4_096,
|
28
29
|
mistral: 4_096,
|
29
30
|
"mistral-openorca": 4_096,
|
@@ -5,7 +5,7 @@ module Langchain::Tool
|
|
5
5
|
# Connects to a SQL database, executes SQL queries, and outputs DB schema for Agents to use
|
6
6
|
#
|
7
7
|
# Gem requirements:
|
8
|
-
# gem "sequel", "~> 5.
|
8
|
+
# gem "sequel", "~> 5.87.0"
|
9
9
|
#
|
10
10
|
# Usage:
|
11
11
|
# database = Langchain::Tool::Database.new(connection_string: "postgres://user:password@localhost:5432/db_name")
|
@@ -115,6 +115,7 @@ module Langchain::Tool
|
|
115
115
|
else
|
116
116
|
primary_key_columns << column[0]
|
117
117
|
end
|
118
|
+
schema << " COMMENT '#{column[1][:comment]}'" if column[1][:comment]
|
118
119
|
schema << ",\n" unless column == db.schema(table).last && primary_key_column_count == 1
|
119
120
|
end
|
120
121
|
if primary_key_column_count > 1
|
@@ -116,7 +116,8 @@ module Langchain::Vectorsearch
|
|
116
116
|
count = collection.count
|
117
117
|
n_results = [count, k].min
|
118
118
|
|
119
|
-
|
119
|
+
# workaround mentioned here: https://github.com/mariochavez/chroma/issues/29
|
120
|
+
collection.query(query_embeddings: [embedding], results: n_results, where: nil, where_document: nil)
|
120
121
|
end
|
121
122
|
|
122
123
|
# Ask a question and return the answer
|
data/lib/langchain/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: langchainrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.
|
4
|
+
version: 0.19.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Bondarev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: baran
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.1.9
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: csv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: json-schema
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +100,14 @@ dependencies:
|
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 3.1.6
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 3.1.6
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: pry-byebug
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -576,14 +590,14 @@ dependencies:
|
|
576
590
|
requirements:
|
577
591
|
- - "~>"
|
578
592
|
- !ruby/object:Gem::Version
|
579
|
-
version: 5.
|
593
|
+
version: 5.87.0
|
580
594
|
type: :development
|
581
595
|
prerelease: false
|
582
596
|
version_requirements: !ruby/object:Gem::Requirement
|
583
597
|
requirements:
|
584
598
|
- - "~>"
|
585
599
|
- !ruby/object:Gem::Version
|
586
|
-
version: 5.
|
600
|
+
version: 5.87.0
|
587
601
|
- !ruby/object:Gem::Dependency
|
588
602
|
name: weaviate-ruby
|
589
603
|
requirement: !ruby/object:Gem::Requirement
|
@@ -776,7 +790,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
776
790
|
- !ruby/object:Gem::Version
|
777
791
|
version: '0'
|
778
792
|
requirements: []
|
779
|
-
rubygems_version: 3.5.
|
793
|
+
rubygems_version: 3.5.3
|
780
794
|
signing_key:
|
781
795
|
specification_version: 4
|
782
796
|
summary: Build LLM-backed Ruby applications with Ruby's Langchain.rb
|