Files
moloapp/tests/example/agent/models/limits_test.cpp
T
retoorandClaude Sonnet 5.5 6b731643bf feat(clients): models: Gemini on Vertex, Model Garden, Claude, endpoint models, media, VertexModel
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>
2026-10-24 04:40:00 +02:00

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");
}