sublayer 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -3
- data/lib/sublayer/generators/base.rb +0 -1
- data/lib/sublayer/providers/local.rb +17 -22
- data/lib/sublayer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ad3ab932b7da063821a5f9047d6a58e895fb5db1b34ca71ef8a7742ccddd7dc
|
4
|
+
data.tar.gz: ef15f73fd28e091667f1316f60b5b0c882240d1897f57b806e001dc3c885e3cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b606328f717c6312fde90b91b6bed4d58cacc0ae266199a6287b72f4da8aa0fcc3c01ffb28aff19043b81c2e7a3891e628db9c8f373cb14e359385e617e4bd76
|
7
|
+
data.tar.gz: b4fec2575647858bae068d41117e5842438e5ec8d1e8303a12a613cec913b11d6b8ff261fd84d276b874c19c4f1aea0fef3d94748bbebc443134ba0cb84c91e8
|
data/README.md
CHANGED
@@ -65,14 +65,18 @@ Sublayer.configuration.ai_provider = Sublayer::Providers::Groq
|
|
65
65
|
Sublayer.configuration.ai_model = "mixtral-8x7b-32768"
|
66
66
|
```
|
67
67
|
|
68
|
-
### Local
|
68
|
+
### Local (Experimental with Hermes2)
|
69
|
+
|
70
|
+
*Tested against the latest [Hermes 2 Mistral
|
71
|
+
Model](https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF)*
|
69
72
|
|
70
73
|
Support for running a local model and serving an API on https://localhost:8080
|
71
74
|
|
72
75
|
The simplest way to do this is to download
|
73
76
|
[llamafile](https://github.com/Mozilla-Ocho/llamafile) and download one of the
|
74
|
-
server llamafiles they provide.
|
75
|
-
|
77
|
+
server llamafiles they provide.
|
78
|
+
|
79
|
+
We've also tested with [Hermes 2 Mistral](https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF) from
|
76
80
|
[Nous
|
77
81
|
Research](https://nousresearch.com/).
|
78
82
|
|
@@ -4,29 +4,25 @@
|
|
4
4
|
module Sublayer
|
5
5
|
module Providers
|
6
6
|
class Local
|
7
|
-
def
|
7
|
+
def self.call(prompt:, output_adapter:)
|
8
8
|
system_prompt = <<-PROMPT
|
9
|
-
|
10
|
-
|
11
|
-
You
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
...
|
18
|
-
</parameters>
|
19
|
-
</invoke>
|
20
|
-
</function_calls>
|
21
|
-
|
22
|
-
Here are the tools available:
|
9
|
+
You are a function calling AI agent
|
10
|
+
You can call only one function at a time
|
11
|
+
You are provided with function signatures within <tools></tools> XML tags.
|
12
|
+
|
13
|
+
Please call a function and wait for results to be provided to you in the next iteration.
|
14
|
+
Don't make assumptions about what values to plug into function arguments.
|
15
|
+
|
16
|
+
Here are the available tools:
|
23
17
|
<tools>
|
24
|
-
#{output_adapter.
|
18
|
+
#{output_adapter.to_hash.to_json}
|
25
19
|
</tools>
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
For the function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
|
22
|
+
|
23
|
+
<tool_call>
|
24
|
+
{"arguments": <args-dict>, "name": <function-name>}
|
25
|
+
</tool_call>
|
30
26
|
PROMPT
|
31
27
|
|
32
28
|
response = HTTParty.post(
|
@@ -45,9 +41,8 @@ module Sublayer
|
|
45
41
|
)
|
46
42
|
|
47
43
|
text_containing_xml = JSON.parse(response.body).dig("choices", 0, "message", "content")
|
48
|
-
|
49
|
-
|
50
|
-
function_output = response_xml.at_xpath("//parameters/#{output_adapter.name}").children.to_s
|
44
|
+
results = JSON.parse(::Nokogiri::XML(text_containing_xml).at_xpath("//tool_call").children.to_s.strip)
|
45
|
+
function_output = results["arguments"][output_adapter.name]
|
51
46
|
|
52
47
|
return function_output
|
53
48
|
end
|
data/lib/sublayer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sublayer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Werner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-openai
|