ruby_llm 1.3.1 → 1.4.0
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/README.md +13 -14
- data/lib/generators/ruby_llm/install/templates/INSTALL_INFO.md.tt +108 -0
- data/lib/generators/ruby_llm/install/templates/chat_model.rb.tt +3 -0
- data/lib/generators/ruby_llm/install/templates/create_chats_migration.rb.tt +8 -0
- data/lib/generators/ruby_llm/install/templates/create_messages_migration.rb.tt +15 -0
- data/lib/generators/ruby_llm/install/templates/create_tool_calls_migration.rb.tt +14 -0
- data/lib/generators/ruby_llm/install/templates/initializer.rb.tt +6 -0
- data/lib/generators/ruby_llm/install/templates/message_model.rb.tt +3 -0
- data/lib/generators/ruby_llm/install/templates/tool_call_model.rb.tt +3 -0
- data/lib/generators/ruby_llm/install_generator.rb +121 -0
- data/lib/ruby_llm/active_record/acts_as.rb +23 -5
- data/lib/ruby_llm/aliases.json +20 -39
- data/lib/ruby_llm/attachment.rb +1 -1
- data/lib/ruby_llm/chat.rb +68 -15
- data/lib/ruby_llm/configuration.rb +2 -0
- data/lib/ruby_llm/error.rb +1 -0
- data/lib/ruby_llm/message.rb +3 -1
- data/lib/ruby_llm/models.json +7117 -7084
- data/lib/ruby_llm/models.rb +2 -1
- data/lib/ruby_llm/provider.rb +13 -7
- data/lib/ruby_llm/providers/anthropic/chat.rb +13 -12
- data/lib/ruby_llm/providers/anthropic/media.rb +2 -0
- data/lib/ruby_llm/providers/anthropic/tools.rb +23 -13
- data/lib/ruby_llm/providers/bedrock/chat.rb +4 -5
- data/lib/ruby_llm/providers/bedrock/media.rb +2 -0
- data/lib/ruby_llm/providers/bedrock/streaming/base.rb +2 -2
- data/lib/ruby_llm/providers/bedrock/streaming/prelude_handling.rb +4 -4
- data/lib/ruby_llm/providers/gemini/chat.rb +37 -2
- data/lib/ruby_llm/providers/gemini/embeddings.rb +4 -2
- data/lib/ruby_llm/providers/gemini/media.rb +2 -0
- data/lib/ruby_llm/providers/gpustack/chat.rb +17 -0
- data/lib/ruby_llm/providers/gpustack/models.rb +55 -0
- data/lib/ruby_llm/providers/gpustack.rb +36 -0
- data/lib/ruby_llm/providers/ollama/media.rb +2 -0
- data/lib/ruby_llm/providers/openai/chat.rb +17 -2
- data/lib/ruby_llm/providers/openai/embeddings.rb +4 -3
- data/lib/ruby_llm/providers/openai/media.rb +2 -0
- data/lib/ruby_llm/providers/openai/streaming.rb +14 -0
- data/lib/ruby_llm/railtie.rb +5 -0
- data/lib/ruby_llm/stream_accumulator.rb +3 -2
- data/lib/ruby_llm/streaming.rb +25 -7
- data/lib/ruby_llm/utils.rb +10 -0
- data/lib/ruby_llm/version.rb +1 -1
- data/lib/ruby_llm.rb +3 -0
- data/lib/tasks/models_docs.rake +3 -2
- metadata +15 -3
data/lib/ruby_llm/error.rb
CHANGED
@@ -25,6 +25,7 @@ module RubyLLM
|
|
25
25
|
class ModelNotFoundError < StandardError; end
|
26
26
|
class UnsupportedFunctionsError < StandardError; end
|
27
27
|
class UnsupportedAttachmentError < StandardError; end
|
28
|
+
class UnsupportedStructuredOutputError < StandardError; end
|
28
29
|
|
29
30
|
# Error classes for different HTTP status codes
|
30
31
|
class BadRequestError < Error; end
|
data/lib/ruby_llm/message.rb
CHANGED
@@ -7,7 +7,8 @@ module RubyLLM
|
|
7
7
|
class Message
|
8
8
|
ROLES = %i[system user assistant tool].freeze
|
9
9
|
|
10
|
-
attr_reader :role, :tool_calls, :tool_call_id, :input_tokens, :output_tokens, :model_id
|
10
|
+
attr_reader :role, :tool_calls, :tool_call_id, :input_tokens, :output_tokens, :model_id, :raw
|
11
|
+
attr_writer :content
|
11
12
|
|
12
13
|
def initialize(options = {})
|
13
14
|
@role = options.fetch(:role).to_sym
|
@@ -17,6 +18,7 @@ module RubyLLM
|
|
17
18
|
@output_tokens = options[:output_tokens]
|
18
19
|
@model_id = options[:model_id]
|
19
20
|
@tool_call_id = options[:tool_call_id]
|
21
|
+
@raw = options[:raw]
|
20
22
|
|
21
23
|
ensure_valid_role
|
22
24
|
end
|