gianfree
07/12/2024, 1:41 PMnpx promptfoo@latest generate dataset --config generate_dataset.yaml I get the following error:
SyntaxError: "undefined" is not valid JSON
at JSON.parse (<anonymous>)
at synthesize (/Users/username/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/testCases.js:253:27)
at async Command.<anonymous> (/Users/username/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/commands/generate.js:157:25)
generate_dataset.yaml contains the following:
prompts:
- 'Act as a travel guide for {{location}}'
- 'I want you to act as a travel guide. I will write you my location and you will suggest a place to visit near my location. In some cases, I will also give you the type of places I will visit. You will also suggest me places of similar type that are close to my first location. My current location is {{location}}'
providers:
- id: azureopenai:chat:deploymentNameHere
config:
apiHost: 'xxxxxxxx.openai.azure.com'
tests:
- vars:
location: 'San Francisco'
- vars:
location: 'Wyoming'
- vars:
location: 'Kyoto'
- vars:
location: 'Great Barrier Reef'
Normal evaluation using a promptfooconfig.yaml file with same provider works perfectly. Any ideas on what could be wrong? Thanks!michaelmichaelmichael
07/12/2024, 6:36 PMgianfree
07/15/2024, 8:26 AMmichaelmichaelmichael
07/15/2024, 8:26 AMmichaelmichaelmichael
07/15/2024, 8:27 AMmichaelmichaelmichael
07/15/2024, 8:28 AMgianfree
07/15/2024, 11:31 AMgianfree
07/15/2024, 11:35 AMGenerating...
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 2% | ETA: 1s | 2/100/Users/username/.npm/_npx/81bbc6515d992ace/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:14
throw new Error(value);
^
Error: Invariant failed: Expected purpose to be a string, got: undefined
at invariant (/Users/username/.npm/_npx/81bbc6515d992ace/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:14:11)
at getPurpose (/Users/username/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/redteam/index.js:49:34)
at async synthesize (/Users/username/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/redteam/index.js:73:41)
at async doGenerateRedteam (/Users/username/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/commands/generate.js:76:26)
Node.js v20.9.0
Again I am using Azure as a provider (the config file is the same as above, but no tests). Do you have suggestions also for this issue?michaelmichaelmichael
07/15/2024, 12:59 PMgianfree
07/16/2024, 8:45 AM--provider but I got a few errors (reported below in order of appearance):
- You must specify at least 1 provider (for example, openai:gpt-4o) -> so I added the provider also in the yaml file (so provider is present in the yaml and passed when lunching the red-teaming feature)
- Error: Invariant failed: Expected purpose to be a string, got: undefined -> so I passed --purpose 'testing'
- Error: Invariant failed: Expected generatedPrompts to be a string -> at the moment I am stuck here
Any ideas about the last error?michaelmichaelmichael
07/16/2024, 2:59 PMgianfree
07/17/2024, 1:25 PMgianfree
07/23/2024, 6:15 PMmatteo_sir_
11/28/2025, 3:18 PMmatteo_sir_
11/28/2025, 3:29 PM