https://promptfoo.dev/ logo
Getting an OpenAI Api Key not found error while tr...
# ❓|questions
b
I'm following a tutorial in the docs
Copy code
defaultTest:
  options:
    provider: openai:gpt-4o
description: Pharmaceuticals - Is information accurate (Lisinopril Side Effects)
env:
  OPENAI_API_KEY: >-
    some-key
evaluateOptions: {}
prompts:
  - What are the common side effects of the drug {{drug_name}}?
providers:
  - id: openai:gpt-4o-mini
    config:
      apiKey: >-
        some-key
      organization: ''
      temperature: 0.5
      max_tokens: 1024
      top_p: 1
      frequency_penalty: 0
      presence_penalty: 0
scenarios: []
tests:
  - description: ''
    vars:
      drug_name: Lisinopril
    assert:
      - type: context-recall
        value: >-
          Common side effects include dizziness, cough, high potassium levels
          (hyperkalemia), and fatigue.
        provider: openai:gpt-4o-mini
i
hmm - does it work if you set the
OPENAI_API_KEY
envar instead of the
env
config key?
b
it only works when I set it at the app level when I run promptfoo in a container
but when i pass it through the spec it doesn't work
i mean if you can test it.... just take my spec and run it with your own openAI api key and see I think it will fail (if your promptfoo server doesnt have it set at an env var level)
i
I see. Yeah the issue is that the config
env
property is not applied properly in provider overrides
2 Views