struct

Grafito::AI::Request

Inherits Struct < Value < Object

Normalized AI request that works with any provider. Providers transform this into their specific format.

Constants

PRIORITY_MAP = {"emerg" => "0", "emergency" => "0", "alert" => "1", "crit" => "2", "critical" => "2", "err" => "3", "error" => "3", "warning" => "4", "warn" => "4", "notice" => "5", "info" => "6", "debug" => "7"}

Priority name to numeric string mapping

Constructors

for_log_analysis(context : String, priority : String = "6", prompt : String | Nil = nil) : self

Convenience constructor for log analysis use case. Priority should be "0"-"7" or the formatted name (emerg, alert, crit, err, warning, notice, info, debug)

Source
new(system_prompt : String, user_prompt : String, max_tokens : Int32 = 1024, temperature : Float64 = 0.7)
Source

Instance methods

max_tokens

Maximum tokens to generate in response

Source
system_prompt

The system prompt sets the AI's persona and behavior

Source
temperature

Randomness: 0.0 = deterministic, 1.0 = creative

Source
user_prompt

The user's actual question or request

Source