promptfoo / promptfoo

Test your prompts, agents, and RAGs. Use LLM evals to improve your app's quality and catch problems. Compare performance of GPT, Claude, Gemini, Llama, and more. Simple declarative configs with command line and CI/CD integration.

Home Page:https://www.promptfoo.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is custom Python/Javascript assertion available through the evaluate() node module?

anthonyivn2 opened this issue · comments

Related to the question related to PR #668. I would like to be able to define custom assertions in Python/Javascript and then use it with the evaluate() node module

Yes, both of these assertion types are supported via promptfoo.evaluate.

In the case of javascript asserts, you can supply a function directly as the assertion value. I notice an inconsistency in how functions are called between external js files/inline js functions vs functions directly provided via evaluate, which will be addressed in #674

Ok noted, thank you!