mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-01 12:31:42 +02:00
endpoint model discovery and proxy integration
This commit is contained in:
@@ -5280,6 +5280,51 @@ components:
|
||||
- id
|
||||
- input_per_1k
|
||||
- output_per_1k
|
||||
AgentNetworkDiscoveredModel:
|
||||
type: object
|
||||
description: A model reported by the provider's persisted upstream endpoint.
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: Exact model identifier accepted by the upstream endpoint.
|
||||
example: "llama3.2:latest"
|
||||
label:
|
||||
type: string
|
||||
description: Human-friendly label reported by the endpoint. Falls back to the model identifier.
|
||||
example: "llama3.2:latest"
|
||||
required:
|
||||
- id
|
||||
- label
|
||||
AgentNetworkModelDiscoveryResponse:
|
||||
type: object
|
||||
description: |
|
||||
Result of an explicit model-discovery probe executed by a connected
|
||||
proxy in the account's selected Agent Network cluster. Discovered
|
||||
models are not persisted until the provider is updated.
|
||||
properties:
|
||||
models:
|
||||
type: array
|
||||
description: Normalized, deduplicated models reported by the upstream.
|
||||
items:
|
||||
$ref: '#/components/schemas/AgentNetworkDiscoveredModel'
|
||||
source:
|
||||
type: string
|
||||
description: Upstream API shape used to obtain the result.
|
||||
enum: [openai_v1_models, ollama_api_tags]
|
||||
example: "openai_v1_models"
|
||||
proxy_cluster:
|
||||
type: string
|
||||
description: Proxy cluster from which the endpoint was queried.
|
||||
example: "eu.proxy.netbird.io"
|
||||
request_id:
|
||||
type: string
|
||||
description: Correlation identifier for the management-to-proxy probe.
|
||||
example: "b7ef7da0-78cc-4583-8c4f-55f2ce72015f"
|
||||
required:
|
||||
- models
|
||||
- source
|
||||
- proxy_cluster
|
||||
- request_id
|
||||
AgentNetworkCatalogModel:
|
||||
type: object
|
||||
properties:
|
||||
@@ -5356,6 +5401,10 @@ components:
|
||||
"custom" — generic OpenAI-compatible self-hosted endpoint catch-all.
|
||||
enum: [provider, gateway, custom]
|
||||
example: "provider"
|
||||
supports_model_discovery:
|
||||
type: boolean
|
||||
description: Whether models can be loaded from a persisted endpoint through the selected proxy cluster.
|
||||
example: false
|
||||
extra_headers:
|
||||
type: array
|
||||
description: |
|
||||
@@ -5379,6 +5428,7 @@ components:
|
||||
- default_content_type
|
||||
- brand_color
|
||||
- kind
|
||||
- supports_model_discovery
|
||||
- models
|
||||
AgentNetworkCatalogIdentityInjection:
|
||||
type: object
|
||||
@@ -14039,6 +14089,48 @@ paths:
|
||||
"$ref": "#/components/responses/not_found"
|
||||
'500':
|
||||
"$ref": "#/components/responses/internal_error"
|
||||
/api/agent-network/providers/{providerId}/discover-models:
|
||||
post:
|
||||
summary: Discover models from an Agent Network provider
|
||||
description: |
|
||||
Executes a bounded, read-only model-list probe from a connected proxy
|
||||
in the account's selected Agent Network cluster. The probe uses the
|
||||
provider's persisted endpoint, TLS setting, and stored credential.
|
||||
Returned models are not persisted by this operation.
|
||||
tags: [ Agent Network ]
|
||||
security:
|
||||
- BearerAuth: [ ]
|
||||
- TokenAuth: [ ]
|
||||
parameters:
|
||||
- in: path
|
||||
name: providerId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
description: The unique identifier of a persisted Agent Network provider
|
||||
responses:
|
||||
'200':
|
||||
description: Models discovered successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/AgentNetworkModelDiscoveryResponse'
|
||||
'400':
|
||||
"$ref": "#/components/responses/bad_request"
|
||||
'401':
|
||||
"$ref": "#/components/responses/requires_authentication"
|
||||
'403':
|
||||
"$ref": "#/components/responses/forbidden"
|
||||
'404':
|
||||
"$ref": "#/components/responses/not_found"
|
||||
'412':
|
||||
description: The provider cannot be queried or no capable proxy is connected
|
||||
content: { }
|
||||
'429':
|
||||
description: A discovery probe is already running or was requested too recently
|
||||
content: { }
|
||||
'500':
|
||||
"$ref": "#/components/responses/internal_error"
|
||||
/api/agent-network/policies:
|
||||
get:
|
||||
summary: List all Agent Network Policies
|
||||
|
||||
@@ -98,6 +98,24 @@ func (e AgentNetworkConsumptionDimensionKind) Valid() bool {
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for AgentNetworkModelDiscoveryResponseSource.
|
||||
const (
|
||||
AgentNetworkModelDiscoveryResponseSourceOllamaApiTags AgentNetworkModelDiscoveryResponseSource = "ollama_api_tags"
|
||||
AgentNetworkModelDiscoveryResponseSourceOpenaiV1Models AgentNetworkModelDiscoveryResponseSource = "openai_v1_models"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the AgentNetworkModelDiscoveryResponseSource enum.
|
||||
func (e AgentNetworkModelDiscoveryResponseSource) Valid() bool {
|
||||
switch e {
|
||||
case AgentNetworkModelDiscoveryResponseSourceOllamaApiTags:
|
||||
return true
|
||||
case AgentNetworkModelDiscoveryResponseSourceOpenaiV1Models:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for CreateAzureIntegrationRequestHost.
|
||||
const (
|
||||
CreateAzureIntegrationRequestHostMicrosoftCom CreateAzureIntegrationRequestHost = "microsoft.com"
|
||||
@@ -2094,6 +2112,9 @@ type AgentNetworkCatalogProvider struct {
|
||||
|
||||
// Name Display name for the provider.
|
||||
Name string `json:"name"`
|
||||
|
||||
// SupportsModelDiscovery Whether models can be loaded from a persisted endpoint through the selected proxy cluster.
|
||||
SupportsModelDiscovery bool `json:"supports_model_discovery"`
|
||||
}
|
||||
|
||||
// AgentNetworkCatalogProviderAuthMode Whether this provider requires, optionally accepts, or does not support an upstream API key.
|
||||
@@ -2135,6 +2156,15 @@ type AgentNetworkConsumption struct {
|
||||
// AgentNetworkConsumptionDimensionKind Whether this row counts a single end user or a single source group across every member.
|
||||
type AgentNetworkConsumptionDimensionKind string
|
||||
|
||||
// AgentNetworkDiscoveredModel A model reported by the provider's persisted upstream endpoint.
|
||||
type AgentNetworkDiscoveredModel struct {
|
||||
// Id Exact model identifier accepted by the upstream endpoint.
|
||||
Id string `json:"id"`
|
||||
|
||||
// Label Human-friendly label reported by the endpoint. Falls back to the model identifier.
|
||||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
// AgentNetworkGuardrail defines model for AgentNetworkGuardrail.
|
||||
type AgentNetworkGuardrail struct {
|
||||
// Checks Guardrail check parameters. Each entry has an `enabled` flag plus per-check configuration; disabled entries are inert.
|
||||
@@ -2182,6 +2212,26 @@ type AgentNetworkGuardrailRequest struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// AgentNetworkModelDiscoveryResponse Result of an explicit model-discovery probe executed by a connected
|
||||
// proxy in the account's selected Agent Network cluster. Discovered
|
||||
// models are not persisted until the provider is updated.
|
||||
type AgentNetworkModelDiscoveryResponse struct {
|
||||
// Models Normalized, deduplicated models reported by the upstream.
|
||||
Models []AgentNetworkDiscoveredModel `json:"models"`
|
||||
|
||||
// ProxyCluster Proxy cluster from which the endpoint was queried.
|
||||
ProxyCluster string `json:"proxy_cluster"`
|
||||
|
||||
// RequestId Correlation identifier for the management-to-proxy probe.
|
||||
RequestId string `json:"request_id"`
|
||||
|
||||
// Source Upstream API shape used to obtain the result.
|
||||
Source AgentNetworkModelDiscoveryResponseSource `json:"source"`
|
||||
}
|
||||
|
||||
// AgentNetworkModelDiscoveryResponseSource Upstream API shape used to obtain the result.
|
||||
type AgentNetworkModelDiscoveryResponseSource string
|
||||
|
||||
// AgentNetworkPolicy defines model for AgentNetworkPolicy.
|
||||
type AgentNetworkPolicy struct {
|
||||
// CreatedAt Timestamp when the policy was created.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -73,6 +73,10 @@ message ProxyCapabilities {
|
||||
optional bool private = 4;
|
||||
// Whether the proxy enforces ProxyMapping.private (fails closed on ValidateTunnelPeer failure). Management MUST NOT stream private mappings to proxies that don't claim this.
|
||||
optional bool supports_private_service = 5;
|
||||
// Whether the proxy can execute correlated Agent Network model-discovery
|
||||
// requests delivered over SyncMappings. Management must not send discovery
|
||||
// requests to proxies that omit or disable this capability.
|
||||
optional bool supports_model_discovery = 6;
|
||||
}
|
||||
|
||||
// GetMappingUpdateRequest is sent to initialise a mapping stream.
|
||||
@@ -420,6 +424,8 @@ message SyncMappingsRequest {
|
||||
oneof msg {
|
||||
SyncMappingsInit init = 1;
|
||||
SyncMappingsAck ack = 2;
|
||||
// Correlated response to a ModelDiscoveryRequest received from management.
|
||||
ModelDiscoveryResult model_discovery_result = 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,6 +449,9 @@ message SyncMappingsResponse {
|
||||
repeated ProxyMapping mapping = 1;
|
||||
// initial_sync_complete is set on the last message of the initial snapshot.
|
||||
bool initial_sync_complete = 2;
|
||||
// An out-of-band model-discovery operation. This is sent only after the
|
||||
// initial snapshot and only to proxies advertising supports_model_discovery.
|
||||
ModelDiscoveryRequest model_discovery_request = 3;
|
||||
}
|
||||
|
||||
// CheckLLMPolicyLimitsRequest carries the resolved caller identity and the
|
||||
@@ -501,3 +510,33 @@ message RecordLLMUsageRequest {
|
||||
message RecordLLMUsageResponse {
|
||||
}
|
||||
|
||||
// ModelDiscoveryRequest asks a proxy to list models from a persisted provider
|
||||
// endpoint using the proxy host's network path. request_id is assigned by
|
||||
// management and echoed verbatim in ModelDiscoveryResult.
|
||||
message ModelDiscoveryRequest {
|
||||
string request_id = 1;
|
||||
string upstream_url = 2;
|
||||
string auth_header_name = 3;
|
||||
string auth_header_value = 4;
|
||||
bool skip_tls_verify = 5;
|
||||
// When true, the proxy may fall back from the OpenAI-compatible
|
||||
// GET /v1/models endpoint to Ollama's native GET /api/tags endpoint.
|
||||
bool ollama_fallback = 6;
|
||||
}
|
||||
|
||||
// ModelDiscoveryModel is the normalized model shape returned to management.
|
||||
// Arbitrary upstream fields never cross the proxy control channel.
|
||||
message ModelDiscoveryModel {
|
||||
string id = 1;
|
||||
string label = 2;
|
||||
}
|
||||
|
||||
// ModelDiscoveryResult completes one ModelDiscoveryRequest. error is empty on
|
||||
// success and contains only a sanitized diagnostic on failure.
|
||||
message ModelDiscoveryResult {
|
||||
string request_id = 1;
|
||||
repeated ModelDiscoveryModel models = 2;
|
||||
// Stable source label, currently openai_v1_models or ollama_api_tags.
|
||||
string source = 3;
|
||||
string error = 4;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user