langchainrb 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +7 -0
- data/lib/langchain/llm/mistral_ai.rb +2 -2
- data/lib/langchain/llm/ollama.rb +7 -2
- data/lib/langchain/vectorsearch/pgvector.rb +7 -0
- data/lib/langchain/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14c9c33c905c2df744cc7006735dbc55b86b767cfff4b655b03103072c804bb1
|
4
|
+
data.tar.gz: e5076e7322ff375b16463ff14e5c504d7b106e05874f6860f9669a2269346d61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f590a6f2f2adec60ee777a94886e178abfaf0789c0141bbd278d0a008d9ace75cb9f69d6afdf3ae3d58f7307246acfaf7f0fef43d43065bf8c1d83aa0e51562d
|
7
|
+
data.tar.gz: 3fef869c24edf5a14ea4ddbdae8af919b2082e8f95b676ca36dd9e606ba67812e88dcd6d67f15156b9cce8daaaab26acd9c8602e3c894199dd7eae43d0926443
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -29,6 +29,7 @@ Available for paid consulting engagements! [Email me](mailto:andrei@sourcelabs.i
|
|
29
29
|
- [Evaluations](#evaluations-evals)
|
30
30
|
- [Examples](#examples)
|
31
31
|
- [Logging](#logging)
|
32
|
+
- [Problems](#problems)
|
32
33
|
- [Development](#development)
|
33
34
|
- [Discord](#discord)
|
34
35
|
|
@@ -501,6 +502,12 @@ To show all log messages:
|
|
501
502
|
Langchain.logger.level = :debug
|
502
503
|
```
|
503
504
|
|
505
|
+
## Problems
|
506
|
+
If you're having issues installing `unicode` gem required by `pragmatic_segmenter`, try running:
|
507
|
+
```bash
|
508
|
+
gem install unicode -- --with-cflags="-Wno-incompatible-function-pointer-types"
|
509
|
+
```
|
510
|
+
|
504
511
|
## Development
|
505
512
|
|
506
513
|
1. `git clone https://github.com/andreibondarev/langchainrb.git`
|
@@ -5,7 +5,7 @@ module Langchain::LLM
|
|
5
5
|
# gem "mistral-ai"
|
6
6
|
#
|
7
7
|
# Usage:
|
8
|
-
# llm = Langchain::LLM::MistralAI.new(api_key: ENV["
|
8
|
+
# llm = Langchain::LLM::MistralAI.new(api_key: ENV["MISTRAL_AI_API_KEY"])
|
9
9
|
class MistralAI < Base
|
10
10
|
DEFAULTS = {
|
11
11
|
chat_completion_model_name: "mistral-medium",
|
@@ -18,7 +18,7 @@ module Langchain::LLM
|
|
18
18
|
depends_on "mistral-ai"
|
19
19
|
|
20
20
|
@client = Mistral.new(
|
21
|
-
credentials: {api_key:
|
21
|
+
credentials: {api_key: api_key},
|
22
22
|
options: {server_sent_events: true}
|
23
23
|
)
|
24
24
|
|
data/lib/langchain/llm/ollama.rb
CHANGED
@@ -131,9 +131,14 @@ module Langchain::LLM
|
|
131
131
|
|
132
132
|
req.options.on_data = proc do |chunk, size|
|
133
133
|
chunk.split("\n").each do |line_chunk|
|
134
|
-
json_chunk =
|
134
|
+
json_chunk = begin
|
135
|
+
JSON.parse(line_chunk)
|
136
|
+
# In some instance the chunk exceeds the buffer size and the JSON parser fails
|
137
|
+
rescue JSON::ParserError
|
138
|
+
nil
|
139
|
+
end
|
135
140
|
|
136
|
-
response += json_chunk.dig("response")
|
141
|
+
response += json_chunk.dig("response") unless json_chunk.blank?
|
137
142
|
end
|
138
143
|
|
139
144
|
yield json_chunk, size if block
|
@@ -89,6 +89,13 @@ module Langchain::Vectorsearch
|
|
89
89
|
upsert_texts(texts: texts, ids: ids)
|
90
90
|
end
|
91
91
|
|
92
|
+
# Remove a list of texts from the index
|
93
|
+
# @param ids [Array<Integer>] The ids of the texts to remove from the index
|
94
|
+
# @return [Integer] The number of texts removed from the index
|
95
|
+
def remove_texts(ids:)
|
96
|
+
@db[table_name.to_sym].where(id: ids).delete
|
97
|
+
end
|
98
|
+
|
92
99
|
# Create default schema
|
93
100
|
def create_default_schema
|
94
101
|
db.run "CREATE EXTENSION IF NOT EXISTS vector"
|
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.10.
|
4
|
+
version: 0.10.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: 2024-03-
|
11
|
+
date: 2024-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -534,14 +534,14 @@ dependencies:
|
|
534
534
|
requirements:
|
535
535
|
- - "~>"
|
536
536
|
- !ruby/object:Gem::Version
|
537
|
-
version: '
|
537
|
+
version: '2.0'
|
538
538
|
type: :development
|
539
539
|
prerelease: false
|
540
540
|
version_requirements: !ruby/object:Gem::Requirement
|
541
541
|
requirements:
|
542
542
|
- - "~>"
|
543
543
|
- !ruby/object:Gem::Version
|
544
|
-
version: '
|
544
|
+
version: '2.0'
|
545
545
|
- !ruby/object:Gem::Dependency
|
546
546
|
name: pinecone
|
547
547
|
requirement: !ruby/object:Gem::Requirement
|
@@ -604,14 +604,14 @@ dependencies:
|
|
604
604
|
requirements:
|
605
605
|
- - "~>"
|
606
606
|
- !ruby/object:Gem::Version
|
607
|
-
version: 6.
|
607
|
+
version: 6.4.0
|
608
608
|
type: :development
|
609
609
|
prerelease: false
|
610
610
|
version_requirements: !ruby/object:Gem::Requirement
|
611
611
|
requirements:
|
612
612
|
- - "~>"
|
613
613
|
- !ruby/object:Gem::Version
|
614
|
-
version: 6.
|
614
|
+
version: 6.4.0
|
615
615
|
- !ruby/object:Gem::Dependency
|
616
616
|
name: safe_ruby
|
617
617
|
requirement: !ruby/object:Gem::Requirement
|