MCPcopy
hub / github.com/mudler/LocalAI / patternEntityActions

Function patternEntityActions

core/application/application.go:312–326  ·  view source on GitHub ↗

patternEntityActions merges a pattern detector's per-pattern Action overrides into its entity_actions map. A pattern reports matches under its Name, so a per-pattern action is just an entity_actions[Name] entry; explicit entity_actions still win if both are set.

(cfg config.ModelConfig)

Source from the content-addressed store, hash-verified

310// per-pattern action is just an entity_actions[Name] entry; explicit
311// entity_actions still win if both are set.
312func patternEntityActions(cfg config.ModelConfig) map[string]string {
313 out := cfg.PIIDetectionEntityActions()
314 for _, p := range cfg.PIIDetection.Patterns {
315 if p.Action == "" || p.Name == "" {
316 continue
317 }
318 if out == nil {
319 out = map[string]string{}
320 }
321 if _, exists := out[p.Name]; !exists {
322 out[p.Name] = p.Action
323 }
324 }
325 return out
326}
327
328// ResolvePIIPolicy resolves the effective request-side PII policy for a
329// consuming model, layering the instance-wide default detector

Callers 1

PIINERResolverMethod · 0.85

Calls 1

Tested by

no test coverage detected