System Instruction
This is the system instruction class This provides one file where you can modify your system instructions to see which instruction gives you the best results
This is the system instruction class This provides one file where you can modify your system instructions to see which instruction gives you the best results
This is the input class In the get_input_text method, the input text is formatted to a) split it into sentences b) prepend a sentence number to each sentence This formatting does matter – in fact it matters quite a lot – when you are extracting structured output, since the sentence numbers can be used to…
This method lets you call the OpenRouter API, pass in a specific Pydantic schema, and get a response which should conform to the schema that you sent. There is a lot more going on in this code than what is the absolute minimum necessary, so let me focus on the main part This is the…
Which LLM to choose? How to decide on the schema? How to engineer the prompt to get the most out of your investment?
This is the basic idea Declare a Pydantic class like this The prompt will look like this Call the LLM And then you will do a bunch of post processing to check if the response is valid JSON, and whether it conforms to the provided Pydantic schema etc (with GPT5 both of these are usually…
Last updated 20 Aug 2025 Here is something you can do using GPT5 Given this input clinical narrative (sentence number prefixes were programmatically added): [1] VAERS ID: 190064 (history) [2] Form: Version 1.0 Age[3] : 1.33 Sex: Male Location: Georgia Vaccinated: 1999-06-30Onset: 0000-00-00Submitted: 2004-03-08Entered: 2002-09-12 Days after submission: 544VaccinÂation / ManuÂfacturer Lot / Dose Site…
Compare the visualizations of two outputs to see which one is better Use AI to build the tools to speed up the process
This is the most important part of the Prompt Engineering workflow You need to build a tool which allows you to easily visualize these citations. Here is an example. The citations are clickable. And clicking on them will jump to that specific sentence number in the top input box.
Add fields into the schema which asks for citation numbers for all the sentences which are relevant to the information which was extracted For example consider these classes And this is how it can be used By asking for citation numbers you can see which sentence from the input text has the information, and this…
Adding sentence numbers to the input text is an important part of this Prompt Engineering Workflow 1 Split the input text into sentences using spaCy NLP library 2 Add the sentence number as a prefix to the sentence 3 Send this “annotated” text as part of the prompt Here is an example VAERS report with…