Class: PlaypathRails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/playpath_rails.rb

Overview

Configuration object for PlaypathRails

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



50
51
52
53
54
# File 'lib/playpath_rails.rb', line 50

def initialize
  @api_key = nil
  @embeddings_api_key = nil
  @base_url = 'https://playpath.io'
end

Instance Attribute Details

#api_keyObject

Regular API key for PlayPath.io (full access)



44
45
46
# File 'lib/playpath_rails.rb', line 44

def api_key
  @api_key
end

#base_urlObject

Base URL for API requests (defaults to Playpath.io service)



48
49
50
# File 'lib/playpath_rails.rb', line 48

def base_url
  @base_url
end

#embeddings_api_keyObject

Embeddings API key for PlayPath.io (limited to RAG endpoints)



46
47
48
# File 'lib/playpath_rails.rb', line 46

def embeddings_api_key
  @embeddings_api_key
end

Instance Method Details

#api_key_for(endpoint_type = :items) ⇒ Object

Get the appropriate API key for the request type



57
58
59
60
61
62
63
64
# File 'lib/playpath_rails.rb', line 57

def api_key_for(endpoint_type = :items)
  case endpoint_type
  when :rag
    @embeddings_api_key || @api_key
  else
    @api_key
  end
end