Skip to main content

Module prompt_parser

Module prompt_parser 

Source
Expand description

Prompt file parsing service.

Supports parsing prompt templates from multiple formats:

  • Markdown with YAML front matter (.md)
  • YAML files (.yaml, .yml)
  • JSON files (.json)
  • Plain text (.txt or no extension)

§Format Examples

§Markdown

---
name: code-review
description: Review code for issues
tags: [code, review]
---
Please review the following code:
{{code}}

§YAML

name: code-review
description: Review code for issues
content: |
  Please review the following code:
  {{code}}
tags:
  - code
  - review

§JSON

{
  "name": "code-review",
  "description": "Review code for issues",
  "content": "Please review {{code}}",
  "tags": ["code", "review"]
}

Structs§

PromptParser
Parser for prompt template files.

Enums§

PromptFormat
Supported prompt file formats.

Functions§

merge_variables 🔒
Merges explicit variable definitions with extracted variables.
parse_variable_def 🔒
Parses a variable definition from a JSON value.
serialize_variable_to_json 🔒
Serializes a PromptVariable to a JSON value for markdown front matter.