PII adapter for OpenAI completion requests, scanning and redacting user text.
// Source: https://github.com/mudler/LocalAI | License: MIT | Copyright 2023-2025 Ettore Di Giacinto (mudler@localai.io) // Provided via justclaw.it.com; keep this notice with the code. package piiadapter import ( "github.com/mudler/LocalAI/core/schema" "github.com/mudler/LocalAI/core/services/routing/pii" ) // Field selectors for the prompt-style OpenAI requests (/v1/completions, // /v1/embeddings, /v1/edits), which carry user text in Prompt / Input / // Instruction rather than Messages. const ( fldPrompt = iota fldInput fldInstruction ) // encField packs (field, element) into one ScannedText.Index. element=-1 // means the field is a whole string; element>=0 indexes into a []any value. // Stored as element+1 so -1 maps to 0, with the field in the high bits. func encField(field, el ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key