new config => %config
Accepts a hash that is the main AI config for the current queue.
process_request prompt => $prompt, raw_text => $text, model_config => \%model, feature => $name
Sends a request to the AI provider and returns a hashref with success and either result (the text returned by the model) or error. raw contains the decoded response from the provider.
feature is optional and names the RT feature making the request, such as summarize_ticket. It is used only for logging.
This method times the request and logs the provider, model, feature, outcome, elapsed time and token usage (when the provider reports it). The prompt, the text sent and the response are not logged. Providers implement the request itself in "_process_request".
_process_request %args
Providers must implement this method. It receives the same arguments as "process_request", sends the request and returns the response hashref described there.
_usage $raw
Providers can implement this method to report token usage. It receives the raw value from a successful response and returns a hashref with input_tokens and output_tokens. Either may be left out if the provider does not report it. The default returns an empty hashref.