Skip to content

Commit

Permalink
Support find of OmniAI::Client via symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
ksylvest committed Oct 19, 2024
1 parent 822f789 commit 55b8034
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
omniai (1.8.1)
omniai (1.8.2)
event_stream_parser
http
zeitwerk
Expand Down
10 changes: 5 additions & 5 deletions lib/omniai/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ def self.openai
# Initialize a client by provider (e.g. 'openai'). This method attempts to require the provider.
#
# @raise [OmniAI::Error] if the provider is not defined and the gem is not installed
# @param provider [String] required (e.g. 'anthropic', 'google', 'mistral', 'openai', etc)
# @param provider [String, Symbol] required (e.g. 'anthropic', 'google', 'mistral', 'openai', etc)
# @return [OmniAI::Client]
def self.find(provider:, **)
klass =
case provider
when 'anthropic' then anthropic
when 'google' then google
when 'mistral' then mistral
when 'openai' then openai
when :anthropic, 'anthropic' then anthropic
when :google, 'google' then google
when :mistral, 'mistral' then mistral
when :openai, 'openai' then openai
else raise Error, "unknown provider=#{provider.inspect}"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/omniai/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module OmniAI
VERSION = '1.8.1'
VERSION = '1.8.2'
end

0 comments on commit 55b8034

Please sign in to comment.