models: EndpointAdmin and PublisherAdmin wrap every remaining method of the owned resources (84 call table rows, 132 Discovery methods covered, v1beta1 twins, IAM, operations, responses, export, config, enableModel); planner rejects undeclared body keys; VertexModel::TurnBuilder replays model turns with every thoughtSignature; Lyria WAV mime from bytes; veo-3.1 default. runtime: v1beta1 feedbackEntries, A2A gateway (40 rpcs), a2aTasks, task store records, scoped operations, beta twin flag (103 rows, 214 methods covered); checker verifies twins, a2aEndpoint patterns and coverage. example: admin routes for both parts. SPECs: live results moved from Unverified to Verified live (Veo, Lyria, thought signatures, v1beta1 routes). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
85 lines
4.9 KiB
C++
85 lines
4.9 KiB
C++
#pragma once
|
|
|
|
// PublisherAdmin: the publisher model methods Discovery lists that the other
|
|
// services in this module do not wrap:
|
|
// - v1: serverStreamingPredict, the `v1/responses` family (create, compact,
|
|
// get, delete) of a publisher;
|
|
// - v1beta1: export, setPublisherModelConfig, enableModel, getIamPolicy,
|
|
// the `v1/responses` family, and the v1beta1 form of every publisher
|
|
// model method (generate, stream, tokens, predict, long running, raw
|
|
// predict, invoke, embedContent, get).
|
|
// Request bodies are checked against the call table (see EndpointAdmin).
|
|
// Export, config changes and enableModel change the project: confirm=true.
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
#include "google/gemini_types.h"
|
|
#include "google/models/gemini.h"
|
|
#include "google/models/vertex_service.h"
|
|
#include "google/operation.h"
|
|
|
|
namespace molo::google::models {
|
|
|
|
class PublisherAdmin : public VertexService {
|
|
public:
|
|
using Sink = std::function<bool(const clients::body::Json&)>;
|
|
|
|
PublisherAdmin(std::shared_ptr<GoogleClient> client, VertexTarget target);
|
|
|
|
// --- v1 --------------------------------------------------------------
|
|
void server_streaming_predict(const std::string& publisher, const std::string& model,
|
|
const clients::body::Json& inputs,
|
|
const clients::body::Json& parameters,
|
|
const Sink& sink) const;
|
|
// `v1/responses` of a publisher; version selects v1 or v1beta1.
|
|
clients::body::Json responses_create(const std::string& publisher,
|
|
const clients::body::Json& body, bool beta = false) const;
|
|
clients::body::Json responses_compact(const std::string& publisher,
|
|
const clients::body::Json& body, bool beta = false) const;
|
|
clients::body::Json responses_get(const std::string& publisher, const std::string& response_id,
|
|
bool beta = false) const;
|
|
clients::body::Json responses_delete(const std::string& publisher,
|
|
const std::string& response_id, bool confirm,
|
|
bool beta = false) const;
|
|
|
|
// --- v1beta1 ---------------------------------------------------------
|
|
Operation export_model(const std::string& publisher, const std::string& model,
|
|
const std::string& gcs_output_uri_prefix, bool confirm) const;
|
|
Operation set_config(const std::string& publisher, const std::string& model,
|
|
const clients::body::Json& publisher_model_config,
|
|
const std::string& update_mask, bool confirm) const;
|
|
clients::body::Json enable_model(const std::string& publisher, const std::string& model,
|
|
const std::string& service, bool confirm) const;
|
|
clients::body::Json get_iam_policy(const std::string& publisher, const std::string& model,
|
|
int policy_version = 0) const;
|
|
GenerateResponse beta_generate(const std::string& publisher, const std::string& model,
|
|
const GenerateRequest& request) const;
|
|
void beta_stream(const std::string& publisher, const std::string& model,
|
|
const GenerateRequest& request,
|
|
const std::function<bool(const GenerateResponse&)>& on_chunk) const;
|
|
CountTokensResult beta_count_tokens(const std::string& publisher, const std::string& model,
|
|
const GenerateRequest& request) const;
|
|
clients::body::Json beta_compute_tokens(const std::string& publisher, const std::string& model,
|
|
const clients::body::Json& contents) const;
|
|
clients::body::Json beta_get(const std::string& publisher, const std::string& model,
|
|
bool full_view = false) const;
|
|
// The remaining v1beta1 POST forms take their Discovery body as is:
|
|
// call_id is one of beta.embed_content, beta.predict, beta.predict_long_running,
|
|
// beta.fetch_predict_operation, beta.raw_predict, beta.server_streaming_predict.
|
|
clients::body::Json beta_post(const std::string& call_id, const std::string& publisher,
|
|
const std::string& model, const clients::body::Json& body) const;
|
|
void beta_stream_raw_predict(const std::string& publisher, const std::string& model,
|
|
const clients::body::Json& body, const Sink& sink) const;
|
|
clients::body::Json beta_invoke(const std::string& publisher, const std::string& model,
|
|
const std::string& invoke_id,
|
|
const clients::body::Json& body) const;
|
|
|
|
// Plans without sending (tests, call-table conformance).
|
|
PlannedCall plan_call(const std::string& call_id, const CallPlanner::Args& args,
|
|
const clients::body::Json* body = nullptr,
|
|
const std::string& query = "") const;
|
|
};
|
|
|
|
} // namespace molo::google::models
|