One call table verified against Discovery (29 calls), live-verified read-only with an express key and a service account token, /agent/models example routes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
30 lines
1.5 KiB
C++
30 lines
1.5 KiB
C++
// Route: POST /agent/models/generate (hard caps: output tokens, prompt size, project requirement)
|
|
#include <cstdlib>
|
|
|
|
#include "support/GoogleRig.hpp"
|
|
|
|
using namespace molo::example::test;
|
|
|
|
int main() {
|
|
unsetenv("GOOGLE_CLOUD_PROJECT");
|
|
GoogleRig rig;
|
|
Fixture f(rig.client);
|
|
auto over = f.client->post("/agent/models/generate",
|
|
"{\"prompt\":\"hi\",\"max_tokens\":\"70000\"}", "application/json");
|
|
check(over.status == 422, "max_tokens over the 65536 cap is 422");
|
|
auto words = f.client->post("/agent/models/generate",
|
|
"{\"prompt\":\"hi\",\"max_tokens\":\"many\"}", "application/json");
|
|
check(words.status == 422, "non numeric max_tokens is 422");
|
|
std::string huge(1000001, 'x');
|
|
auto big = f.client->post("/agent/models/count", "{\"prompt\":\"" + huge + "\"}", "application/json");
|
|
check(big.status == 422, "prompt over the 1,000,000 char cap is 422");
|
|
auto id = f.client->post("/agent/models/generate",
|
|
"{\"prompt\":\"hi\",\"model\":\"a/b\"}", "application/json");
|
|
check(id.status == 422, "model id with a slash is 422");
|
|
auto claude = f.client->post("/agent/models/claude", "{\"prompt\":\"hi\"}", "application/json");
|
|
check(claude.status == 422 && contains(claude.body, "project"),
|
|
"Claude without GOOGLE_CLOUD_PROJECT is 422 naming the project");
|
|
check(rig.mock->send_count() == 0, "side effect: nothing reached Google");
|
|
return finish("agent/models/limits");
|
|
}
|