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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a240f204b0677aee45009f9357cea5e13b85eaa77dd9696db6e12e065f0144b4
4
- data.tar.gz: 8d31692e3d8fe5d962ff4f2a9a94817a8886dd20f01eb72cbb24189deb490365
3
+ metadata.gz: 2db5c90419613081d3292daff1f7d16ef7a5c9e5b459dfcd3e78226ebc86538b
4
+ data.tar.gz: e43d6a988df3da33390e3b278b77eb44967aad6f667c2c4b604ee61fab30261f
5
5
  SHA512:
6
- metadata.gz: 381d1ee7c8202be21536d209d3845039223709e7dd4e93c974f1970ce4b019f8538cac0bcb6cae7c8c15209e86bde9d6adb0e10d9e9b4546734744d4be7133dd
7
- data.tar.gz: 34341e107e1018810723d9bdbd5f6e0b6fc69f66daf166860aec9f4513b29827479754ba84afe07cf5e9ece45cacf23c0e34f70f8fe896fd14c2b99d86a9f878
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
- Examples are available in the [`examples/`](./examples/) folder.
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.7.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.7.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.nilable(T::Array[String])
378
+ ids: T::Array[String]
379
379
  ).returns([T.untyped, T::Array[String]])
380
380
  }
381
- def normalize(input, ids = nil)
382
- collected_ids = (ids || []).to_set
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[T.untyped], default: []
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[T.untyped], default: []
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)
@@ -9,28 +9,28 @@ module Rager
9
9
 
10
10
  PROVIDERS = T.let({
11
11
  Rager::Operation::Chat => {
12
- openai: -> { Rager::Chat::Providers::Openai.new }
12
+ openai: Rager::Chat::Providers::Openai
13
13
  },
14
14
  Rager::Operation::Embed => {
15
- openai: -> { Rager::Embed::Providers::Openai.new }
15
+ openai: Rager::Embed::Providers::Openai
16
16
  },
17
17
  Rager::Operation::Rerank => {
18
- cohere: -> { Rager::Rerank::Providers::Cohere.new }
18
+ cohere: Rager::Rerank::Providers::Cohere
19
19
  },
20
20
  Rager::Operation::Image => {
21
- replicate: -> { Rager::Image::Providers::Replicate.new }
21
+ replicate: Rager::Image::Providers::Replicate
22
22
  },
23
23
  Rager::Operation::Mesh => {
24
- replicate: -> { Rager::Mesh::Providers::Replicate.new }
24
+ replicate: Rager::Mesh::Providers::Replicate
25
25
  },
26
26
  Rager::Operation::Template => {
27
- erb: -> { Rager::Template::Providers::Erb.new },
28
- mustache: -> { Rager::Template::Providers::Mustache.new }
27
+ erb: Rager::Template::Providers::Erb,
28
+ mustache: Rager::Template::Providers::Mustache
29
29
  },
30
30
  Rager::Operation::Search => {
31
- jina: -> { Rager::Search::Providers::Jina.new }
31
+ jina: Rager::Search::Providers::Jina
32
32
  }
33
- }, T::Hash[Rager::Operation, T::Hash[Symbol, T.proc.returns(T.untyped)]])
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
- T.must(operation_providers[key]).call
58
+ operation_providers.fetch(key).new
59
59
  end
60
60
  end
61
61
  end
data/lib/rager/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Rager
5
- VERSION = "0.7.0"
5
+ VERSION = "0.8.0"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mvkvc