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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bab0a835c9ce12e44b4c5f0d4252eb3040e0d5cb3336aeefe24856f59a74a2a9
4
- data.tar.gz: a627a3d18b19a86785a1c70d95304b5bc8ab820766faf15f7893a79d563aeb44
3
+ metadata.gz: dddd7ebf694f48f5d75ff062990bdec4f4e2c1188af7f958fe12a6856928c103
4
+ data.tar.gz: ea361dc698c42d8c8c37318e0e98300d7fb416e31de53d2b4f3ab05882bf480d
5
5
  SHA512:
6
- metadata.gz: 0cd66977d719fb4bf752b96c9d5fcaeb1d776fda9d3f929366b4ac41a9913f2e16de6cb1454f0116214f1a7b404b815506f3e0375ac781f5ef2304aa01e54b6c
7
- data.tar.gz: 8c39fea57e23ce2c39a926b039c01e132482237a5c9e6af4fd1bd9de20b884845f05930be747a202f5a3982fe22bbf2f3e308f9f605d934c9897b57b095c72c0
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
- # Make `context` method available within the instance
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
@@ -22,7 +22,7 @@ module L
22
22
  end
23
23
 
24
24
  # Generate a response with support for structured output
25
- def chat(user_message, system_message = nil)
25
+ def chat(user_message, system_message = nil, _ = nil)
26
26
  schema = schema(settings)
27
27
  response = client.chat(
28
28
  parameters: {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lammy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Nicieja