poeaudits
09/08/2025, 6:23 PMaaronv (BAML)
09/08/2025, 6:25 PMpoeaudits
09/08/2025, 6:29 PMaaronv (BAML)
09/08/2025, 6:29 PMaaronv (BAML)
09/08/2025, 6:30 PMpoeaudits
09/08/2025, 6:30 PMaaronv (BAML)
09/08/2025, 6:31 PMaaronv (BAML)
09/08/2025, 6:31 PMpoeaudits
09/08/2025, 6:33 PMaaronv (BAML)
09/08/2025, 6:34 PM{
id: 123
filter: false
reason: the id456 is blahblahblah
}aaronv (BAML)
09/08/2025, 6:35 PMaaronv (BAML)
09/08/2025, 6:35 PMpoeaudits
09/08/2025, 6:42 PMclass Message {
id int @description("Unique identifier for the message")
text string @description("The message to evaluate")
}
class MessageResponse {
id int @description("Unique identifier for the message")
filter bool @description("Whether the message meets the specified criteria")
reason string @description("The reason for the classification")
}
function Filter(messages: Message[]) -> MessageResponse[] {
...
}
I could be more explicit in my descriptions.
I'm taking a python dataframe, selecting the relevant columns (id, message), converting it to a dict, batching them into N groups, and passing those into the function. Grabbing all the messages with (filter == True), combining them into a dataframe, and finally joining the original dataframe and the filtered results together.poeaudits
09/08/2025, 7:28 PMBest practices
Structure prompts with static or repeated content at the beginning and dynamic, user-specific content at the end.
Use the
prompt_cache_key
parameter consistently across requests that share common prefixes. Select a granularity that keeps each unique prefix-prompt_cache_key combination below 15 requests per minute to avoid cache overflow.
Monitor your cache performance metrics, including cache hit rates, latency, and the proportion of tokens cached, to refine your strategy.
Maintain a steady stream of requests with identical prompt prefixes to minimize cache evictions and maximize caching benefits.
Is the prompt_cache_key an available option in baml for openai models? Is it used automatically? I don't seem to see it in the docs, only for anthropic.aaronv (BAML)
09/10/2025, 7:44 PMclient MyClient {
options {
promptCacheKey "hi"
}
}jkonowitch
10/14/2025, 4:06 PM