Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTutor only picks up OpenAI key if environment variable set BEFORE installing RTutor #46

Open
AleSR13 opened this issue Jan 27, 2023 · 2 comments

Comments

@AleSR13
Copy link

AleSR13 commented Jan 27, 2023

Thanks for helping me solve my previous issue. I managed to make a Dockerfile with RTutor and it works as expected. However, I noticed something that makes it a bit counterintuitive. The launching was perfect if I added the OpenAI key using the 'settings' button on the dashboard. However, if I used an environment variable it worked a bit different to what I expected and makes it a bit more problematic to share my Dockerfile, for instance.

I first installed RTutor, then I created the OPEN_API_KEY environment variable and then launched the dashboard with RTutor::run_app(). However, all my queries failed with an error saying that probably the API key was incorrect. If I added the same API key manually, it worked. After many attempts and looking at the code for a long time, I realized that the OPEN_API_KEY environment variable could only be set up BEFORE installing the RTutor package. If I did that, it worked as expected.

It might not be considered a bug but it could be more of an enhancement. For instance, I would have liked to make a docker image that I can use with different accounts while passing the environment variable at the moment of launching the container (with docker run -e OPEN_API_KEY=<my_api_key> rtutor). However, instead, I had to add the environment variable inside my docker container so that the image itself is bound to my account. If I change accounts, I would need to change the image as well. As said, it is not per se a problem but it could be nicer that the api_key was read at the moment of launching. In any case, this behavior could at least be a bit clearer in your documentation.

Thanks again for this lovely package!

@gexijin
Copy link
Owner

gexijin commented Jan 27, 2023

An alternative method might be to mount the current folder to the container. This way, other users can save the api key in their folder when they start the docker run. The api key file is available from inside the container.
docker run -v xxx:xxx rtutor
I will look into this when I have a little more time. If you find a solution, please let me know.

@gexijin
Copy link
Owner

gexijin commented Sep 14, 2023

I will look into this as there is another user had the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants