Skip to content

Conversation

@jqnatividad
Copy link
Collaborator

resolves #3023

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the describegpt command by migrating from a manual string replacement approach to using the minijinja template engine for prompt processing. This aligns describegpt with other qsv commands (template and fetchpost) that already leverage minijinja for dynamic content generation. Additionally, the PR includes improvements to JSON extraction logic to better handle common formatting issues from LLM responses.

Key Changes

  • Replaced manual string replacement (.replace("{VARIABLE}", value)) with minijinja template engine rendering
  • Updated template syntax in resources/describegpt_defaults.toml from {VARIABLE} to {{ variable }} (Jinja2 syntax)
  • Enhanced JSON extraction with automatic fixing of common issues (unescaped newlines, tabs, carriage returns in strings)
  • Added fallback patterns for extracting JSON from LLM responses with both non-greedy and greedy regex matching

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
src/cmd/describegpt.rs Integrated minijinja for template rendering, replaced manual string substitution with context-based rendering, improved JSON extraction with auto-fixing logic for malformed responses, and updated documentation
resources/describegpt_defaults.toml Migrated all prompt templates from {VARIABLE} to {{ variable }} Jinja2 syntax, added conditional logic with {% if %} blocks, used {% raw %} blocks to escape JSON examples, and updated variable documentation

jqnatividad and others added 8 commits December 14, 2025 13:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jqnatividad jqnatividad merged commit fe3702f into master Dec 14, 2025
15 of 16 checks passed
@jqnatividad jqnatividad deleted the 3023-describegpt-minijinja branch December 14, 2025 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

describegpt: more configurable LLM prompt template using minijinja engine

2 participants