Expand description
Prompt enrichment service.
Enriches prompt templates with LLM-generated metadata including:
- Prompt-level description
- Tags for categorization
- Variable descriptions, defaults, and required flags
§Fallback Behavior
The enrichment service degrades gracefully when the LLM is unavailable:
| Condition | Behavior | Result Status |
|---|---|---|
| LLM available, success | Full metadata generated | Full |
| LLM available, timeout | Use extracted variables only | Fallback |
| LLM available, error | Use extracted variables only | Fallback |
| No LLM configured | Use extracted variables only | Fallback |
User passed --no-enrich | Skip enrichment entirely | Skipped |
§Fallback Metadata
When enrichment fails or is unavailable, minimal metadata is generated:
- description: Empty string (user can edit later)
- tags: Empty array
- variables: Names preserved, descriptions set to “No description”
§User Values Take Precedence
User-provided metadata is never overwritten by LLM enrichment:
User provides: description="My review prompt", tags=["review"]
LLM generates: description="Code review assistant", tags=["code", "review", "quality"]
Result: description="My review prompt", tags=["review"] (user values preserved)§Error Handling
| Error Type | Logging | User Impact |
|---|---|---|
| Timeout (5s) | WARN | Prompt saved with fallback metadata |
| Parse error | WARN | Prompt saved with fallback metadata |
| Network error | WARN | Prompt saved with fallback metadata |
| No LLM config | DEBUG | Prompt saved with fallback metadata |
The service never fails a prompt save due to enrichment errors.
Structs§
- Enrichment
Request - Request for prompt enrichment.
- LlmEnrichment
Response 🔒 - LLM response format for enrichment.
- LlmVariable
Response 🔒 - Variable definition from LLM response.
- Partial
Metadata - Partial metadata provided by the user.
- Prompt
Enrichment Result - Result of prompt enrichment.
- Prompt
Enrichment Service - Service for enriching prompt templates with LLM-generated metadata.
Enums§
- Enrichment
Status - Status of the enrichment operation.
Constants§
- ENRICHMENT_
TIMEOUT - Default timeout for LLM enrichment calls.
- PROMPT_
ENRICHMENT_ SYSTEM_ PROMPT - System prompt for prompt template enrichment.
Functions§
- default_
required 🔒 - Default for required field.
- escape_
xml 🔒