emcf / thepipe

Extract markdown and images from URLs, PDFs, docs, slides, and more, ready for multimodal LLMs. ⚡
https://thepi.pe
MIT License
814 stars 61 forks source link

No longer working after addition of THEPIPE_API_KEY #9

Closed jamespet77 closed 2 months ago

jamespet77 commented 2 months ago

I have added the env var THEPIPE_API_KEY to my .env, .bashrc and at the commandline. It is not getting accepted.

{response['error']}") ValueError: Valid environment variable THEPIPE_API_KEY not found. You may need to restart if you have set your API key. Visit https://thepi.pe/docs to learn more.

emcf commented 2 months ago

Hi @jamespet77 , did you set THEPIPE_API_KEY to your API key? If so, I'd love to get this fixed for you at our discord https://discord.gg/khsB3667 and push a change to resolve the bug.

jamespet77 commented 2 months ago

Yes.
I did find a workaround. I added

import dotenv dotenv.load_dotenv()

to extractor.py

I am not sure why it is not picking up my env vars, but this allowed it to grab my ".env" for the project.

If there is an alternative that is recommended, I am not seeing it in the current documentation. Screenshot_20240418_112058

emcf commented 2 months ago

@jamespet77 Thanks! I think I understand this issue a bit better now -- a system-wide environment variable must be set (the equivalent of export THEPIPE_API_KEY=yourkeyhere in linux), not a .env file environment variable. I will make the readme more clear on this until I can push a change to support this fix. It must also be valid, so if the key is invalid it will return this message.

jamespet77 commented 2 months ago

I tried the system wide in in .bashrc and that did not work either. Maybe it was formatted wrong?? Either way, it would be nice to have it local so that I can use a project specific KEY for it.

emcf commented 2 months ago

@jamespet77 I added the dotenv load as you suggested: #3fdda829b2bd82e53926dc0d5bf8fc363e668fa8

Although, if this does not work for you, you can send me your API key at emmett@thepi.pe and I will investigate this deeper. You can also use it without an API key (see the local installation section).

Thanks for already having spent the time to help with that workaround.