Promptfoo

Latest version: v0.1.0

Safety actively analyzes 715032 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 11 of 28

0.51.0

Breaking update to python custom assertions

Python assertions now expect a `get_assert` function which returns a native value, rather than parsing stdout (594). This means instead of:

py
print(json.dumps((result))


You should just return the assertion result:

py
return result


Here's a full example of a `custom_assert.py`:

py
def get_assert(output, context) -> Union[bool, float, Dict[str, Any]]
print('Prompt:', context['prompt'])
print('Vars', context['vars']['topic']

Determine the result...
result = test_output(output)

Here's an example GradingResult dict
result = {
'pass': True,
'score': 0.6,
'reason': 'Looks good to me',
}
return result


See [documentation](https://promptfoo.dev/docs/configuration/expected-outputs/python/#external-py)


What's Changed
* chore: improve json parsing errors by typpo in https://github.com/promptfoo/promptfoo/pull/620
* feat: ability to override path to python binary by typpo in https://github.com/promptfoo/promptfoo/pull/619
* feat(webui): store settings in localstorage by typpo in https://github.com/promptfoo/promptfoo/pull/617
* feat(azureopenai): apiKeyEnvar support by typpo in https://github.com/promptfoo/promptfoo/pull/628
* Add documentation for openai vision by CamdenClark in https://github.com/promptfoo/promptfoo/pull/637
* Support claude vision and images by CamdenClark in https://github.com/promptfoo/promptfoo/pull/639
* fix(webui): ability to save defaultTest and evaluateOptions in yaml editor by typpo in https://github.com/promptfoo/promptfoo/pull/629
* fix: assertion files use relative path by typpo in https://github.com/promptfoo/promptfoo/pull/624
* feat: add provider reference to prompt function by guilhermetk in https://github.com/promptfoo/promptfoo/pull/633
* feat(webui): "progress" page that shows provider/prompt pairs by typpo in https://github.com/promptfoo/promptfoo/pull/631
* feat: ability to import vars using glob by typpo in https://github.com/promptfoo/promptfoo/pull/641
* feat!: return values directly in python assertions by typpo in https://github.com/promptfoo/promptfoo/pull/638

New Contributors
* CamdenClark made their first contribution in https://github.com/promptfoo/promptfoo/pull/637
* guilhermetk made their first contribution in https://github.com/promptfoo/promptfoo/pull/633

**Full Changelog**: https://github.com/promptfoo/promptfoo/compare/0.50.1...0.51.0

0.50.1

What's Changed
* fix: compiled esmodule interop by typpo in https://github.com/promptfoo/promptfoo/pull/613
* fix: downgrade var resolution failure to warning by typpo in https://github.com/promptfoo/promptfoo/pull/614
* fix: glob behavior on windows by typpo in https://github.com/promptfoo/promptfoo/pull/612


**Full Changelog**: https://github.com/promptfoo/promptfoo/compare/0.50.0...0.50.1

0.50.0

What's Changed
* feat(webui): download button by typpo in https://github.com/promptfoo/promptfoo/pull/482
* fix(selfhost): add support for prompts and datasets api endpoints by typpo in https://github.com/promptfoo/promptfoo/pull/600
* feat: support .mjs external imports by typpo in https://github.com/promptfoo/promptfoo/pull/601
* feat: load .env from cli by typpo in https://github.com/promptfoo/promptfoo/pull/602
* feat(webui): toggle for showing full prompt in output cell by typpo in https://github.com/promptfoo/promptfoo/pull/603
* feat: ability to use js files as `transform` by typpo in https://github.com/promptfoo/promptfoo/pull/605
* feat: ability to reference vars from other vars by typpo in https://github.com/promptfoo/promptfoo/pull/607
* fix: handling for nonscript assertion files by typpo in https://github.com/promptfoo/promptfoo/pull/608
* fix(selfhost): Consolidate to `NEXT_PUBLIC_PROMPTFOO_REMOTE_BASE_URL` by typpo in https://github.com/promptfoo/promptfoo/pull/609


**Full Changelog**: https://github.com/promptfoo/promptfoo/compare/0.49.3...0.50.0

0.49.3

What's Changed
* fix: bedrock model parsing by typpo in https://github.com/promptfoo/promptfoo/pull/593
* [fix: make llm-rubric more resilient to bad json responses.](https://github.com/promptfoo/promptfoo/commit/93fd059a13454ed7a251a90a33306fb1f3c81895) https://github.com/promptfoo/promptfoo/issues/596
* feat: display progress bar for each parallel execution by typpo in https://github.com/promptfoo/promptfoo/pull/597


**Full Changelog**: https://github.com/promptfoo/promptfoo/compare/0.49.2...0.49.3

0.49.2

What's Changed
* fix: support relative paths for custom providers by typpo in https://github.com/promptfoo/promptfoo/pull/589
* fix: gemini generationConfig and safetySettings by typpo in https://github.com/promptfoo/promptfoo/pull/590
* feat: cli watch for vars and providers by typpo in https://github.com/promptfoo/promptfoo/pull/591


**Full Changelog**: https://github.com/promptfoo/promptfoo/compare/0.49.1...0.49.2

0.49.1

What's Changed
* fix: lazy import of azure peer dependency by typpo in https://github.com/promptfoo/promptfoo/pull/586


**Full Changelog**: https://github.com/promptfoo/promptfoo/compare/0.49.0...0.49.1

Page 11 of 28

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.