The biggest challenge to make this whole application work was to make Large Language Models output JSON!
The trick for me was to use this line of prompting:
You are going to write a JSON resume section for an applicant applying for job posts.
Consider the following CV:
<CV_TEXT>
Now consider the following TypeScript Interface for the JSON schema:
interface Basics {
name: string;
email: string;
phone: string;
website: string;
address: string;
}
Write the basics section according to the Basic schema. On the response, include only the JSON.
It turns out that the model we use understands TypeScript quite well, which gets us good JSONs in general.
The secret was combining LaTeX with Jinja. The snippet of code from this slideshow was very helpful:
latex_jinja_env = jinja2.Environment(
block_start_string="\BLOCK{",
block_end_string="}",
variable_start_string="\VAR{",
variable_end_string="}",
comment_start_string="\#{",
comment_end_string="}",
line_statement_prefix="%-",
line_comment_prefix="%#",
trim_blocks=True,
autoescape=False,
loader=jinja2.FileSystemLoader(dir_path),
)