Skip to content

Commit

Permalink
Support nil messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ksylvest committed Jul 18, 2024
1 parent 95f6215 commit 3123155
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
omniai-mistral (1.6.1)
omniai-mistral (1.6.2)
event_stream_parser
omniai
zeitwerk
Expand Down Expand Up @@ -50,7 +50,7 @@ GEM
llhttp-ffi (0.5.0)
ffi-compiler (~> 1.0)
rake (~> 13.0)
omniai (1.6.1)
omniai (1.6.2)
event_stream_parser
http
zeitwerk
Expand Down
2 changes: 2 additions & 0 deletions lib/omniai/mistral/chat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module Model
CODESTRAL = 'codestral-latest'
end

DEFAULT_MODEL = Model::MEDIUM

module Role
ASSISTANT = 'assistant'
USER = 'user'
Expand Down
4 changes: 2 additions & 2 deletions lib/omniai/mistral/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def connection

# @raise [OmniAI::Error]
#
# @param messages [String, Array, Hash]
# @param messages [String] optional
# @param model [String] optional
# @param format [Symbol] optional :text or :json
# @param temperature [Float, nil] optional
Expand All @@ -55,7 +55,7 @@ def connection
# @yieldparam prompt [OmniAI::Chat::Prompt]
#
# @return [OmniAI::Chat::Completion]
def chat(messages, model: Chat::Model::MEDIUM, temperature: nil, format: nil, stream: nil, tools: nil, &)
def chat(messages = nil, model: Chat::DEFAULT_MODEL, temperature: nil, format: nil, stream: nil, tools: nil, &)
Chat.process!(messages, model:, temperature:, format:, stream:, tools:, client: self, &)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/omniai/mistral/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module OmniAI
module Mistral
VERSION = '1.6.1'
VERSION = '1.6.2'
end
end

0 comments on commit 3123155

Please sign in to comment.