Commit 3df4a80
Changed files (1)
lib
elelem
lib/elelem/conversation.rb
@@ -21,7 +21,7 @@ module Elelem
if @items.last && @items.last[:role] == role
@items.last[:content] += content
else
- @items.push({ role: role, content: content })
+ @items.push({ role: role, content: normalize(content) })
end
end
@@ -30,5 +30,13 @@ module Elelem
def system_prompt
ERB.new(Pathname.new(__dir__).join("system_prompt.erb").read).result(binding)
end
+
+ def normalize(content)
+ if content.is_a?(Array)
+ content.join(", ")
+ else
+ content.to_s
+ end
+ end
end
end