foobara-ai 1.0.5 → 1.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97027ea41c3a72b3bc242c6aeae9e91a4d8631320c1f43e5c42cc9830df2eb04
4
- data.tar.gz: 7d991b95c1ea8cf2db63fb46934d3516b23c0271dd9f452b557032916ae8b14e
3
+ metadata.gz: a1841b2a9e7f8e60452280abf0cbe46e592f47d1a238d913d329ab296d4b1f60
4
+ data.tar.gz: ae3fd75f6b91ba1a7ca34f47d19916d32a757dfb3e35666bf4afb6e39733cdad
5
5
  SHA512:
6
- metadata.gz: 86b3ee6a3f145e2a76580cbd96ced441d4060083126f420334e08d51f27ce22cfaea96adeba1eb39970087132dca22beb6950a1e168b44ef641d1823f0df4f93
7
- data.tar.gz: 18f3281c42615b4b4f5b4c6948fd36d323e07f3e0cb1afd8a451f4439d1f17c6c5885f796a24a12ed63320b0cf0c9e45a8d4bba256ebe3cad2b75d05f3eaa746
6
+ metadata.gz: 4816140ce00364987d929f50675a17143913eb53c4bbb1c986ee62f32d40df60925635df4c483bdfc0b8fa5155f4e8cb99b1b537f26d86356ca3d19117609994
7
+ data.tar.gz: 3d50f0cfcd055ebcfb96ef25e3bfb09aa3c72e761218feabec61bff3fb3b7535829cabf2718dcd82177debefdff23d33c69c9d57a15920766840ed0afb395abd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [1.0.7] - 2026-10-20
2
+
3
+ - Handle situation where LLM replies but gives no text
4
+
5
+ ## [1.0.6] - 2026-09-22
6
+
7
+ - Fetch Anthropic content from MessageResule#text just to be safe
8
+
1
9
  ## [1.0.5] - 2026-09-22
2
10
 
3
11
  - Fix generate next message domain mapper selection problems using domain-specific model_enum
@@ -8,7 +8,7 @@ module Foobara
8
8
  to :string
9
9
 
10
10
  def map
11
- message.content.first.text
11
+ message.text
12
12
  end
13
13
 
14
14
  alias message from
@@ -9,7 +9,7 @@ module Foobara
9
9
 
10
10
  def map
11
11
  {
12
- content: message_result.content.last.text,
12
+ content: message_result.text,
13
13
  role: message_result.role
14
14
  }
15
15
  end
@@ -9,10 +9,13 @@ module Foobara
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
11
  temperature :float, :allow_nil
12
+ # TODO: add fail_if_hitting_token_limit flag
12
13
  end
13
14
 
14
15
  result Types::Message
15
16
 
17
+ possible_error :message_response_was_blank, context: { service: :service_enum, model: :model_enum }
18
+
16
19
  AI_SERVICES.each_key do |service|
17
20
  command = Foobara::Ai::AnswerBot::DomainMappers::ServiceToChatCompletionCommand.map!(service)
18
21
  depends_on command
@@ -39,9 +42,18 @@ module Foobara
39
42
  def run_ai_service
40
43
  inputs = { chat:, temperature:, model: }
41
44
  inputs = domain_map!(inputs, to: ai_command)
42
- next_message = run_subcommand!(ai_command, inputs)
45
+ message = run_subcommand!(ai_command, inputs)
46
+
47
+ self.next_message = domain_map!(message, to: Types::Message)
48
+
49
+ if next_message.content.nil?
50
+ context = { model: }
51
+ context[:service] = service if service
43
52
 
44
- self.next_message = domain_map!(next_message, to: Types::Message)
53
+ add_runtime_error :message_response_was_blank,
54
+ "#{ai_command} #{model} responded successfully but response contained no text.",
55
+ **context
56
+ end
45
57
  end
46
58
  end
47
59
  end
@@ -5,7 +5,7 @@ module Foobara
5
5
  class Message < Foobara::Model
6
6
  attributes do
7
7
  role :symbol, one_of: [:assistant, :user, :system]
8
- content :string
8
+ content :string, :allow_nil
9
9
  end
10
10
 
11
11
  def system?
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.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi