ruby_llm-providers-typesafe 0.1.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.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/.flayignore +1 -0
  3. data/.github/workflows/ci.yml +32 -0
  4. data/.github/workflows/gitleaks.yml +22 -0
  5. data/.github/workflows/release.yml +33 -0
  6. data/.overcommit.yml +31 -0
  7. data/.rspec +2 -0
  8. data/.rubocop.yml +35 -0
  9. data/Archspec.rb +23 -0
  10. data/LICENSE +21 -0
  11. data/README.md +84 -0
  12. data/lib/ruby_llm/providers/typesafe/system_one/evaluations.rb +95 -0
  13. data/lib/ruby_llm/providers/typesafe/system_one/models.rb +35 -0
  14. data/lib/ruby_llm/providers/typesafe/system_one/rerank.rb +57 -0
  15. data/lib/ruby_llm/providers/typesafe/system_one.rb +19 -0
  16. data/lib/ruby_llm/providers/typesafe.rb +68 -0
  17. data/lib/ruby_llm/typesafe/evaluation.rb +75 -0
  18. data/lib/ruby_llm/typesafe/questions.rb +74 -0
  19. data/lib/ruby_llm/typesafe.rb +47 -0
  20. data/models.json +62 -0
  21. data/spec/fixtures/vcr_cassettes/rubyllm_rerank_typesafe_jev_latest_orders_documents_by_relevance.yml +49 -0
  22. data/spec/fixtures/vcr_cassettes/rubyllm_typesafe_evaluation_typesafe_jev_latest_answers_noul_choice_and_score_questions.yml +46 -0
  23. data/spec/ruby_llm/models_spec.rb +11 -0
  24. data/spec/ruby_llm/providers/typesafe/system_one_spec.rb +162 -0
  25. data/spec/ruby_llm/providers/typesafe_spec.rb +58 -0
  26. data/spec/ruby_llm/rerank_request_spec.rb +38 -0
  27. data/spec/ruby_llm/rerank_spec.rb +23 -0
  28. data/spec/ruby_llm/typesafe/evaluation_spec.rb +27 -0
  29. data/spec/ruby_llm/typesafe_spec.rb +60 -0
  30. data/spec/spec_helper.rb +26 -0
  31. data/spec/support/models.rb +9 -0
  32. data/spec/support/rubyllm_configuration.rb +14 -0
  33. data/spec/support/vcr_configuration.rb +16 -0
  34. metadata +91 -0
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'dotenv/load'
5
+ require 'fileutils'
6
+
7
+ require 'vcr'
8
+ require 'ruby_llm/providers/typesafe'
9
+ require 'webmock/rspec'
10
+
11
+ Dir[File.expand_path('support/**/*.rb', __dir__)].each { |file| require file }
12
+
13
+ RSpec.configure do |config|
14
+ config.disable_monkey_patching!
15
+ config.expect_with(:rspec) { |expectations| expectations.syntax = :expect }
16
+ config.order = :random
17
+ Kernel.srand config.seed
18
+
19
+ config.around(:each, :live) do |example|
20
+ cassette_name = example.full_description.downcase.gsub(/[^a-z0-9]+/, '_').delete_prefix('_').delete_suffix('_')
21
+ cassette_path = File.join(VCR.configuration.cassette_library_dir, "#{cassette_name}.yml")
22
+
23
+ VCR.use_cassette(cassette_name) { example.run }
24
+ FileUtils.rm_f(cassette_path) if example.exception
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ PROVIDER = :typesafe
4
+ RERANK_MODELS = [{ provider: :typesafe, model: 'jev-latest' }].freeze
5
+ EVALUATION_MODELS = RERANK_MODELS
6
+
7
+ def each_model(models)
8
+ models.each { |model_info| yield model_info[:provider], model_info[:model], model_info }
9
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_context 'with configured RubyLLM' do
4
+ before do
5
+ RubyLLM.configure do |config|
6
+ config.typesafe_api_key = ENV.fetch('TYPESAFE_API_KEY', 'test')
7
+ config.typesafe_api_base = ENV.fetch('TYPESAFE_API_BASE', 'https://api.typesafe.ai')
8
+ config.max_retries = 0
9
+ config.retry_backoff_factor = 0
10
+ config.retry_interval = 0
11
+ config.retry_interval_randomness = 0
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ VCR.configure do |config|
4
+ config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
5
+ config.hook_into :webmock
6
+ config.default_cassette_options = { record: ENV['CI'] ? :none : :once }
7
+ config.allow_http_connections_when_no_cassette = true
8
+ config.filter_sensitive_data('<TYPESAFE_API_KEY>') { ENV.fetch('TYPESAFE_API_KEY', nil) }
9
+ config.filter_sensitive_data('<TYPESAFE_API_BASE>') { ENV.fetch('TYPESAFE_API_BASE', 'https://api.typesafe.ai') }
10
+
11
+ config.before_record do |interaction|
12
+ next unless interaction.request.headers['Authorization']
13
+
14
+ interaction.request.headers['Authorization'] = ['Bearer <AUTH_TOKEN>']
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_llm-providers-typesafe
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Javier Gradiche
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ruby_llm
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 2.0.0.rc1
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 2.0.0.rc1
26
+ description: Typed judgments and reranking with the TypeSafe Jev model through RubyLLM.
27
+ email:
28
+ - javiergradiche@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".flayignore"
34
+ - ".github/workflows/ci.yml"
35
+ - ".github/workflows/gitleaks.yml"
36
+ - ".github/workflows/release.yml"
37
+ - ".overcommit.yml"
38
+ - ".rspec"
39
+ - ".rubocop.yml"
40
+ - Archspec.rb
41
+ - LICENSE
42
+ - README.md
43
+ - lib/ruby_llm/providers/typesafe.rb
44
+ - lib/ruby_llm/providers/typesafe/system_one.rb
45
+ - lib/ruby_llm/providers/typesafe/system_one/evaluations.rb
46
+ - lib/ruby_llm/providers/typesafe/system_one/models.rb
47
+ - lib/ruby_llm/providers/typesafe/system_one/rerank.rb
48
+ - lib/ruby_llm/typesafe.rb
49
+ - lib/ruby_llm/typesafe/evaluation.rb
50
+ - lib/ruby_llm/typesafe/questions.rb
51
+ - models.json
52
+ - spec/fixtures/vcr_cassettes/rubyllm_rerank_typesafe_jev_latest_orders_documents_by_relevance.yml
53
+ - spec/fixtures/vcr_cassettes/rubyllm_typesafe_evaluation_typesafe_jev_latest_answers_noul_choice_and_score_questions.yml
54
+ - spec/ruby_llm/models_spec.rb
55
+ - spec/ruby_llm/providers/typesafe/system_one_spec.rb
56
+ - spec/ruby_llm/providers/typesafe_spec.rb
57
+ - spec/ruby_llm/rerank_request_spec.rb
58
+ - spec/ruby_llm/rerank_spec.rb
59
+ - spec/ruby_llm/typesafe/evaluation_spec.rb
60
+ - spec/ruby_llm/typesafe_spec.rb
61
+ - spec/spec_helper.rb
62
+ - spec/support/models.rb
63
+ - spec/support/rubyllm_configuration.rb
64
+ - spec/support/vcr_configuration.rb
65
+ homepage: https://github.com/javiergradiche/ruby_llm-providers-typesafe
66
+ licenses:
67
+ - MIT
68
+ metadata:
69
+ homepage_uri: https://github.com/javiergradiche/ruby_llm-providers-typesafe
70
+ source_code_uri: https://github.com/javiergradiche/ruby_llm-providers-typesafe
71
+ changelog_uri: https://github.com/javiergradiche/ruby_llm-providers-typesafe/releases
72
+ bug_tracker_uri: https://github.com/javiergradiche/ruby_llm-providers-typesafe/issues
73
+ rubygems_mfa_required: 'true'
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '3.1'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubygems_version: 3.6.9
89
+ specification_version: 4
90
+ summary: TypeSafe System One models, such as Jev, for RubyLLM.
91
+ test_files: []