lammy 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lammy/chat.rb +8 -2
- data/lib/lammy/openai.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dddd7ebf694f48f5d75ff062990bdec4f4e2c1188af7f958fe12a6856928c103
|
4
|
+
data.tar.gz: ea361dc698c42d8c8c37318e0e98300d7fb416e31de53d2b4f3ab05882bf480d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c925d41bfa4a2b66867e43e081187f76f0143775d1e2ac0044b6a243fc3aadcaec13499b9678cbc891b076ae50c9b8612999d183c987b77ae99838658f4f222d
|
7
|
+
data.tar.gz: dcfb1071b3eb78ad66e1151b2d04d4b58581d576ff211f48d2126d9d52af991abbb387bb5cdc36c925efca9ca990a8be1bf1d19767ac5b4dd5aa9d904c997077
|
data/lib/lammy/chat.rb
CHANGED
@@ -17,12 +17,18 @@ module L
|
|
17
17
|
define_method(method_name) do |*args, &block|
|
18
18
|
# Initialize context
|
19
19
|
@system_message = nil
|
20
|
+
@prefilled_message = nil
|
20
21
|
|
21
|
-
#
|
22
|
+
# `context` sets the system message and is available within the instance
|
22
23
|
define_singleton_method(:context) do |message|
|
23
24
|
@system_message = message
|
24
25
|
end
|
25
26
|
|
27
|
+
# `prefill` sets the prefilled message and is available within the instance
|
28
|
+
define_singleton_method(:prefill) do |message|
|
29
|
+
@prefilled_message = message
|
30
|
+
end
|
31
|
+
|
26
32
|
# Call the original method to get the user message
|
27
33
|
user_message = original_method.bind(self).call(*args, &block)
|
28
34
|
|
@@ -35,7 +41,7 @@ module L
|
|
35
41
|
raise "Unsupported model: #{settings[:model]}"
|
36
42
|
end
|
37
43
|
|
38
|
-
client.chat(user_message, @system_message)
|
44
|
+
client.chat(user_message, @system_message, @prefilled_message)
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|
data/lib/lammy/openai.rb
CHANGED