feat(types): Embedding-Abschnitt der Server-Config (Provider, Failover-Gruppen, goldener Pfad) + Status-Payloads
index.d.ts: EmbeddingProviderConfig/EmbeddingGroupConfig (onSingleQuery, onBulkWrite, health), EmbeddingConfig für config.server().embedding (Roh-JSON von config.Server. Embedding) sowie die Status-Payloads von GET …/admin/embedding/status (Projekt- und Server-Scope, Zustände live|degraded|quarantined|offline, Breaker closed|open|half-open). VectorConfig.provider dokumentiert jetzt, dass dort auch ein Gruppenname stehen darf. schemas/config/embedding.schema.json: validierbares Schema des Server-Abschnitts (Enums für Policies/Distributionen, Go-Duration-Muster, Pflichtfelder, keine erfundenen Properties); Beispiel examples/server/embedding.yml, per scripts/validate-schemas.mjs mitgeprüft (npm test: 5 YAML gegen 17 Schemas). Quelle der Wahrheit: internal/config/server.go + internal/config/embedding_group.go (tibi-server). Typecheck: tsc --noEmit --strict über index.d.ts grün.
This commit is contained in:
1 parent
4c55f82446
commit
5a45c4dd3f
4 files changed
+427
No files matched your search
Vendored
+123
@@ -109,6 +109,12 @@ declare global {
|
||||
}
|
||||
|
||||
export interface VectorConfig {
|
||||
/**
|
||||
* Name of the embedding provider (server config: `embedding.providers`) or
|
||||
* of an embedding failover group (`embedding.groups`). Groups route across
|
||||
* their members (policy, breaker, bulk sharding) and look like one provider
|
||||
* to the collection.
|
||||
*/
|
||||
provider: string
|
||||
documentPrefix?: string
|
||||
queryPrefix?: string
|
||||
@@ -735,6 +741,121 @@ declare global {
|
||||
job?: JobConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Embedding provider as exposed by `config.server()` — mirror of
|
||||
* `ConfigEmbeddingProvider` (secrets and modelPath are stripped from the JSON).
|
||||
*/
|
||||
export interface EmbeddingProviderConfig {
|
||||
name: string
|
||||
/** "native" (ONNX in-process) or "flagembedding" (external HTTP endpoint) */
|
||||
type: string
|
||||
model?: string
|
||||
dimensions?: number
|
||||
baseURL?: string
|
||||
documentPrefix?: string
|
||||
queryPrefix?: string
|
||||
/** flagembedding: HTTP bound; native: per-call bound (entry-only) */
|
||||
timeoutPerAttempt?: string
|
||||
/** Group-only metric knob (feeds lowest-latency routing) */
|
||||
slowThreshold?: string
|
||||
/** Weights/build tag; part of the model identity used by groups */
|
||||
revision?: string
|
||||
/** false = endpoint/model has no sparse vectors (native skips the sparse session) */
|
||||
sparse?: boolean
|
||||
}
|
||||
|
||||
/** Single-query routing of an embedding group (`onSingleQuery`). */
|
||||
export interface EmbeddingOnSingleQueryConfig {
|
||||
policy?:
|
||||
| "prefer-in-order"
|
||||
| "fastest-wins"
|
||||
| "round-robin"
|
||||
| "lowest-latency"
|
||||
| "weighted"
|
||||
/** Comma-separated names (YAML list is joined with commas before marshalling) */
|
||||
preferredOrder?: string
|
||||
timeoutPerAttempt?: string
|
||||
timeoutTotal?: string
|
||||
autoFailback?: boolean
|
||||
raceDelay?: string
|
||||
raceMaxFanout?: number
|
||||
weights?: number[]
|
||||
latencyWindow?: number
|
||||
retryAttempts?: number
|
||||
retryBackoff?: string
|
||||
retryBackoffMax?: string
|
||||
hedgeAfterSlow?: string
|
||||
}
|
||||
|
||||
/** Bulk-write sharding of an embedding group (`onBulkWrite`). */
|
||||
export interface EmbeddingOnBulkWriteConfig {
|
||||
distribution?: "round-robin" | "lowest-latency" | "weighted"
|
||||
maxConcurrentTotal?: number
|
||||
maxConcurrentPerEndpoint?: number
|
||||
timeoutPerAttempt?: string
|
||||
timeoutTotal?: string
|
||||
}
|
||||
|
||||
/** Health/breaker timing of an embedding group (`health`). */
|
||||
export interface EmbeddingHealthConfig {
|
||||
/** > 0 also enables late join/recovery of quarantined members */
|
||||
checkInterval?: string
|
||||
checkTimeout?: string
|
||||
unhealthyAfterFailures?: number
|
||||
healthyAfterSuccesses?: number
|
||||
cooldownAfterUnhealthy?: string
|
||||
}
|
||||
|
||||
/** Embedding failover group as exposed by `config.server()`. */
|
||||
export interface EmbeddingGroupConfig {
|
||||
name: string
|
||||
description?: string
|
||||
members: string[]
|
||||
onSingleQuery?: EmbeddingOnSingleQueryConfig
|
||||
onBulkWrite?: EmbeddingOnBulkWriteConfig
|
||||
health?: EmbeddingHealthConfig
|
||||
}
|
||||
|
||||
/** Embedding section as exposed by `config.server()`. */
|
||||
export interface EmbeddingConfig {
|
||||
providers?: EmbeddingProviderConfig[]
|
||||
groups?: EmbeddingGroupConfig[]
|
||||
/** Directory of golden verification files (default testdata/embedding-golden) */
|
||||
goldenPath?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Member state from `GET …/admin/embedding/status` (server scope keeps
|
||||
* `lastError`, project scope redacts it).
|
||||
*/
|
||||
export interface EmbeddingMemberHealth {
|
||||
state: "live" | "degraded" | "quarantined" | "offline"
|
||||
breaker: "closed" | "open" | "half-open"
|
||||
lastError?: string
|
||||
latencyMs?: number
|
||||
successes?: number
|
||||
failures?: number
|
||||
slowCount?: number
|
||||
}
|
||||
|
||||
/** Group state from `GET …/admin/embedding/status`. */
|
||||
export interface EmbeddingGroupHealth {
|
||||
/** null while no member is live */
|
||||
referenceMember: string | null
|
||||
members: { [member: string]: EmbeddingMemberHealth }
|
||||
}
|
||||
|
||||
/** Project-scope payload: `{ namespace, health: { groups } }`. */
|
||||
export interface EmbeddingHealthProjectResponse {
|
||||
namespace: string
|
||||
health: { groups: { [group: string]: EmbeddingGroupHealth } }
|
||||
}
|
||||
|
||||
/** Server-scope payload: `{ groups }`. */
|
||||
export interface EmbeddingHealthServerResponse {
|
||||
groups: { [group: string]: EmbeddingGroupHealth }
|
||||
}
|
||||
|
||||
interface ConfigPackage {
|
||||
/**
|
||||
* get current namespace string
|
||||
@@ -773,6 +894,8 @@ declare global {
|
||||
maxTokensPerRequest?: number
|
||||
}[]
|
||||
}
|
||||
/** Raw JSON of config.Server.Embedding (apiKey/modelPath stripped, JSON tags decide) */
|
||||
embedding?: EmbeddingConfig
|
||||
audit?: {
|
||||
enabled: boolean
|
||||
defaultTTL: string
|
||||
|
||||
Reference in new issue
Block a user