mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-24 07:39:07 +02:00
[e2e] cover unversioned Vertex models, versioned config ids, and count-tokens
Extend the agent-network e2e to the Vertex request shapes a customer actually sends through Claude Code: - Register the Vertex provider's model under the raw "@version" id the Google console documents, so the router's candidate normalization is exercised end to end (previously the provider was created with no models array, leaving Vertex per-provider matching untested). - Allowlist the raw "@version" id in the guardrail, so entry normalization is exercised against version-stripped request models. - Drive the unversioned model id (…/models/claude-sonnet-4-5:rawPredict) through the tunnel and require 200 — the customer-reported shape. - Drive the token-count endpoint (…/models/count-tokens:rawPredict, real model in the body) via the new harness VertexCountTokens: an allowlisted body model must serve 200, a disallowed one must deny 403 before the upstream.
This commit is contained in:
@@ -104,8 +104,9 @@ func availableProviders() []providerCase {
|
||||
}
|
||||
|
||||
// providerRequest builds a create request for a matrix provider: enabled, with
|
||||
// a uniquely-priced model for body-routed providers and none for the
|
||||
// path-routed Vertex (whose model lives in the request path).
|
||||
// a uniquely-priced model registered under the id an operator would paste —
|
||||
// the normalized catalog id for Bedrock, the raw form elsewhere (including the
|
||||
// "@version" Vertex id, which the router must normalize to route).
|
||||
func providerRequest(pc providerCase) api.AgentNetworkProviderRequest {
|
||||
req := api.AgentNetworkProviderRequest{
|
||||
Name: pc.name,
|
||||
@@ -114,18 +115,15 @@ func providerRequest(pc providerCase) api.AgentNetworkProviderRequest {
|
||||
ApiKey: &pc.apiKey,
|
||||
Enabled: ptr(true),
|
||||
}
|
||||
if pc.kind != harness.WireVertex {
|
||||
// The router matches the normalized catalog id. Bedrock's request model
|
||||
// travels as a region-prefixed inference-profile id in the URL path
|
||||
// (us.anthropic...), which the router strips before matching, so register
|
||||
// the normalized form here or routing fails as model_not_routable.
|
||||
modelID := pc.model
|
||||
if pc.kind == harness.WireBedrock {
|
||||
modelID = catalogModel(pc)
|
||||
}
|
||||
req.Models = &[]api.AgentNetworkProviderModel{
|
||||
{Id: modelID, InputPer1k: 0.001, OutputPer1k: 0.002},
|
||||
}
|
||||
// Register Bedrock under its normalized catalog id (the router strips the
|
||||
// region prefix before matching); other providers, incl. the raw "@version"
|
||||
// Vertex id, register as-is so the router's normalization is exercised.
|
||||
modelID := pc.model
|
||||
if pc.kind == harness.WireBedrock {
|
||||
modelID = catalogModel(pc)
|
||||
}
|
||||
req.Models = &[]api.AgentNetworkProviderModel{
|
||||
{Id: modelID, InputPer1k: 0.001, OutputPer1k: 0.002},
|
||||
}
|
||||
return req
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user