Class: ModelsHandler

Inherits:
Tep::Handler
  • Object
show all
Defined in:
lib/toy/serve/openai/handlers.rb

Instance Method Summary collapse

Instance Method Details

#handle(req, res) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/toy/serve/openai/handlers.rb', line 32

def handle(req, res)
  res.headers["Content-Type"] = "application/json"
  "{\"object\":\"list\",\"data\":[{" +
    SpinelKit::Json.encode_pair_str("id", STATE.model_name) + "," +
    SpinelKit::Json.encode_pair_str("object", "model") + "," +
    SpinelKit::Json.encode_pair_int("created", api_now_unix) + "," +
    SpinelKit::Json.encode_pair_str("owned_by", "toy") +
  "}]}\n"
end