active_pinecone 0.1.2 → 0.1.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/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/lib/active_pinecone/assistant.rb +4 -3
- data/lib/active_pinecone/base.rb +2 -2
- data/lib/active_pinecone/version.rb +1 -1
- metadata +1 -2
- data/CHANGELOG.md +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ee5de085e7ff280125a077b337f5c9bf7ad774a3f609bb8d56cf8f79a70104d
|
|
4
|
+
data.tar.gz: 9dc48681b7b3ea98950d0cb56461f805bf102c32e199bfe5a8e9af149c9284d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92c38c0c0170ac5abac13aa0492cf067c9b27da234d79fe763dc3f4039dfb4e4d5c842ab5b98965fc8c338a0572a3eedf134e79337c17daedb0d8811462dc573
|
|
7
|
+
data.tar.gz: 4ff83a4e9c148212ead0546b322231ee84ba22f8690fd2a5c95a1e11b7836225523bbf71924e01c9a66e844f2f576cfad02bb1326040f3d50fc1a10559a79cb2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -85,7 +85,10 @@ p recipes.first.title
|
|
|
85
85
|
Assistant search vector data by **ALL** conversation history and reply.
|
|
86
86
|
|
|
87
87
|
```ruby
|
|
88
|
-
assistant = Recipe.assistant
|
|
88
|
+
assistant = Recipe.assistant([
|
|
89
|
+
"You are the assistant who answers the user's questions about the recipe.",
|
|
90
|
+
"The list of recipes is as follows:"
|
|
91
|
+
].join("\n"))
|
|
89
92
|
|
|
90
93
|
reply = assistant.reply("How to make a hamburger?")
|
|
91
94
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
module ActivePinecone
|
|
2
2
|
class Assistant
|
|
3
|
-
attr_reader :model
|
|
3
|
+
attr_reader :model, :instruction
|
|
4
4
|
|
|
5
|
-
def initialize(model)
|
|
5
|
+
def initialize(model, instruction: 'Context:')
|
|
6
6
|
@model = model
|
|
7
|
+
@instruction = instruction
|
|
7
8
|
@messages_with_system = [{ role: 'system', content: '' }]
|
|
8
9
|
end
|
|
9
10
|
|
|
@@ -20,7 +21,7 @@ module ActivePinecone
|
|
|
20
21
|
|
|
21
22
|
records = model.search(messages.pluck(:content))
|
|
22
23
|
|
|
23
|
-
@messages_with_system[0][:content] =
|
|
24
|
+
@messages_with_system[0][:content] = [instruction, records.map(&:attributes).to_json].join("\n")
|
|
24
25
|
|
|
25
26
|
result = self.class.openai.chat(
|
|
26
27
|
parameters: { model: ActivePinecone.configuration.chat_model, messages: messages, temperature: 0.7 }
|
data/lib/active_pinecone/base.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_pinecone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Moeki Kawakami
|
|
@@ -60,7 +60,6 @@ extensions: []
|
|
|
60
60
|
extra_rdoc_files: []
|
|
61
61
|
files:
|
|
62
62
|
- ".rspec"
|
|
63
|
-
- CHANGELOG.md
|
|
64
63
|
- CODE_OF_CONDUCT.md
|
|
65
64
|
- Gemfile
|
|
66
65
|
- Gemfile.lock
|