Optionalprovider: IMetadataProviderProvider-aware metadata access: returns the explicit provider when one was supplied
(constructor or Provider setter), otherwise the global default. All metadata
operations in this class hierarchy go through this getter so a bound instance never
leaks onto the global provider.
Optional metadata provider override. Pass the provider to the constructor (preferred)
or set instance.Provider = providerToUse before invoking helper methods in
multi-provider contexts. Setting it rebinds the internal RunView instance so view
execution rides the same provider. Falls back to the global default when unset.
The fallback is the global provider itself, never the Metadata wrapper: consumers
type-check what they get here (e.g. VectorDBBase.TryWireColocatedHost needs an
IColocatedVectorHost), and the wrapper fails those checks.
ProtectedBuildBuilds a SQL filter from composite keys. Values are sanitized to prevent SQL injection.
ProtectedCanReturns true when PageRecordsByEntityID can serve the given entity via
keyset (seek) pagination — i.e. the entity has a single-column PK on a comparable
type. Callers iterating large tables should consult this and pass AfterKey when true.
ProtectedGetResolve the embedding model to generate vectors with.
Pass an id wherever one exists. The width of an embedding is a property of the model,
and the width an index accepts is fixed when the index is created, so which model this
returns decides whether the vectors fit. The no-id branch cannot know that and is a
last resort only.
The no-id branch used to be a bare find() over AIEngine.Instance.Models, which
BaseAIEngine.Config loads with no OrderBy and no IsActive filter. So it returned
whichever Embeddings row the view happened to hand back first — a different model on a
different database, or after an unrelated insert, and quite possibly a deactivated one.
An arbitrary answer is worse than a wrong one: the same code produces different widths in
different environments and nothing in the failure names the model that was chosen.
It is now deterministic — active models first, then highest PowerRank, then name — and it
says out loud which model it picked and that nobody asked for it.
Optionalid: stringProtectedGetOptionalrecordIDs: CompositeKey[]ProtectedGetOptionalid: stringProtectedPageProtectedRunProtectedSaveSaving an Entity in any vector related package needs the CurrentUser property to be set on the entity So this is a simple wrapper to set it before saving
Optional metadata provider to bind this instance (and all of its metadata/view operations) to. Server-side callers servicing per-request connections MUST pass their request-scoped provider (e.g.
this.ProviderToUsefrom a BaseEntity subclass) — relying on the global default silently uses the wrong connection in multi-provider scenarios. Falls back to the global default provider when omitted.