Repository: promptfoo/promptfoo
Issue: Unexpected token error when running openAI assistant provider
Root cause: External Dependency Breakage

I tried running exactly the same openAI assistant. It ran smoothly on version 0.87 but it failed on version 0.88 & 0.89

```yaml
  - label: "[Albert] Eval Example | Assistant + function call"
    id: "openai:assistant:asssxxxx"
    config:
      temperature: 0.2
      model: gpt-4o
      tools: file://provider/datamodel/__generated__/openai_tools/sample.yaml
```

Error logs on promptfoo's UI
```shell
SyntaxError: Unexpected token 'A', "[Assistant]"... is not valid JSON

SyntaxError: Unexpected token 'A', "[Assistant]"... is not valid JSON
    at JSON.parse (<anonymous>)
    at eval (eval at getInlineTransformFunction (/Users/albertlieadrian/Documents/Random/ai-llm-playground/evals/node_modules/promptfoo/dist/src/util/transform.js:75:12), <anonymous>:3:13)
    at transform (/Users/albertlieadrian/Documents/Random/ai-llm-playground/evals/node_modules/promptfoo/dist/src/util/transform.js:105:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Evaluator.runEval (/Users/albertlieadrian/Documents/Random/ai-llm-playground/evals/node_modules/promptfoo/dist/src/evaluator.js:238:48)
    at async processEvalStep (/Users/albertlieadrian/Documents/Random/ai-llm-playground/evals/node_modules/promptfoo/dist/src/evaluator.js:527:25)
```

<img width="917" alt="Screenshot 2024-09-19 at 3 23 55 AM" src="https://github.com/user-attachments/assets/bb3fe754-bfbb-43c4-a86c-5bed1bd9ead5">


The issues seem to be caused by the prompt is not loaded from `vars` from javascript file correctly e.g.

https://www.promptfoo.dev/docs/configuration/parameters/#examples

```javascript

module.exports = async function ({ vars }) {
  return vars.prompt;
};
```

And somehow the prompt being passed to openAI is still `Tell me about ${vars.topic}`

Maybe some issues here? 
https://github.com/promptfoo/promptfoo/blob/e4053b25e15593d4cf01dc9a0ba799d686024bfd/src/evaluatorHelpers.ts#L47

Same issue https://github.com/promptfoo/promptfoo/issues/1720

Found the actual bug

It's because the function passed from js file is not resolved properly

https://github.com/promptfoo/promptfoo/blob/e4053b25e15593d4cf01dc9a0ba799d686024bfd/src/evaluatorHelpers.ts#L105-L111

I tried printing `prompt` and it doesn't have function object in 0.89. but it has in 0.87

Logs in 0.89
```shell
// prompt 
{
  raw: 'async function ({ vars }) {\n  return vars.prompt;\n}',
  label: 'prompts/load_building_prompt_builder.js',
  config: undefined
}
```

In 0.87
```
//prompt 
{
  raw: 'async function ({ vars }) {\n  return vars.prompt;\n}',
  label: 'prompts/load_building_prompt_builder.js',
  function: [Function: function],
  config: undefined
}
```

And the `function` is gone after this line  on v0.88 and 89 https://github.com/promptfoo/promptfoo/blob/e4053b25e15593d4cf01dc9a0ba799d686024bfd/src/config.ts#L430

https://github.com/promptfoo/promptfoo/blob/e4053b25e15593d4cf01dc9a0ba799d686024bfd/src/prompts/processors/javascript.ts#L22-L36

https://github.com/promptfoo/promptfoo/blob/e4053b25e15593d4cf01dc9a0ba799d686024bfd/src/prompts/index.ts#L96-L98

Breaking PR https://github.com/promptfoo/promptfoo/pull/1659/files @mldangelo 

Thank you for the detailed investigation and reporting this issue @albertlieyingadrian! I just reverted that PR and I'll get a release out now. 

Hi @albertlieyingadrian, we issued a 0.89.3 that should resolve this issue. Thank you so much for your detailed investigation and help in fixing this!  Please feel free to comment or reopen the issue if you notice anything else.