Chainlit / docs

9 stars 60 forks source link

"Prompt Playground error: No LLM provider available" #84

Open wangpengfei2048 opened 7 months ago

wangpengfei2048 commented 7 months ago

I get the following error when clicking on the "Inspect in prompt playground" icon. "Prompt Playground error: No LLM provider available"

If I set the .env file(include the OPENAI_API_KEY and OPENAI_API_BASE), there is no this problem.

but I what to set it with the config ? how the set the env? Is there some example?

willydouhard commented 7 months ago

To use the prompt playground you have to at least enable one LLM provider. LLM providers are enabled through specific environment variables such as OPENAI_API_KEY.

The easiest way to define it is to create a .env file at the same level as your app file such as:

OPENAI_API_KEY="sk..."
wangpengfei2048 commented 7 months ago
 If use the .env file , it is OK.  
 I use other way,  it is OK, too.  I set the uesr_env in the file 'chainlit-config.toml':

uesr_env=["OPENAI_API_KEY"] But I dont know why? I dont set the environment variables for OPENAI_API_KEY

willydouhard commented 6 months ago

That is weird. Either way you should not put secrets in the chainlit config as you might commit it to your repo.

wangpengfei2048 commented 6 months ago

All user use the same key, I set the key in the .env file