fino 1.5.0 → 1.5.1
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 +2 -0
- data/lib/fino/cache.rb +21 -1
- data/lib/fino/configuration.rb +19 -3
- data/lib/fino/definition/setting.rb +1 -1
- data/lib/fino/pipe/cache.rb +4 -2
- data/lib/fino/pipeline.rb +5 -11
- data/lib/fino/registry.rb +2 -2
- data/lib/fino/version.rb +1 -1
- data/lib/fino.rb +2 -3
- 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: b2b3b4a00d7564afb4a9d51b1ef35e87f0af7bafb9403a5155b0931d5f3a466d
|
|
4
|
+
data.tar.gz: 579a93663bf8401af70283bb20b95bcd2cea8af4185ed4c422604ddad8734176
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b946c8453fa1d6b09c088360420306fa16bb27b890e84967f458361f52a311bab1551f081830c1e37e073c85e0ee47d660ea9b2aeccbdb7ae9c7081eadb62118
|
|
7
|
+
data.tar.gz: e43d7a8f613bd7cc605f07d008c981021a7b593a974cf4a9f005c76d7ae5a9b7a8b498e4f8478b6cb287bcd58442198ff45a06e33fe3988b06cc016d13de79f5
|
data/README.md
CHANGED
|
@@ -74,6 +74,8 @@ Fino.set(model: "gpt-5", at: :openai, overrides: { "qa" => "our_local_model_not_
|
|
|
74
74
|
|
|
75
75
|
Fino.value(:model, at: :openai) #=> "gpt-5"
|
|
76
76
|
Fino.value(:model, at: :openai, for: "qa") #=> "our_local_model_not_to_pay_to_sam_altman"
|
|
77
|
+
|
|
78
|
+
Fino.setting(:model, at: :openai).overrides #=> { "qa" => "our_local_model_not_to_pay_to_sam_altman" }
|
|
77
79
|
```
|
|
78
80
|
|
|
79
81
|
### A/B testing
|
data/lib/fino/cache.rb
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Fino::Cache
|
|
4
|
-
def
|
|
4
|
+
def exist?(key)
|
|
5
|
+
raise NotImplementedError
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def read(key)
|
|
5
9
|
raise NotImplementedError
|
|
6
10
|
end
|
|
7
11
|
|
|
8
12
|
def write(key, value)
|
|
9
13
|
raise NotImplementedError
|
|
10
14
|
end
|
|
15
|
+
|
|
16
|
+
def fetch(key, &block)
|
|
17
|
+
raise NotImplementedError
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def fetch_multi(*keys, &block)
|
|
21
|
+
raise NotImplementedError
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def delete(key)
|
|
25
|
+
raise NotImplementedError
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def clear
|
|
29
|
+
raise NotImplementedError
|
|
30
|
+
end
|
|
11
31
|
end
|
data/lib/fino/configuration.rb
CHANGED
|
@@ -1,25 +1,41 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class Fino::Configuration
|
|
4
|
-
attr_reader :registry, :
|
|
4
|
+
attr_reader :registry, :pipeline_builder_block
|
|
5
5
|
|
|
6
6
|
def initialize(registry)
|
|
7
7
|
@registry = registry
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
def adapter_builder_block
|
|
11
|
+
@wrapped_adapter_builder_block || @adapter_builder_block
|
|
12
|
+
end
|
|
13
|
+
|
|
10
14
|
def adapter(&block)
|
|
11
15
|
@adapter_builder_block = block
|
|
12
16
|
end
|
|
13
17
|
|
|
18
|
+
def wrap_adapter(&block)
|
|
19
|
+
@wrapped_adapter_builder_block = proc { block.call(@adapter_builder_block.call) }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def cache_builder_block
|
|
23
|
+
@wrapped_cache_builder_block || @cache_builder_block
|
|
24
|
+
end
|
|
25
|
+
|
|
14
26
|
def cache(&block)
|
|
15
27
|
@cache_builder_block = block
|
|
16
28
|
end
|
|
17
29
|
|
|
30
|
+
def wrap_cache(&block)
|
|
31
|
+
@wrapped_cache_builder_block = proc { block.call(@cache_builder_block.call) }
|
|
32
|
+
end
|
|
33
|
+
|
|
18
34
|
def pipeline(&block)
|
|
19
35
|
@pipeline_builder_block = block
|
|
20
36
|
end
|
|
21
37
|
|
|
22
|
-
def settings(&)
|
|
23
|
-
Fino::Registry::DSL.new(registry).instance_eval(&)
|
|
38
|
+
def settings(&block)
|
|
39
|
+
Fino::Registry::DSL.new(registry).instance_eval(&block)
|
|
24
40
|
end
|
|
25
41
|
end
|
data/lib/fino/pipe/cache.rb
CHANGED
|
@@ -9,8 +9,10 @@ class Fino::Pipe::Cache
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def read(setting_definition)
|
|
12
|
-
cache.
|
|
13
|
-
|
|
12
|
+
return cache.read(setting_definition.key) if cache.exist?(setting_definition.key)
|
|
13
|
+
|
|
14
|
+
pipe.read(setting_definition).tap do |result|
|
|
15
|
+
cache.write(setting_definition.key, result)
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
|
data/lib/fino/pipeline.rb
CHANGED
|
@@ -8,26 +8,20 @@ class Fino::Pipeline
|
|
|
8
8
|
def initialize(storage, pipes = [])
|
|
9
9
|
@storage = storage
|
|
10
10
|
@pipes = pipes
|
|
11
|
-
@pipe_wrapper = ->(pipe) { pipe }
|
|
12
11
|
end
|
|
13
12
|
|
|
14
|
-
def use(pipe_class,
|
|
15
|
-
pipes << ->(pipe) { pipe_class.new(pipe,
|
|
16
|
-
@pipeline = nil
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def wrap(&block)
|
|
20
|
-
@pipe_wrapper = block
|
|
13
|
+
def use(pipe_class, ...)
|
|
14
|
+
pipes << ->(pipe) { pipe_class.new(pipe, ...) }
|
|
21
15
|
@pipeline = nil
|
|
22
16
|
end
|
|
23
17
|
|
|
24
18
|
private
|
|
25
19
|
|
|
26
|
-
attr_reader :storage, :pipes
|
|
20
|
+
attr_reader :storage, :pipes
|
|
27
21
|
|
|
28
22
|
def pipeline
|
|
29
|
-
@pipeline ||= pipes.inject(
|
|
30
|
-
|
|
23
|
+
@pipeline ||= pipes.inject(storage) do |pipe, builder|
|
|
24
|
+
builder.call(pipe)
|
|
31
25
|
end
|
|
32
26
|
end
|
|
33
27
|
end
|
data/lib/fino/registry.rb
CHANGED
|
@@ -37,7 +37,7 @@ class Fino::Registry
|
|
|
37
37
|
)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def section(section_name, options = {}, &)
|
|
40
|
+
def section(section_name, options = {}, &block)
|
|
41
41
|
section_definition = Fino::Definition::Section.new(
|
|
42
42
|
name: section_name,
|
|
43
43
|
**options
|
|
@@ -45,7 +45,7 @@ class Fino::Registry
|
|
|
45
45
|
|
|
46
46
|
@registry.register_section(section_definition)
|
|
47
47
|
|
|
48
|
-
SectionDSL.new(section_definition, @registry).instance_eval(&)
|
|
48
|
+
SectionDSL.new(section_definition, @registry).instance_eval(&block)
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
data/lib/fino/version.rb
CHANGED
data/lib/fino.rb
CHANGED
|
@@ -10,8 +10,7 @@ module Fino
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def reset!
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
@library = nil
|
|
15
14
|
@registry = nil
|
|
16
15
|
@configuration = nil
|
|
17
16
|
end
|
|
@@ -22,7 +21,7 @@ module Fino
|
|
|
22
21
|
end
|
|
23
22
|
|
|
24
23
|
def library
|
|
25
|
-
|
|
24
|
+
@library ||= Fino::Library.new(configuration)
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
def registry
|