Trained adapters published, private to their owners like the knowledge bases they come from
An adapter now has an owner (org, team, project, user or key): only callers there see it, and to anyone else it is a model that does not exist, absent from /v1/models too. A training job's owner defaults to the one collection its pairs come from, must be able to read every collection they come from, and pairs from a knowledge base are never made public. ctl train publish keeps the GGUF or PEFT files on the mirror, which accepts uploads now, and sets the owned adapter after the usual architecture check. The knowledge bases' cache_salt follows the collections searched rather than the organization, so two teams of one organization no longer share cached passages. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
964b35ae65
commit
85025dfb03
29 files changed
+1049
-84
No files matched your search
@@ -1127,6 +1127,27 @@ type Adapter struct {
|
||||
Source string `json:"source" koanf:"source"`
|
||||
// Scale is how strongly it is applied; zero takes 1.
|
||||
Scale float64 `json:"scale,omitempty" koanf:"scale"`
|
||||
// Owner is the part of the tenancy tree the adapter belongs to —
|
||||
// org:ID, team:ID, project:ID, user:ID or key:ID — and only callers in
|
||||
// it see it: to anyone else it is a model that does not exist. An
|
||||
// adapter trained on an organisation's documents carries some of what
|
||||
// they say in its weights. Empty is every caller the model allows.
|
||||
Owner string `json:"owner,omitempty" koanf:"owner"`
|
||||
}
|
||||
|
||||
// ValidAdapterOwner checks an adapter's owner is scope:ID.
|
||||
func ValidAdapterOwner(owner string) error {
|
||||
if owner == "" {
|
||||
return nil
|
||||
}
|
||||
scope, id, ok := strings.Cut(owner, ":")
|
||||
switch {
|
||||
case !ok || id == "":
|
||||
return fmt.Errorf("an adapter's owner is scope:ID, %q is not", owner)
|
||||
case scope != "org" && scope != "team" && scope != "project" && scope != "user" && scope != "key":
|
||||
return fmt.Errorf("an adapter's owner is an org, team, project, user or key, not %q", scope)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EffectiveScale is the scale an adapter is applied at.
|
||||
@@ -1175,6 +1196,9 @@ func validateAdapters(m Model) error {
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
for _, a := range m.Adapters {
|
||||
if err := ValidAdapterOwner(a.Owner); err != nil {
|
||||
return fmt.Errorf("model %q adapter %q: %w", m.Name, a.Name, err)
|
||||
}
|
||||
switch {
|
||||
case a.Name == "" || a.Source == "":
|
||||
return fmt.Errorf("model %q: an adapter needs a name and a source", m.Name)
|
||||
|
||||
Reference in new issue
Block a user