sublayer 0.0.1 → 0.0.2
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/README.md +7 -3
- 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: cb6358bd6d422e0f622348c8eaf86d80b42083e22cbae800f7a8d9afc4805a76
|
|
4
|
+
data.tar.gz: ddce248ed595c54991d725a44f5c52db3c548db4743be50562f6931ec5cd2912
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96d7ba5dd91cdf4d4107c4017f0e572bdb483450816c6838b5d2f80e9ee9849501f3f522431b19c72afb2e9a019f76556999d4d5c2999987019d78b9f6251eeb
|
|
7
|
+
data.tar.gz: 726950c1e36fe621fdf16da04e835e241c41fe648dfb7404ab148cd5b0a3567eb495ad620a9ba6ebe8d4910b9d42eea87073294da83fb19814422d59b843ba31
|
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.2
|
|
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-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ruby-openai
|