An LLM is producing wrong/inaccurate short answers: examine the prompt and tweak its hyperparameters (temperature, number of tokens, etc.) to fix it.
Asked in the onsite test stage.
Implement choose_llm_hyperparameters(prompt, trials). prompt is a string. trials is a list of objects containing prompt, temperature, max_tokens, response, and expected. Consider only trials whose prompt exactly matches the target. Normalize response and expected by trimming, collapsing whitespace, and ignoring case. Return the configuration with the highest exact-match accuracy. Break ties by lower temperature, then lower max_tokens. Return None if no matching trials exist.
Example: matching configurations with accuracies 1.0 and 0.5 return the first configuration.
def choose_llm_hyperparameters(prompt, trials):