Core

Utilities function

n_tokens


def n_tokens(
    text:str, # Text to count tokens in
    model:str='gpt-4', # Model name for tokenizer
)->int: # Nb. of tokens

Count the number of tokens in a string

txt = "This is my test text"
n_tokens(txt)
5

load_prompt


def load_prompt(
    name:str, # Name of prompt file: 'gcms', 'select_sections', 'srf_ccps', 'srf_enablers', 'srf_outputs'
    path:pathlib.Path | str | None=None, # Directory containing prompt files, defaults to 'files/prompts'
)->str: # Prompt

Load a prompt template from a markdown file

print(load_prompt('srf_ccps')[:500])
### ROLE AND PURPOSE 
You are a triage assistant supporting evaluation synthesis specialists at the International Organization for Migration (IOM). Your role is to help prioritize which evaluation reports warrant in-depth review for each of the IOM Strategic Result Framework (SRF) Cross-cutting Priorities. 

Important context about your role: 
- You are suggesting relevance, not making definitive judgments 
- Human specialists will review your assessments and make final decisions 
- Your scores