File tree Expand file tree Collapse file tree 5 files changed +22
-15
lines changed
src/foobara/ai/answer_bot Expand file tree Collapse file tree 5 files changed +22
-15
lines changed Original file line number Diff line number Diff line change 1- ## [ 0.0.5 ] - 2025-03-04
1+ ## [ 0.0.6 ] - 2025-03-04
22
33- Do not require all 3 services to function. Let user require which services they want to use.
44
Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- foobara-ai (0.0.5 )
4+ foobara-ai (0.0.6 )
55 foobara-anthropic-api
66 foobara-ollama-api
77 foobara-open-ai-api
Original file line number Diff line number Diff line change @@ -7,10 +7,7 @@ module Ai
77 module AnswerBot
88 foobara_domain!
99
10- base_dir = "#{ __dir__ } /../../src/foobara/ai/answer_bot"
11- Util . require_directory "#{ base_dir } /types"
12- Dir [ "#{ base_dir } /domain_mappers/*.rb" ] . each { |f | require f }
13- Dir [ "#{ base_dir } /*.rb" ] . each { |f | require f }
10+ require_relative "../../src/foobara/ai/answer_bot/types/service_enum"
1411
1512 ai_services = { }
1613
@@ -26,12 +23,19 @@ module AnswerBot
2623
2724 ai_services [ service ] = domain
2825 foobara_depends_on domain
29-
30- path = Util . underscore ( domain . foobara_domain_name )
31- Util . require_directory "#{ __dir__ } /../../src/foobara/ai/answer_bot/domain_mappers/#{ path } "
3226 end
3327
3428 AI_SERVICES = ai_services
29+
30+ base_dir = "#{ __dir__ } /../../src/foobara/ai/answer_bot"
31+ Util . require_directory "#{ base_dir } /types"
32+ Dir [ "#{ base_dir } /domain_mappers/*.rb" ] . each { |f | require f }
33+ Dir [ "#{ base_dir } /*.rb" ] . each { |f | require f }
34+
35+ AI_SERVICES . each_value do |domain |
36+ path = Util . underscore ( domain . foobara_domain_name )
37+ Util . require_directory "#{ base_dir } /domain_mappers/#{ path } "
38+ end
3539 end
3640 end
3741end
Original file line number Diff line number Diff line change 1+ require_relative "types/service_enum"
12require_relative "types/model"
23
34module Foobara
@@ -8,11 +9,13 @@ class ListModels < Foobara::Command
89
910 result [ Types ::Model ]
1011
11- LIST_COMMANDS = [
12- OpenAiApi ::ListModels ,
13- AnthropicApi ::ListModels ,
14- OllamaApi ::ListLocalModels
15- ] . freeze
12+ LIST_COMMANDS = AI_SERVICES . values . map do |domain |
13+ if domain == OllamaApi
14+ OllamaApi ::ListLocalModels
15+ else
16+ domain ::ListModels
17+ end
18+ end
1619
1720 depends_on ( *LIST_COMMANDS )
1821
Original file line number Diff line number Diff line change 11module Foobara
22 module Ai
3- VERSION = "0.0.5 " . freeze
3+ VERSION = "0.0.6 " . freeze
44
55 local_ruby_version = File . read ( "#{ __dir__ } /.ruby-version" ) . chomp
66 local_ruby_version_minor = local_ruby_version [ /\A (\d +\. \d +)\. \d +\z / , 1 ]
You can’t perform that action at this time.
0 commit comments