Skip to content

Commit 6bcdfa2

Browse files
committed
More rubocop appeasing
1 parent 1801adc commit 6bcdfa2

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

lib/ruby_llm/provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def to_json_stream(&block) # rubocop:disable Metrics/MethodLength
139139
parsed_data = JSON.parse(chunk)
140140
block.call(parsed_data)
141141
else
142-
raise NotImplementedError.new("unsupported content-type in streaming response: #{content_type}")
142+
raise NotImplementedError, "unsupported content-type in streaming response: #{content_type}"
143143
end
144144
end
145145
end

lib/ruby_llm/providers/ollama/chat.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Ollama
77
module Chat # rubocop:disable Metrics/ModuleLength
88
# Must be public for Provider to use
99
def complete(messages, tools:, temperature:, model:, &block) # rubocop:disable Metrics/MethodLength
10-
raise NotImplementedError.new('tool use not implemented in Ollama at this time') if tools.any?
10+
raise NotImplementedError, 'tool use not implemented in Ollama at this time' if tools.any?
1111

1212
payload = {
1313
model: model,
@@ -45,14 +45,8 @@ def format_messages(messages)
4545
end
4646

4747
def format_role(role)
48-
case role
49-
when :assistant
50-
when :system
51-
when :tool
52-
role.to_s
5348
# FIXME: probably should validate this
54-
else role.to_s
55-
end
49+
role.to_s
5650
end
5751

5852
def format_parts(msg) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength

lib/ruby_llm/providers/ollama/embeddings.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ def embed(text, model:) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
2828
def format_text_for_embedding(text)
2929
# Ollama supports either a string or a string array here
3030
unless text.is_a?(Array) || text.is_a?(String)
31-
raise NotImplementedException.new("unsupported argument for Ollama embedding: #{text.class}")
31+
raise NotImplementedException, "unsupported argument for Ollama embedding: #{text.class}"
3232
end
33+
3334
text
3435
end
3536
end

0 commit comments

Comments
 (0)