Skip to content

Commit 8b16d38

Browse files
committed
Refactor serialization methods to use to_h instead of as_json for attachments
1 parent 82313aa commit 8b16d38

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/ruby_llm/attachment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def text?
7878
RubyLLM::MimeType.text? mime_type
7979
end
8080

81-
def as_json
81+
def to_h
8282
{ type: a.type, source: a.source }
8383
end
8484

lib/ruby_llm/content.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def format
2828
end
2929

3030
# For Rails serialization
31-
def as_json
32-
{ text: @text, attachments: @attachments.map(&:as_json) }
31+
def to_h
32+
{ text: @text, attachments: @attachments.map(&:to_h) }
3333
end
3434

3535
private

0 commit comments

Comments
 (0)