I've got ForbiddenException: (403) Reason: Forbidden HTTP response headers issue

Hey guys!

I use framework Llama to work with my LLM model. But when I’ve tried to connect Pinecone when I’ve got this issue:

ForbiddenException                        Traceback (most recent call last)
Cell In[44], line 1
----> 1 index = GPTPineconeIndex.from_documents(gpt_documents, pinecone_index=index, service_context = service_context)

File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/llama_index/indices/base.py:100, in BaseGPTIndex.from_documents(cls, documents, docstore, service_context, **kwargs)
     96     docstore.set_document_hash(doc.get_doc_id(), doc.get_doc_hash())
     98 nodes = service_context.node_parser.get_nodes_from_documents(documents)
--> 100 return cls(
    101     nodes=nodes,
    102     docstore=docstore,
    103     service_context=service_context,
    104     **kwargs,
    105 )

File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/llama_index/indices/vector_store/vector_indices.py:245, in GPTPineconeIndex.__init__(self, nodes, pinecone_index, index_name, environment, namespace, metadata_filters, pinecone_kwargs, insert_kwargs, query_kwargs, delete_kwargs, index_struct, service_context, vector_store, add_sparse_vector, tokenizer, **kwargs)
    230     vector_store = PineconeVectorStore(
    231         pinecone_index=pinecone_index,
    232         index_name=index_name,
   (...)
    241         tokenizer=tokenizer,
    242     )
    243 assert vector_store is not None
--> 245 super().__init__(
    246     nodes=nodes,
...

ForbiddenException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'content-length': '0', 'date': 'Sat, 22 Apr 2023 22:14:29 GMT', 'server': 'envoy', 'connection': 'close'})

API key is correct. Environment as well. Will appreciate any help with this issue.

1 Like

same issue here

1 Like

Same issue here:
I’m trying python example “Generative QA with OpenAI” (Generative QA with OpenAI)
I see in the console that index openai-youtube-transcriptions was correctly created
But index.describe_index_stats() triggers the following error:

ForbiddenException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({‘content-length’: ‘0’, ‘date’: ‘Sun, 23 Apr 2023 07:47:51 GMT’, ‘server’: ‘envoy’})

EDIT: Issue is found, they are working on a solution. https://status.pinecone.io/

Adding my name to the pile. I am following the Quickstart guide but am still unable to upsert to the index.

Code

import pinecone

def create_pinecone_index(index_name: str, dimensions: int, metric: str, pod_type: str) -> object:
    if index_name in pinecone.list_indexes():
        return
        # pinecone.delete_index(index_name)
    pinecone.create_index(name=index_name, dimension=dimensions, metric=metric, pod_type=pod_type)


def connect_to_quickstart(index_name: str,):
    """Main function"""
    if index_name not in pinecone.list_indexes():
        print("Index not found")
        return

    index = pinecone.Index(index_name)
    print(pinecone.whoami())
    print(pinecone.describe_index(index_name))

    index.upsert([
        ("A", [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]),
        ("B", [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]),
        ("C", [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]),
        ("D", [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4]),
        ("E", [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5])
    ])


if __name__ == '__main__':
    pinecone.init(api_key="API_KEY",
                  environment="asia-northeast1-gcp",
                  project_name="PROJECT_NAME")

    create_pinecone_index("quickstart", dimensions=8, metric="euclidean", pod_type="p1")
    connect_to_quickstart("quickstart")

Error:
WhoAmIResponse(username=‘USER_NAME’, user_label=‘default’, projectname=‘PROJECT_NAME’)
IndexDescription(name=‘quickstart’, metric=‘euclidean’, replicas=1, dimension=8.0, shards=1, pods=1, pod_type=‘p1.x1’, status={‘ready’: True, ‘state’: ‘Ready’}, metadata_config=None, source_collection=‘’)
Traceback (most recent call last):
File “D:\Python_Projects\py-pkm\venv\connection_to_quickstart.py”, line 36, in
connect_to_quickstart(“quickstart”)
File “D:\Python_Projects\py-pkm\venv\connection_to_quickstart.py”, line 21, in connect_to_quickstart
index.upsert([
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\utils\error_handling.py”, line 17, in inner_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\index.py”, line 147, in upsert
return self._upsert_batch(vectors, namespace, _check_type, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\index.py”, line 231, in _upsert_batch
return self._vector_api.upsert(
^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\client\api_client.py”, line 776, in call
return self.callable(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\client\api\vector_operations_api.py”, line 956, in __upsert
return self.call_with_http_info(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\client\api_client.py”, line 838, in call_with_http_info
return self.api_client.call_api(
^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\client\api_client.py”, line 413, in call_api
return self.__call_api(resource_path, method,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\client\api_client.py”, line 207, in __call_api
raise e
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\client\api_client.py”, line 200, in __call_api
response_data = self.request(
^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\client\api_client.py”, line 459, in request
return self.rest_client.POST(url,
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\client\rest.py”, line 271, in POST
return self.request(“POST”, url,
^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python_Projects\py-pkm\venv\Lib\site-packages\pinecone\core\client\rest.py”, line 222, in request
raise ForbiddenException(http_resp=r)
pinecone.core.client.exceptions.ForbiddenException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({‘content-length’: ‘0’, ‘date’: ‘Mon, 24 Apr 2023 21:10:09 GMT’, ‘server’: ‘envoy’})