Method: Asimov::Client#initialize
- Defined in:
- lib/asimov/client.rb
#initialize(api_key: nil, organization_id: HeadersFactory::NULL_ORGANIZATION_ID, request_options: {}, openai_api_base: nil) ⇒ Client
Creates a new Asimov::Client. Includes several optional named parameters:
api_key - The OpenAI API key that this Asimov::Client instance will use. If unspecified,
defaults to the application-wide configuration
organization_id - The OpenAI organization identifier that this Asimov::Client instance
will use. If unspecified, defaults to the application-wide configuration.
request_options - HTTParty request options that will be passed to the underlying network
client. Merges (and overrides) global configuration value.
openai_api_base - Custom base URI for the API calls made by this client. Defaults to global
configuration value.
39 40 41 42 43 44 45 46 47 |
# File 'lib/asimov/client.rb', line 39 def initialize(api_key: nil, organization_id: HeadersFactory::NULL_ORGANIZATION_ID, request_options: {}, openai_api_base: nil) @headers_factory = HeadersFactory.new(api_key, organization_id) = Asimov.configuration. .merge(Utils::RequestOptionsValidator.validate()) .freeze initialize_openai_api_base(openai_api_base) end |