Class: Coolhand::ApiService
- Inherits:
-
Object
- Object
- Coolhand::ApiService
show all
- Defined in:
- lib/coolhand/api_service.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(endpoint = "v2/llm_request_logs") ⇒ ApiService
Returns a new instance of ApiService.
12
13
14
|
# File 'lib/coolhand/api_service.rb', line 12
def initialize(endpoint = "v2/llm_request_logs")
@api_endpoint = "#{base_url}/#{endpoint}"
end
|
Instance Attribute Details
#api_endpoint ⇒ Object
Returns the value of attribute api_endpoint.
10
11
12
|
# File 'lib/coolhand/api_service.rb', line 10
def api_endpoint
@api_endpoint
end
|
Instance Method Details
#api_key ⇒ Object
41
42
43
|
# File 'lib/coolhand/api_service.rb', line 41
def api_key
configuration.api_key
end
|
#base_url ⇒ Object
37
38
39
|
# File 'lib/coolhand/api_service.rb', line 37
def base_url
configuration.base_url
end
|
#debug_mode? ⇒ Boolean
49
50
51
|
# File 'lib/coolhand/api_service.rb', line 49
def debug_mode?
configuration.debug_mode
end
|
#send_llm_request_log(request_data) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/coolhand/api_service.rb', line 16
def send_llm_request_log(request_data)
payload = {
llm_request_log: request_data.merge(
collector: Collector.get_collector_string
)
}
if debug_mode?
log_separator
log "🛠️ Debug Mode - Request payload prepared but not sent to API:"
log JSON.pretty_generate(sanitize_payload_for_json(payload))
nil
else
send_request(payload, "✅ Successfully sent request metadata")
end
end
|
#silent ⇒ Object
45
46
47
|
# File 'lib/coolhand/api_service.rb', line 45
def silent
configuration.silent
end
|