Chainlit / docs

10 stars 76 forks source link

Issue on docs #55

Closed bishi3000 closed 10 months ago

bishi3000 commented 1 year ago

Path: /examples/openai-sql

I tried running this example and it seems that the Prompt Playground doesn't work.

I get the following error when clicking on the "Inspect in prompt playground" icon.

"Prompt Playground error: No LLM provider available"

willydouhard commented 1 year ago

The issue is that no OPENAI_API_KEY environment variable is defined. You are probably setting the API key directly in the openai python package. LLM providers are detected by chainlit though specific environment variables.

bishi3000 commented 1 year ago

Thanks @willydouhard that fixed the issue.

I was setting my openai key in the code but not as an environment variable.

export OPENAI_API_KEY='<my api key>'

fixed it

wangpengfei2048 commented 9 months ago

I have a similar problem, how to set the environment variables which chainlit though specific ??

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

But I want to use it with the config, should I set the user_env = [] in chainlit config file ?

what is the format with user_env ? Is there a example?

willydouhard commented 9 months ago

User env is useful to require one OPENAI_API_KEY per user. You should use it if you want your user to pay their openai consumption individually.

If you just want to setup a global OPENAI_API_KEY for all of your users, just add it in a .env file.