Find answers from the community

Updated 5 months ago

Hello - I am testing LlamaParse and

At a glance
Hello - I am testing LlamaParse and using VectorStoreIndex. I get an API error - LocalProtocolError: Illegal hearder value b'Bearer '. I know this relates to the OpenAI API key. I set this is an enviroment variable and it is correct. I am not sure how to solve this. Any ideas?
W
J
8 comments
Can you share more error trace, need to check where the error is actually taking place
---------------------------------------------------------------------------
LocalProtocolError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py in map_httpcore_exceptions()
68 try:
---> 69 yield
70 except Exception as exc:

58 frames
LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

LocalProtocolError Traceback (most recent call last)
LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

APIConnectionError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/openai/_base_client.py in _request(self, cast_to, options, remaining_retries, stream, stream_cls)
950
951 log.debug("Raising connection error")
--> 952 raise APIConnectionError(request=request) from err
953
954 log.debug(

APIConnectionError: Connection error.
when i call : recursive_index=VectorStoreIndex(nodes=base_nodes+objects,)
How have you saved the value in your env?

Print it and check, it should be just the APIkey and nothing else
I have checked when printing and is just the API Key. I used os.environ['OPENAI_API_KEY']= to store it.
I was working in Google Colab but will test it on my local machine now Macbook Pro M1. Wondering if it is a package version issue maybe?
I had the same issue with the LLAMA_CLOUD_API_KEY which only worked if i specifically set it again with api_key = in LlamaParse - so it is as if it does not recognise the environment variables. I don't know how to overcome that with VectorStoreIndex as I can not manually set it
@WhiteFang_Jr I reinstalled in virtual environment locally and seems to work. So suspect something went wrong with the installation in Google Colab. Thanks for taking the time to have a look and respond
Add a reply
Sign up and join the conversation on Discord