Skip to content

Commit e240447

Browse files
committed
Fixing an error in bedrock and anthropic given the new URI interface
1 parent 8dc6c4d commit e240447

File tree

357 files changed

+36046
-58655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

357 files changed

+36046
-58655
lines changed

lib/ruby_llm/providers/anthropic/media.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def format_pdf(pdf)
6565
type: 'document',
6666
source: {
6767
type: 'url',
68-
url: pdf.source
68+
url: pdf.source.to_s
6969
}
7070
}
7171
else

lib/ruby_llm/providers/bedrock/chat.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def format_basic_message_with_thinking(msg, thinking_enabled)
6666
content_blocks << thinking_block if thinking_block
6767
end
6868

69-
Anthropic::Chat.append_formatted_content(content_blocks, msg.content)
69+
append_formatted_content(content_blocks, msg.content)
7070

7171
{
7272
role: Anthropic::Chat.convert_role(msg.role),
@@ -100,6 +100,15 @@ def format_tool_call_with_thinking(msg, thinking_enabled)
100100
content: content_blocks
101101
}
102102
end
103+
104+
def append_formatted_content(content_blocks, content)
105+
formatted_content = Media.format_content(content)
106+
if formatted_content.is_a?(Array)
107+
content_blocks.concat(formatted_content)
108+
else
109+
content_blocks << formatted_content
110+
end
111+
end
103112
end
104113
end
105114
end

spec/fixtures/vcr_cassettes/activerecord_actsas_attachment_handling_handles_attachments_in_ask_method.yml

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/vcr_cassettes/activerecord_actsas_attachment_handling_handles_multiple_attachments.yml

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/vcr_cassettes/activerecord_actsas_basic_chat_functionality_persists_chat_history.yml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/vcr_cassettes/activerecord_actsas_basic_chat_functionality_tracks_token_usage.yml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/vcr_cassettes/activerecord_actsas_custom_configurations_namespaced_chat_models_allows_model_switching.yml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/vcr_cassettes/activerecord_actsas_custom_configurations_namespaced_chat_models_persists_tool_calls_with_custom_classes.yml

Lines changed: 22 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)