llamafile 0.2.6 → 0.2.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8591a8cbd7dfaf3799c959a27dd62a06ee9793103d8b0a98783e519c24952639
4
- data.tar.gz: b6c542da6521328ca54823dda1e0ea24a3443bd3c6f19dc70a25602549e4b554
3
+ metadata.gz: 732bcf92c7328ef860a5c90eb93bab485fd8bf9102b7ea5bc8678f2de611d788
4
+ data.tar.gz: e013ecee56bdfa7ae3b3a9ffa80efaf5cb43d46993a2dd722794450bf222bab1
5
5
  SHA512:
6
- metadata.gz: b9b531e4f5b9ab80c326f84bd9aca1b2f2d2be2e98579e468cd96248d495970424117021e9c812030b5ad944de0d352675759de3868d83307ea2e20e6a13d301
7
- data.tar.gz: 21fd0ef2e98db95c47cb6d88f0bdcaad13bc301cca27aedadde0f12a72ac20fd1cf42e555daeb48077f7390aa07c3efd45f788f36335d73b285ff8833c3322be
6
+ metadata.gz: c00743818ea5034730dd6fb83ec797e64125ad1c5864bd75b2be6cba9b3daf919f46280a4e612db5bd6fa695f863ff88b2b4ff216b7ca70be6814778fe8ff057
7
+ data.tar.gz: 8e1396597a164c786997a78c454de5bd57ef5f4a5db0d9b06e10338e7479e10ee8b21ddde67b8f6aa49df3ff1db3a22f1e162d6c57d0e4c20113ffe7648e3bfb
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Llamafile
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.7"
5
5
  end
data/lib/llamafile.rb CHANGED
@@ -19,53 +19,10 @@ module Lf
19
19
  def self.if? h={}
20
20
  LLAMA.if?(h)
21
21
  end
22
-
23
- @@C = Hash.new { |h,k| h[k] = C.new(k) }
24
- class C
25
- attr_accessor :character, :actor, :example, :format
26
- attr_reader :output, :input, :history
27
- def initialize k
28
- @id = k
29
- @input = ""
30
- @output = ""
31
- @character = %[a helpful and honest personal assistant.]
32
- @actor = %[an honest person.]
33
- @format = %[Format your response as properly formatted markdown.]
34
- @example = %[# this is a heading\nThis is some general text about the heading.\n1. list item one.\n2. list item two.\n3. list item three.]
35
- @history = [["Hello","Hi."]]
36
- end
37
- def conversation
38
- o = @history.map { |e| %[User: #{e[0]}\nLlama: #{e[1]}] };
39
- return o.join("\n\n")
40
- end
41
- def prompt
42
- %[Llama is #{@character}\nUser is #{@actor}\n#{@format}\nUse this example to guide your response:\n#{@example}\n#{conversation}]
43
- end
44
- def << i
45
- chain i
46
- end
47
- def chain *p
48
- [p].flatten.compact.each { |e|
49
- puts %[<-- #{e}]
50
- @history << [ e, Lf.make("<%= params[:output] %>\n<%= params[:input] %>", output: prompt, input: e)]
51
- @output = @history[-1][1]
52
- puts %[--> #{@output}]
53
- @input = e
54
- }
55
- return @output
56
- end
57
- end
58
- def self.[] k
59
- @@C[k]
60
- end
61
- def self.keys
62
- @@C.keys
63
- end
64
- def self.delete k
65
- @@C.delete(k)
66
- end
67
22
  end
68
23
 
24
+ require_relative "llamafile/actor"
25
+
69
26
  VOICE.hear = lambda { |tgt, voice, payload| puts %[VOICE #{tgt}: #{voice} #{payload}]; MIND.publish(%[#{tgt}/], %[Thinking like a #{voice}, #{payload}]) }
70
27
  MIND.input = lambda { |tgt, payload| puts %[THINK INPUT #{tgt}: #{payload}]; VOICE.hear(tgt, payload); }
71
28
  MIND.output = lambda { |tgt, payload| puts %[THINK OUTPUT #{tgt}: #{payload}]; }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llamafile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Olson