Class: PullRequestAi::Util::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/pull_request_ai/util/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/pull_request_ai/util/configuration.rb', line 22

def initialize
  @api_version = 'v1'

  @openai_api_key = ENV['OPENAI_API_KEY']
  @github_access_token = ENV['GITHUB_ACCESS_TOKEN']
  @bitbucket_app_password = ENV['BITBUCKET_APP_PASSWORD']
  @bitbucket_username = ENV['BITBUCKET_USERNAME']

  @openai_api_endpoint = 'https://api.openai.com'
  @github_api_endpoint = 'https://api.github.com'
  @bitbucket_api_endpoint = 'https://api.bitbucket.org'

  @model = 'gpt-3.5-turbo'
  @temperature = 0.6
  @http_timeout = 60

  @rrtools_grouped_gems = Rails.application.routes.routes.select do |prop|
    prop.defaults[:group] == 'RRTools'
  end.collect do |route|
    {
      name: route.name,
      path: route.path.build_formatter.instance_variable_get('@parts').join
    }
  end || []
end

Instance Attribute Details

#api_versionObject (readonly)

Returns the value of attribute api_version.



19
20
21
# File 'lib/pull_request_ai/util/configuration.rb', line 19

def api_version
  @api_version
end

#bitbucket_api_endpointObject

Returns the value of attribute bitbucket_api_endpoint.



13
14
15
# File 'lib/pull_request_ai/util/configuration.rb', line 13

def bitbucket_api_endpoint
  @bitbucket_api_endpoint
end

#bitbucket_app_passwordObject

Returns the value of attribute bitbucket_app_password.



8
9
10
# File 'lib/pull_request_ai/util/configuration.rb', line 8

def bitbucket_app_password
  @bitbucket_app_password
end

#bitbucket_usernameObject

Returns the value of attribute bitbucket_username.



9
10
11
# File 'lib/pull_request_ai/util/configuration.rb', line 9

def bitbucket_username
  @bitbucket_username
end

#github_access_tokenObject

Returns the value of attribute github_access_token.



7
8
9
# File 'lib/pull_request_ai/util/configuration.rb', line 7

def github_access_token
  @github_access_token
end

#github_api_endpointObject

Returns the value of attribute github_api_endpoint.



12
13
14
# File 'lib/pull_request_ai/util/configuration.rb', line 12

def github_api_endpoint
  @github_api_endpoint
end

#http_timeoutObject

Returns the value of attribute http_timeout.



17
18
19
# File 'lib/pull_request_ai/util/configuration.rb', line 17

def http_timeout
  @http_timeout
end

#modelObject

Returns the value of attribute model.



15
16
17
# File 'lib/pull_request_ai/util/configuration.rb', line 15

def model
  @model
end

#openai_api_endpointObject

Returns the value of attribute openai_api_endpoint.



11
12
13
# File 'lib/pull_request_ai/util/configuration.rb', line 11

def openai_api_endpoint
  @openai_api_endpoint
end

#openai_api_keyObject

Returns the value of attribute openai_api_key.



6
7
8
# File 'lib/pull_request_ai/util/configuration.rb', line 6

def openai_api_key
  @openai_api_key
end

#rrtools_grouped_gemsObject (readonly)

Returns the value of attribute rrtools_grouped_gems.



20
21
22
# File 'lib/pull_request_ai/util/configuration.rb', line 20

def rrtools_grouped_gems
  @rrtools_grouped_gems
end

#temperatureObject

Returns the value of attribute temperature.



16
17
18
# File 'lib/pull_request_ai/util/configuration.rb', line 16

def temperature
  @temperature
end