feat(clients): optimize: evaluation, simulation, observability and optimizer on a discovery-checked call table
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// Route: POST /agent/optimize/suggest (cluster failures, suggest an instruction)
|
||||
#include "support/GoogleRig.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
|
||||
int main() {
|
||||
const char* json = "application/json";
|
||||
GoogleRig keyed;
|
||||
Fixture f(keyed.client);
|
||||
check(f.client->post("/agent/optimize/suggest", "{\"failures\":\"x\"}", json).status == 422,
|
||||
"missing instruction is 422");
|
||||
check(f.client->post("/agent/optimize/suggest", "{\"instruction\":\"be nice\"}", json).status == 422,
|
||||
"missing failures is 422");
|
||||
check(f.client->post("/agent/optimize/suggest",
|
||||
"{\"instruction\":\"" + std::string(8001, 'x') + "\",\"failures\":\"x\"}", json)
|
||||
.status == 422,
|
||||
"instruction over the 8000 character cap is 422");
|
||||
check(keyed.mock->send_count() == 0, "rejected input never reached Google");
|
||||
check(f.client->get("/agent/optimize/suggest").status == 405, "get is 405");
|
||||
|
||||
GoogleRig none(false);
|
||||
Fixture g(none.client);
|
||||
auto res = g.client->post("/agent/optimize/suggest",
|
||||
"{\"instruction\":\"be nice\",\"failures\":\"rude reply\"}", json);
|
||||
check(res.status == 503 && contains(res.body, "google_not_configured"),
|
||||
"no credential is a loud 503");
|
||||
check(none.mock->send_count() == 0, "no network without a credential");
|
||||
return finish("agent/optimize/suggest");
|
||||
}
|
||||
Reference in New Issue
Block a user