How to Customize Prompt Templates in Hiring-Agent: 3 Methods Explained
Yes, you can fully customize prompt templates in InterviewStreet's hiring-agent by editing the Jinja2 files in prompts/templates/, registering new templates in the TemplateManager class, or supplying a custom template directory at runtime.
The hiring-agent repository uses Jinja2 templating to construct LLM prompts for each resume section. According to the source code in prompts/template_manager.py, the TemplateManager class orchestrates template loading and rendering, allowing you to modify extraction behavior, JSON output schemas, and system instructions without changing the core extraction logic.
How Template Management Works
The TemplateManager Class
The orchestration lives in prompts/template_manager.py. The TemplateManager class is instantiated (for example, in pdf.py) with a default template directory of prompts/templates.
During construction, it calls _load_templates(), which builds a hard-coded dictionary mapping section names to Jinja file names:
# From prompts/template_manager.py - conceptual structure
"basics": "basics.jinja"
"work": "work.jinja"
"education": "education.jinja"
When processing a section, PDFHandler requests a rendered prompt via render_template(section_name, text_content=...), which returns the final prompt string ready for the LLM.
Default Template Locations
All default templates reside under prompts/templates/:
basics.jinja– Extracts name, email, phone, location, and profileswork.jinja– Extracts job history and employment detailseducation.jinja– Extracts academic backgroundskills.jinja– Extracts technical and soft skillsprojects.jinja– Extracts project descriptionsawards.jinja– Extracts awards and recognitionssystem_message.jinja– Wrapper template used for every section that receives thesection_name_paramvariable
Three Ways to Customize Prompt Templates
Method 1: Edit Existing Jinja Files
The simplest approach is to modify the existing template files directly. Open any file under prompts/templates/ (e.g., basics.jinja) and change the wording, add extra instructions, or modify the JSON schema that the LLM must return.
The next time render_template() is called for that section, it will use your revised wording immediately.
Method 2: Add New Section Templates
To extract custom data points, create entirely new templates:
-
Create a new file
certifications.jinjainsideprompts/templates/ -
Add an entry to the
template_filesdictionary inTemplateManager._load_templates():"certifications": "certifications.jinja" -
Call
render_template("certifications", text_content=...)from your code, or extendPDFHandlerwith a new extractor method
This approach allows you to invoke custom extractions using the same infrastructure as built-in sections.
Method 3: Change the Template Directory
To keep templates separate from the source tree (e.g., for user-specific overrides), pass a different path when constructing TemplateManager:
from prompts.template_manager import TemplateManager
# Use custom template directory
tm = TemplateManager(template_dir="./my_custom_templates")
You can implement this by subclassing PDFHandler or modifying the instantiation in pdf.py.
Practical Implementation Examples
Rendering a Template Manually
from prompts.template_manager import TemplateManager
tm = TemplateManager() # Uses default prompts/templates directory
prompt = tm.render_template(
"basics",
text_content="John Doe\njohn@example.com\nSan Francisco, CA"
)
print(prompt) # Final Jinja-rendered prompt ready for LLM
Adding a Runtime Template Without Source Modification
# Create my_templates/custom_section.jinja
"""
Extract certification data from the resume text.
{{ text_content }}
Return JSON with fields: "name", "issuer", "date".
"""
# Runtime usage
tm = TemplateManager(template_dir="./my_templates")
# Manually register the mapping
tm._templates["custom"] = tm.env.get_template("custom_section.jinja")
prompt = tm.render_template("custom", text_content=resume_text)
Extending PDFHandler for a New Section
# In pdf.py or your subclass
def extract_certifications_section(self, resume_text: str):
prompt = self.template_manager.render_template(
"certifications", text_content=resume_text
)
if not prompt:
return None
return self._call_llm_for_section(
"certifications",
resume_text,
prompt,
CertificationsSection # Your Pydantic model
)
Summary
- Edit existing templates by modifying Jinja files in
prompts/templates/to change wording or output schemas for standard sections like basics, work, and education - Add new templates by creating
.jinjafiles and registering them inTemplateManager._load_templates()to support custom extraction sections - Override template directories by passing
template_dirto theTemplateManagerconstructor to maintain user-specific template collections outside the repository - Access templates at runtime via
render_template(section_name, text_content=...)which returns fully-rendered prompts ready for LLM submission
Frequently Asked Questions
Where are the default prompt templates stored in hiring-agent?
The default templates are located in the prompts/templates/ directory. This includes basics.jinja, work.jinja, education.jinja, skills.jinja, projects.jinja, awards.jinja, and system_message.jinja. The TemplateManager class in prompts/template_manager.py loads these files by default when instantiated without a custom template_dir parameter.
Can I add custom resume sections without modifying the source code?
Yes, you can add custom sections at runtime by placing new Jinja files in a custom directory and using TemplateManager(template_dir="your/path"). Alternatively, you can monkey-patch the TemplateManager._templates dictionary at runtime to register new templates without editing the source files in the repository.
What templating engine does hiring-agent use for prompts?
Hiring-agent uses Jinja2 for template rendering. The TemplateManager class maintains a Jinja environment (self.env) that loads templates from the specified directory and renders them with variables like text_content and section_name_param.
How do I change the system message for all resume sections?
Edit the system_message.jinja file in prompts/templates/. This template acts as a wrapper for every section and receives the section_name_param variable (as seen in line 79-80 of pdf.py). Modifying this file changes the overall tone, instruction set, or formatting requirements for all extractions simultaneously.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →