ai_client 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4128ef9024e8bc84820346570886aa9b3e25a4e8e442556591d45e0900cf9ea
4
- data.tar.gz: 64d339534320c27eb060b02ae927f39a829f3792319dc1cd71e3e0920d6aa0ed
3
+ metadata.gz: 7b12150b0f3f29804d520aa319a99cc71adc96f023ec99bccc0a9a6682bdba6e
4
+ data.tar.gz: 59d811a6b9de974f76672a9a1386d6efd3e4547d53ae7b4d24c532a250c00c86
5
5
  SHA512:
6
- metadata.gz: ef72dd20224bd2f887686c1c75881e8bd9195c60ac2a416c9acee3a93cf09335b852381ce3bf314cab72e9b2a7136b4d2bf3f0f622f39f55f1555500796fca17
7
- data.tar.gz: 33cc0e5fcf58ebadb5269138342f4e6c49d42604e2ee2fd22630764c1d288bfafdc3c7999467d2dfe890cd9daae573165f497bd1044d807f80d3a89e97f3de33
6
+ metadata.gz: 0beacebae38d5c2101498a59245c5112469ff8fddda2723b5d916ae6d5f731fa6e9e55de46422a6daf463242356e1575c0bbdf77612f9edf9fd05d6b4f885407
7
+ data.tar.gz: 36b2b5f5fd3d51577b31ac8cbcd57980cb7d0a912428f37e8f345764620aa02198a65b905505136ea40ea2866e274b1f8d6b9b1c9390ccd3608eaad138c37ebb
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
3
  ## Released
4
+ ### [0.2.4] - 2024-10-10
5
+ - constrained gem omniai-openai to version 1.8.3+ for access to open_router.ai
6
+ - caching models database from open_router.ai
7
+ - added class methods reset_default_config and reset_llm_data
8
+ - support for open_router.ai should be fully integrated now that omniai-openai is at version 1.8.3
9
+
10
+
4
11
  ### [0.2.3] - 2024-10-08
5
12
  - refactored the OmniAI extensions for Ollama, LocalAI and OpenRouter
6
13
  - added a file for OpenRouter extensions
@@ -14,7 +14,7 @@
14
14
  binmode: false
15
15
  reraise_write_errors: []
16
16
  mon_data: !ruby/object:Monitor {}
17
- mon_data_owner_object_id: 700
17
+ mon_data_owner_object_id: 45380
18
18
  level_override: {}
19
19
  :timeout:
20
20
  :return_raw: false
@@ -119,6 +119,11 @@ class AiClient
119
119
  yield(class_config)
120
120
  end
121
121
 
122
+ def reset_default_config
123
+ initialize_defaults
124
+ .save(Config::DEFAULT_CONFIG_FILEPATH)
125
+ end
126
+
122
127
  private
123
128
 
124
129
  def initialize_defaults
data/lib/ai_client/llm.rb CHANGED
@@ -1,26 +1,23 @@
1
1
  # lib/ai_client/llm.rb
2
2
 
3
3
  require 'active_hash'
4
+ require 'yaml'
4
5
 
5
- class AiClient
6
-
7
- # TODO: Think about this for the OpenRouter modesl DB
8
- # Might cahnge this to ActiveYaml
9
6
 
7
+ class AiClient
10
8
  class LLM < ActiveHash::Base
11
- self.data = AiClient.models
9
+ DATA_PATH = Pathname.new( __dir__ + '/models.yml')
10
+ self.data = YAML.parse(DATA_PATH.read).to_ruby
12
11
 
13
12
  def model = id.split('/')[1]
14
13
  def provider = id.split('/')[0]
14
+ end
15
15
 
16
- class << self
17
- def import(path_to_uml_file) # TODO: load
18
- raise "TODO: Not Implemented: #{path_to_yml_file}"
19
- end
20
-
21
- def export(path_to_uml_file) # TODO: Dump
22
- raise "TODO: Not Implemented: #{path_to_yml_file}"
23
- end
16
+ class << self
17
+ def reset_llm_data
18
+ orc_models = AiClient.orc_client.models
19
+ AiClient::LLM.data = orc_models
20
+ AiClient::LLM::DATA_PATH.write(orc_models.to_yaml)
24
21
  end
25
22
  end
26
23
  end