Spaces:
Runtime error
API Key error
Have been using your space for a while and has been working great until now as I am getting the following authentication error, despite the API key being correct.
AuthenticationError: Incorrect API key provided: [redacted]. You can find your API key at https://platform.openai.com/account/api-keys.
Traceback:
File "/home/user/.local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "/home/user/app/app.py", line 257, in
main(pinecone_index_name, chroma_collection_name, persist_directory,
File "/home/user/app/app.py", line 231, in main
reply, source = get_response(query, chat_history, CRqa)
File "/home/user/app/app.py", line 130, in get_response
result = CRqa({"question": query, "chat_history": chat_history})
File "/home/user/.local/lib/python3.10/site-packages/langchain/chains/base.py", line 292, in call
raise e
File "/home/user/.local/lib/python3.10/site-packages/langchain/chains/base.py", line 286, in call
self._call(inputs, run_manager=run_manager)
File "/home/user/.local/lib/python3.10/site-packages/langchain/chains/conversational_retrieval/base.py", line 134, in _call
docs = self._get_docs(new_question, inputs, run_manager=_run_manager)
File "/home/user/.local/lib/python3.10/site-packages/langchain/chains/conversational_retrieval/base.py", line 286, in _get_docs
docs = self.retriever.get_relevant_documents(
File "/home/user/.local/lib/python3.10/site-packages/langchain/schema/retriever.py", line 208, in get_relevant_documents
raise e
File "/home/user/.local/lib/python3.10/site-packages/langchain/schema/retriever.py", line 201, in get_relevant_documents
result = self._get_relevant_documents(
File "/home/user/.local/lib/python3.10/site-packages/langchain/vectorstores/base.py", line 562, in _get_relevant_documents
docs = self.vectorstore.similarity_search(query, **self.search_kwargs)
File "/home/user/.local/lib/python3.10/site-packages/langchain/vectorstores/pinecone.py", line 199, in similarity_search
docs_and_scores = self.similarity_search_with_score(
File "/home/user/.local/lib/python3.10/site-packages/langchain/vectorstores/pinecone.py", line 145, in similarity_search_with_score
self._embed_query(query), k=k, filter=filter, namespace=namespace
File "/home/user/.local/lib/python3.10/site-packages/langchain/vectorstores/pinecone.py", line 86, in _embed_query
return self._embedding.embed_query(text)
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 506, in embed_query
return self.embed_documents([text])[0]
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 478, in embed_documents
return self._get_len_safe_embeddings(texts, engine=self.deployment)
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 364, in _get_len_safe_embeddings
response = embed_with_retry(
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 107, in embed_with_retry
return _embed_with_retry(**kwargs)
File "/home/user/.local/lib/python3.10/site-packages/tenacity/init.py", line 289, in wrapped_f
return self(f, *args, **kw)
File "/home/user/.local/lib/python3.10/site-packages/tenacity/init.py", line 379, in call
do = self.iter(retry_state=retry_state)
File "/home/user/.local/lib/python3.10/site-packages/tenacity/init.py", line 314, in iter
return fut.result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/home/user/.local/lib/python3.10/site-packages/tenacity/init.py", line 382, in call
result = fn(*args, **kwargs)
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 104, in _embed_with_retry
response = embeddings.client.create(**kwargs)
File "/home/user/.local/lib/python3.10/site-packages/openai/api_resources/embedding.py", line 33, in create
response = super().create(*args, **kwargs)
File "/home/user/.local/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/home/user/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 298, in request
resp, got_stream = self._interpret_response(result, stream)
File "/home/user/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 700, in _interpret_response
self._interpret_response_line(
File "/home/user/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 765, in _interpret_response_line
raise self.handle_error_response(
Have been using your space for a while and has been working great until now as I am getting the following authentication error, despite the API key being correct.
AuthenticationError: Incorrect API key provided: [redacted]. You can find your API key at https://platform.openai.com/account/api-keys.
Traceback:File "/home/user/.local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "/home/user/app/app.py", line 257, in
main(pinecone_index_name, chroma_collection_name, persist_directory,
File "/home/user/app/app.py", line 231, in main
reply, source = get_response(query, chat_history, CRqa)
File "/home/user/app/app.py", line 130, in get_response
result = CRqa({"question": query, "chat_history": chat_history})
File "/home/user/.local/lib/python3.10/site-packages/langchain/chains/base.py", line 292, in call
raise e
File "/home/user/.local/lib/python3.10/site-packages/langchain/chains/base.py", line 286, in call
self._call(inputs, run_manager=run_manager)
File "/home/user/.local/lib/python3.10/site-packages/langchain/chains/conversational_retrieval/base.py", line 134, in _call
docs = self._get_docs(new_question, inputs, run_manager=_run_manager)
File "/home/user/.local/lib/python3.10/site-packages/langchain/chains/conversational_retrieval/base.py", line 286, in _get_docs
docs = self.retriever.get_relevant_documents(
File "/home/user/.local/lib/python3.10/site-packages/langchain/schema/retriever.py", line 208, in get_relevant_documents
raise e
File "/home/user/.local/lib/python3.10/site-packages/langchain/schema/retriever.py", line 201, in get_relevant_documents
result = self._get_relevant_documents(
File "/home/user/.local/lib/python3.10/site-packages/langchain/vectorstores/base.py", line 562, in _get_relevant_documents
docs = self.vectorstore.similarity_search(query, **self.search_kwargs)
File "/home/user/.local/lib/python3.10/site-packages/langchain/vectorstores/pinecone.py", line 199, in similarity_search
docs_and_scores = self.similarity_search_with_score(
File "/home/user/.local/lib/python3.10/site-packages/langchain/vectorstores/pinecone.py", line 145, in similarity_search_with_score
self._embed_query(query), k=k, filter=filter, namespace=namespace
File "/home/user/.local/lib/python3.10/site-packages/langchain/vectorstores/pinecone.py", line 86, in _embed_query
return self._embedding.embed_query(text)
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 506, in embed_query
return self.embed_documents([text])[0]
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 478, in embed_documents
return self._get_len_safe_embeddings(texts, engine=self.deployment)
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 364, in _get_len_safe_embeddings
response = embed_with_retry(
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 107, in embed_with_retry
return _embed_with_retry(**kwargs)
File "/home/user/.local/lib/python3.10/site-packages/tenacity/init.py", line 289, in wrapped_f
return self(f, *args, **kw)
File "/home/user/.local/lib/python3.10/site-packages/tenacity/init.py", line 379, in call
do = self.iter(retry_state=retry_state)
File "/home/user/.local/lib/python3.10/site-packages/tenacity/init.py", line 314, in iter
return fut.result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/home/user/.local/lib/python3.10/site-packages/tenacity/init.py", line 382, in call
result = fn(*args, **kwargs)
File "/home/user/.local/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 104, in _embed_with_retry
response = embeddings.client.create(**kwargs)
File "/home/user/.local/lib/python3.10/site-packages/openai/api_resources/embedding.py", line 33, in create
response = super().create(*args, **kwargs)
File "/home/user/.local/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/home/user/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 298, in request
resp, got_stream = self._interpret_response(result, stream)
File "/home/user/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 700, in _interpret_response
self._interpret_response_line(
File "/home/user/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 765, in _interpret_response_line
raise self.handle_error_response(
Thanks for letting me know. I restarted the space. Could you please check if it works now?
The issue is gone after restarting the space. It is closed now.