rager 0.7.0 → 0.8.0
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 +20 -22
- data/lib/rager/context.rb +3 -3
- data/lib/rager/context_options.rb +1 -1
- data/lib/rager/options.rb +0 -0
- data/lib/rager/outcome.rb +1 -1
- data/lib/rager/providers.rb +10 -10
- data/lib/rager/version.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: 2db5c90419613081d3292daff1f7d16ef7a5c9e5b459dfcd3e78226ebc86538b
|
4
|
+
data.tar.gz: e43d6a988df3da33390e3b278b77eb44967aad6f667c2c4b604ee61fab30261f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 490172cb198dfd79c391b56fadebc44124f766334b19cc9c79997c08f82351a71834e0a647e758ed63fd2ff0a4837da61527e8ee19b451a258f9e66b44b334b3
|
7
|
+
data.tar.gz: a37fe08071870f6dd9cce48db5f45dd3af0ae2e42e1aaeabc3bd12deac2d6746e6108035f9e64c6be12f39bdd0a8ee35c57dfe8f4a679c84b157e65887664508
|
data/README.md
CHANGED
@@ -8,14 +8,30 @@
|
|
8
8
|
|
9
9
|
Build continuously improving generative workflows.
|
10
10
|
|
11
|
-
|
11
|
+
## Logging
|
12
|
+
|
13
|
+
Why yet another library? The main reason is to have an out-of-the-box logging server that records workflows and outcomes to use in few-shot prompts and fine-tuning. It’s live at [`rager.cloud`](https://rager.cloud), though public signups are paused until I roll out usage-based billing.
|
14
|
+
|
15
|
+
## Providers
|
16
|
+
|
17
|
+
Modalities that take a URL parameter (chat, embedding, rerank) support compatible services, allowing you to use alternative providers that support the interface.
|
18
|
+
|
19
|
+
| Feature | Providers |
|
20
|
+
| ---------------------- | ---------------- |
|
21
|
+
| **Chat** | `openai` |
|
22
|
+
| **Embedding** | `openai` |
|
23
|
+
| **Image generation** | `replicate` |
|
24
|
+
| **3D mesh generation** | `replicate` |
|
25
|
+
| **Reranking** | `cohere` |
|
26
|
+
| **Search** | `jina` |
|
27
|
+
| **Templating** | `erb`,`mustache` |
|
12
28
|
|
13
29
|
## Installation
|
14
30
|
|
15
31
|
Add this line to your application's Gemfile:
|
16
32
|
|
17
33
|
```ruby
|
18
|
-
gem "rager", "~> 0.
|
34
|
+
gem "rager", "~> 0.8.0"
|
19
35
|
```
|
20
36
|
|
21
37
|
Or use it in a standalone script (requires OPENAI_API_KEY set):
|
@@ -26,7 +42,7 @@ require "bundler/inline"
|
|
26
42
|
gemfile do
|
27
43
|
source "https://rubygems.org"
|
28
44
|
gem "async-http", "~> 0.88.0"
|
29
|
-
gem "rager", "~> 0.
|
45
|
+
gem "rager", "~> 0.8.0"
|
30
46
|
end
|
31
47
|
|
32
48
|
require "rager"
|
@@ -39,30 +55,12 @@ PROMPT = ARGV[0] || "Ruby programming"
|
|
39
55
|
|
40
56
|
Async do
|
41
57
|
ctx = Rager::Context.new
|
42
|
-
prompt = ctx.template("Tell me about the history of <%= topic %>",{topic: PROMPT})
|
58
|
+
prompt = ctx.template("Tell me about the history of <%= topic %>", {topic: PROMPT})
|
43
59
|
chat = ctx.chat(prompt, stream: true)
|
44
60
|
chat.stream.each { |d| print d.content }
|
45
61
|
end
|
46
62
|
```
|
47
63
|
|
48
|
-
## Providers
|
49
|
-
|
50
|
-
Modalities that take a URL parameter (chat, embedding, rerank) support compatible services, allowing you to use alternative providers that support the same interface.
|
51
|
-
|
52
|
-
| Feature | Providers |
|
53
|
-
| ---------------------- | ---------------- |
|
54
|
-
| **Chat** | `openai` |
|
55
|
-
| **Embedding** | `openai` |
|
56
|
-
| **Image generation** | `replicate` |
|
57
|
-
| **3D mesh generation** | `replicate` |
|
58
|
-
| **Reranking** | `cohere` |
|
59
|
-
| **Search** | `jina` |
|
60
|
-
| **Templating** | `erb`,`mustache` |
|
61
|
-
|
62
|
-
## Logging
|
63
|
-
|
64
|
-
The main reason for creating yet another library is to have out-of-the-box logging for workflows and outcomes. The logged data can then be used for few-shot prompting and fine-tuning. This logging server is being developed at [`rager.cloud`](https://rager.cloud) and is closed while I work on it. Contact me if you would like access.
|
65
|
-
|
66
64
|
## License
|
67
65
|
|
68
66
|
[MIT](./LICENSE.md)
|
data/lib/rager/context.rb
CHANGED
@@ -375,11 +375,11 @@ module Rager
|
|
375
375
|
sig {
|
376
376
|
params(
|
377
377
|
input: T.untyped,
|
378
|
-
ids: T
|
378
|
+
ids: T::Array[String]
|
379
379
|
).returns([T.untyped, T::Array[String]])
|
380
380
|
}
|
381
|
-
def normalize(input, ids =
|
382
|
-
collected_ids =
|
381
|
+
def normalize(input, ids = [])
|
382
|
+
collected_ids = ids.to_set
|
383
383
|
visited = Set.new
|
384
384
|
|
385
385
|
normalized_input = normalize_item(input, collected_ids, visited)
|
@@ -8,7 +8,7 @@ module Rager
|
|
8
8
|
extend T::Sig
|
9
9
|
|
10
10
|
const :input_ids, T::Array[String], default: []
|
11
|
-
const :tags, T::Array[
|
11
|
+
const :tags, T::Array[String], default: []
|
12
12
|
const :name, T.nilable(String)
|
13
13
|
|
14
14
|
sig { params(kwargs: T::Hash[Symbol, T.untyped]).returns(T::Hash[Symbol, T.untyped]) }
|
data/lib/rager/options.rb
CHANGED
File without changes
|
data/lib/rager/outcome.rb
CHANGED
@@ -10,7 +10,7 @@ module Rager
|
|
10
10
|
const :context_id, String
|
11
11
|
const :value, Float
|
12
12
|
const :feedback, T.nilable(String)
|
13
|
-
const :tags, T::Array[
|
13
|
+
const :tags, T::Array[String], default: []
|
14
14
|
|
15
15
|
sig { params(options: T.untyped).returns(String) }
|
16
16
|
def to_json(options = nil)
|
data/lib/rager/providers.rb
CHANGED
@@ -9,28 +9,28 @@ module Rager
|
|
9
9
|
|
10
10
|
PROVIDERS = T.let({
|
11
11
|
Rager::Operation::Chat => {
|
12
|
-
openai:
|
12
|
+
openai: Rager::Chat::Providers::Openai
|
13
13
|
},
|
14
14
|
Rager::Operation::Embed => {
|
15
|
-
openai:
|
15
|
+
openai: Rager::Embed::Providers::Openai
|
16
16
|
},
|
17
17
|
Rager::Operation::Rerank => {
|
18
|
-
cohere:
|
18
|
+
cohere: Rager::Rerank::Providers::Cohere
|
19
19
|
},
|
20
20
|
Rager::Operation::Image => {
|
21
|
-
replicate:
|
21
|
+
replicate: Rager::Image::Providers::Replicate
|
22
22
|
},
|
23
23
|
Rager::Operation::Mesh => {
|
24
|
-
replicate:
|
24
|
+
replicate: Rager::Mesh::Providers::Replicate
|
25
25
|
},
|
26
26
|
Rager::Operation::Template => {
|
27
|
-
erb:
|
28
|
-
mustache:
|
27
|
+
erb: Rager::Template::Providers::Erb,
|
28
|
+
mustache: Rager::Template::Providers::Mustache
|
29
29
|
},
|
30
30
|
Rager::Operation::Search => {
|
31
|
-
jina:
|
31
|
+
jina: Rager::Search::Providers::Jina
|
32
32
|
}
|
33
|
-
}, T::Hash[Rager::Operation, T::Hash[Symbol, T.
|
33
|
+
}, T::Hash[Rager::Operation, T::Hash[Symbol, T.untyped]])
|
34
34
|
|
35
35
|
sig { params(operation: Rager::Operation).returns(T::Array[Symbol]) }
|
36
36
|
def self.list_providers(operation)
|
@@ -55,7 +55,7 @@ module Rager
|
|
55
55
|
)
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
operation_providers.fetch(key).new
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
data/lib/rager/version.rb
CHANGED