Python scripts in prompts does not work with anthropic as provider
harsh-writesonic opened this issue · comments
harsh-writesonic commented
Stacktrace:
/usr/local/lib/node_modules/promptfoo/dist/src/prompts.js:225
args: [JSON.stringify(context)],
^
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Anthropic'
| property 'completions' -> object with constructor 'Completions'
--- property '_client' closes the circle
at JSON.stringify (<anonymous>)
promptfooconfig.yaml
prompts:
- file://prompt.py
providers:
- openai:gpt-4o
- anthropic:messages:claude-3-opus-20240229
Nodejs version - v20.12.2
Promptfoo version - 0.58.1
Please let me know if it is reproducible for you.
Ian Webster commented
Thanks for flagging! Fix in #784
As a temporary workaround, you can switch to using a specific function in the python file, e.g. prompt.py:my_prompt
. That should work alright in the current version.
harsh-writesonic commented
Thanks for quick fix.
Ian Webster commented
Released in 0.59.0!