foobara-ai 1.0.4 → 1.0.5
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/CHANGELOG.md +5 -0
- data/src/foobara/ai/answer_bot/domain_mappers/anthropic_api/chat_to_create_message.rb +5 -10
- data/src/foobara/ai/answer_bot/domain_mappers/model_to_ai_service.rb +2 -2
- data/src/foobara/ai/answer_bot/domain_mappers/ollama_api/chat_to_generate_chat_completion.rb +3 -2
- data/src/foobara/ai/answer_bot/domain_mappers/open_ai_api/chat_to_generate_chat_completion.rb +17 -13
- data/src/foobara/ai/answer_bot/domain_mappers/service_to_command.rb +2 -2
- data/src/foobara/ai/answer_bot/domain_mappers/service_to_list_models_command.rb +2 -2
- data/src/foobara/ai/answer_bot/generate_next_message.rb +1 -1
- data/src/foobara/ai/answer_bot/types/model_enum.rb +2 -2
- data/src/foobara/ai.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 97027ea41c3a72b3bc242c6aeae9e91a4d8631320c1f43e5c42cc9830df2eb04
|
|
4
|
+
data.tar.gz: 7d991b95c1ea8cf2db63fb46934d3516b23c0271dd9f452b557032916ae8b14e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86b3ee6a3f145e2a76580cbd96ced441d4060083126f420334e08d51f27ce22cfaea96adeba1eb39970087132dca22beb6950a1e168b44ef641d1823f0df4f93
|
|
7
|
+
data.tar.gz: 18f3281c42615b4b4f5b4c6948fd36d323e07f3e0cb1afd8a451f4439d1f17c6c5885f796a24a12ed63320b0cf0c9e45a8d4bba256ebe3cad2b75d05f3eaa746
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [1.0.5] - 2026-09-22
|
|
2
|
+
|
|
3
|
+
- Fix generate next message domain mapper selection problems using domain-specific model_enum
|
|
4
|
+
- Make temperature optional/removed to deal with API changes/complications added to the API by Anthropic and OpenAI
|
|
5
|
+
|
|
1
6
|
## [1.0.4] - 2025-11-10
|
|
2
7
|
|
|
3
8
|
- Allow disabling automatic loading of AI services
|
|
@@ -6,10 +6,13 @@ module Foobara
|
|
|
6
6
|
module DomainMappers
|
|
7
7
|
module AnthropicApi
|
|
8
8
|
class ChatToCreateMessage < Foobara::DomainMapper
|
|
9
|
+
# TODO: why doesn't this have a model?
|
|
9
10
|
from do
|
|
10
11
|
chat Types::Chat, :required
|
|
11
|
-
temperature
|
|
12
|
-
|
|
12
|
+
# NOTE: temperature is not supported by Anthropic these days and it is ignored
|
|
13
|
+
temperature :float, :allow_nil, "temperature is not supported by Anthropic these days and it is ignored"
|
|
14
|
+
# TODO: shouldn't this be in Types prefix??
|
|
15
|
+
model :"Foobara::Ai::AnthropicApi::model_enum"
|
|
13
16
|
end
|
|
14
17
|
to Foobara::Ai::AnthropicApi::CreateMessage
|
|
15
18
|
|
|
@@ -26,10 +29,6 @@ module Foobara
|
|
|
26
29
|
inputs[:system] = system_messages.map(&:content).join("\n")
|
|
27
30
|
end
|
|
28
31
|
|
|
29
|
-
if temperature
|
|
30
|
-
inputs[:temperature] = temperature
|
|
31
|
-
end
|
|
32
|
-
|
|
33
32
|
if model
|
|
34
33
|
inputs[:model] = model
|
|
35
34
|
end
|
|
@@ -41,10 +40,6 @@ module Foobara
|
|
|
41
40
|
from[:chat]
|
|
42
41
|
end
|
|
43
42
|
|
|
44
|
-
def temperature
|
|
45
|
-
from[:temperature]
|
|
46
|
-
end
|
|
47
|
-
|
|
48
43
|
def model
|
|
49
44
|
from[:model]
|
|
50
45
|
end
|
data/src/foobara/ai/answer_bot/domain_mappers/ollama_api/chat_to_generate_chat_completion.rb
CHANGED
|
@@ -8,8 +8,9 @@ module Foobara
|
|
|
8
8
|
class ChatToGenerateChatCompletion < Foobara::DomainMapper
|
|
9
9
|
from do
|
|
10
10
|
chat Types::Chat, :required
|
|
11
|
-
temperature :float
|
|
12
|
-
|
|
11
|
+
temperature :float, :allow_nil
|
|
12
|
+
# TODO: shouldn't this be in Types prefix??
|
|
13
|
+
model :"Foobara::Ai::OllamaApi::model_enum"
|
|
13
14
|
end
|
|
14
15
|
to Foobara::Ai::OllamaApi::GenerateChatCompletion
|
|
15
16
|
|
data/src/foobara/ai/answer_bot/domain_mappers/open_ai_api/chat_to_generate_chat_completion.rb
CHANGED
|
@@ -8,8 +8,12 @@ module Foobara
|
|
|
8
8
|
class ChatToGenerateChatCompletion < Foobara::DomainMapper
|
|
9
9
|
from do
|
|
10
10
|
chat Types::Chat, :required
|
|
11
|
-
temperature
|
|
12
|
-
|
|
11
|
+
# NOTE: ignoring temperature for now to prevent breakage
|
|
12
|
+
# TODO: either figure out a deterministic way to know if temperature should be dropped
|
|
13
|
+
# or a way to react to the error with a retry when it happens.
|
|
14
|
+
temperature :float, :allow_nil
|
|
15
|
+
# TODO: shouldn't this be in Types prefix??
|
|
16
|
+
model :"Foobara::Ai::OpenAiApi::model_enum"
|
|
13
17
|
end
|
|
14
18
|
to Foobara::Ai::OpenAiApi::CreateChatCompletion
|
|
15
19
|
|
|
@@ -20,11 +24,11 @@ module Foobara
|
|
|
20
24
|
end
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
if temperature
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
end
|
|
27
|
+
# if temperature
|
|
28
|
+
# # NOTE: some models don't support temperature, like o1. Instead of possibly receiving an error
|
|
29
|
+
# # we will set the temperature to 1 which prevents a 400. Maybe print a warning instead?
|
|
30
|
+
# inputs[:temperature] = model_supports_temperature? ? temperature : 1
|
|
31
|
+
# end
|
|
28
32
|
|
|
29
33
|
if model
|
|
30
34
|
inputs[:model] = model
|
|
@@ -37,17 +41,17 @@ module Foobara
|
|
|
37
41
|
from[:chat]
|
|
38
42
|
end
|
|
39
43
|
|
|
40
|
-
def temperature
|
|
41
|
-
|
|
42
|
-
end
|
|
44
|
+
# def temperature
|
|
45
|
+
# from[:temperature]
|
|
46
|
+
# end
|
|
43
47
|
|
|
44
48
|
def model
|
|
45
49
|
from[:model]
|
|
46
50
|
end
|
|
47
51
|
|
|
48
|
-
def model_supports_temperature?
|
|
49
|
-
|
|
50
|
-
end
|
|
52
|
+
# def model_supports_temperature?
|
|
53
|
+
# model && model.to_s !~ /\Ao[13](-|$)/
|
|
54
|
+
# end
|
|
51
55
|
end
|
|
52
56
|
end
|
|
53
57
|
end
|
|
@@ -8,7 +8,7 @@ module Foobara
|
|
|
8
8
|
chat Types::Chat, :required
|
|
9
9
|
service :service_enum, "If two services expose the same model, you can specify which one to use."
|
|
10
10
|
model :model_enum, default: Ai.default_llm_model, description: "The model to use."
|
|
11
|
-
temperature :float
|
|
11
|
+
temperature :float, :allow_nil
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
result Types::Message
|
|
@@ -28,11 +28,11 @@ module Foobara
|
|
|
28
28
|
# models = threads.each(&:join).map(&:value).flatten
|
|
29
29
|
|
|
30
30
|
unless models.uniq == models
|
|
31
|
-
# :
|
|
31
|
+
# simplecov:disable
|
|
32
32
|
# TODO: we should return something more complicated than a bare list of strings. Either a more
|
|
33
33
|
# robust object or prefix strings with the relevant service to handle collisions.
|
|
34
34
|
raise "Duplicate models detected"
|
|
35
|
-
# :
|
|
35
|
+
# simplecov:enable
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
ModelEnum = Foobara::Enumerated.make_module(models)
|
data/src/foobara/ai.rb
CHANGED
|
@@ -33,10 +33,10 @@ module Foobara
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
if @ai_services.empty? && ENV["SKIP_AI_SERVICES"] != "true"
|
|
36
|
-
# :
|
|
36
|
+
# simplecov:disable
|
|
37
37
|
require "foobara/anthropic_api"
|
|
38
38
|
@ai_services = { AnswerBot::Types::ServiceEnum::ANTHROPIC => AnthropicApi }
|
|
39
|
-
# :
|
|
39
|
+
# simplecov:enable
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
@ai_services
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foobara-ai
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miles Georgi
|
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
73
|
version: '0'
|
|
74
74
|
requirements: []
|
|
75
|
-
rubygems_version:
|
|
75
|
+
rubygems_version: 4.0.20
|
|
76
76
|
specification_version: 4
|
|
77
77
|
summary: No description. Add one.
|
|
78
78
|
test_files: []
|