Class: Riffer::Providers::OpenAI

Inherits:
Base
  • Object
show all
Defined in:
lib/riffer/providers/open_ai.rb

Overview

OpenAI provider for GPT models.

Requires the openai gem to be installed.

Direct Known Subclasses

AzureOpenAI

Constant Summary collapse

WEB_SEARCH_TOOL_TYPE =

: String

"web_search_preview"

Constants inherited from Base

Base::WIRE_SEPARATOR

Instance Method Summary collapse

Methods inherited from Base

#generate_text, skills_adapter, #stream_text

Methods included from Messages::Converter

#convert_to_file_part, #convert_to_message_object

Methods included from Helpers::Dependencies

#depends_on

Constructor Details

#initialize(**options) ⇒ OpenAI

Initializes the OpenAI provider.

– : (**untyped) -> void



14
15
16
17
18
19
# File 'lib/riffer/providers/open_ai.rb', line 14

def initialize(**options)
  depends_on "openai"

  api_key = options.fetch(:api_key, Riffer.config.openai.api_key)
  @client = ::OpenAI::Client.new(api_key: api_key, **options.except(:api_key))
end