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

Issue with Azure OpenAI API, Failed to work however much I try #1061

Open
Videmak opened this issue Jan 4, 2025 · 5 comments
Open

Issue with Azure OpenAI API, Failed to work however much I try #1061

Videmak opened this issue Jan 4, 2025 · 5 comments

Comments

@Videmak
Copy link

Videmak commented Jan 4, 2025

Describe the bug
I used openai API and everything works fine until I switched to Azure OpenAI api. I had to even redownload latest repository and used a fresh installation. Added a .env file and configures the details

This is my .env file:

AZURE_OPENAI_API_KEY=My Key Here

AZURE_OPENAI_ENDPOINT=https://namehere.openai.azure.com/
AZURE_OPENAI_API_VERSION=2024-08-01-preview
OPENAI_API_VERSION=2024-05-01-preview

# note that the deployment name must be the same as the model name
FAST_LLM=azure_openai:gpt-4o-mini

SMART_LLM=azure_openai:gpt-4o-mini

STRATEGIC_LLM=azure_openai:gpt-4o-mini

export TAVILY_API_KEY=my key here

To Reproduce
Steps to reproduce the behavior:

When I start researching, works fine until starts generating report. This is the error i egt

File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/                                                                                _base_client.py", line 957, in request
  return self._request(
         ^^^^^^^^^^^^^^
File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/                                                                                _base_client.py", line 1061, in _request
  raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrec                                                                                t API key provided: sk-proj-*************************************************                                                                                *****************************************************************************                                                                                **************************IEIA. You can find your API key at https://platform                                                                                .openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': Non                                                                                e, 'code': 'invalid_api_key'}}
INFO:     connection closed

I get wrong Key yet I even try one of the two keys provided by Azure. It gives you two keys and any works but here, none works.

@llmlocal
Copy link

llmlocal commented Jan 4, 2025

Have you tested your azure key in curl or postman to validate all elements:

You can use tools like curl or Postman to manually test the endpoint with your key and payload.

Example Postman Setup

1.	Set the method to POST.
2.	URL: https://<your-resource-name>.openai.azure.com/openai/deployments/<your-deployment-name>/completions?api-version=2023-06-01-preview.
3.	Headers:
•	Authorization: Bearer <your-azure-key>
4.	Body (JSON):

{
"prompt": "Hello, world!",
"max_tokens": 5
}

@Videmak
Copy link
Author

Videmak commented Jan 4, 2025

I have tested in Postman and getting 200 OK.
API Testing

@Videmak
Copy link
Author

Videmak commented Jan 4, 2025

I want to use Azure Openai which I tested in Postman and worked with Code 200 OK
Tested using:

Headers
Key = api-key

Value = [API KEY]

Body:

{
    "messages": [
        { "role": "system", "content": "You are a helpful assistant." },
        { "role": "user", "content": "Hello, world!" }
    ],
    "max_tokens": 5
}

POST: https://name.openai.azure.com/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-08-01-preview

This gives a 200 OK Code

Going to GPT-RESEARCHER

When I set the .env like this

AZURE_OPENAI_API_KEY=[APKI KEY]
AZURE_OPENAI_ENDPOINT=https://name.openai.azure.com/

OPENAI_API_VERSION=2024-08-01-preview


FAST_LLM=azure_openai:gpt-4o-mini 
SMART_LLM=azure_openai:gpt-4o
STRATEGIC_LLM=azure_openai:o1-preview
OPENAI_API_VERSION=2024-08-01-preview

TAVILY_API_KEY=[API KEY]

I get this error:

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/pydantic/main.py", line 214, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 338, in validate_environment
    self.client = openai.OpenAI(**client_params, **sync_specific).embeddings  # type: ignore[arg-type]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_client.py", line 110, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
INFO:     connection closed

But If I set the .env like this using OPENAI_API_KEY=:

OPENAI_API_KEY=[API-KEY]
AZURE_OPENAI_ENDPOINT=https://name.openai.azure.com/

OPENAI_API_VERSION=2024-08-01-preview

# note that the deployment name must be the same as the model name
FAST_LLM=azure_openai:gpt-4o-mini 
SMART_LLM=azure_openai:gpt-4o
STRATEGIC_LLM=azure_openai:o1-preview
OPENAI_API_VERSION=2024-08-01-preview

export TAVILY_API_KEY=[API KEY]

It works and I get this error, stops in the middle


 File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1280, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 957, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1061, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
INFO:     connection closed



@Videmak
Copy link
Author

Videmak commented Jan 4, 2025

This is all the error log. Note: Used Name to hide my endpoint id.

('172.68.42.142', 0) - "WebSocket /ws" [accepted]
INFO:     connection open
2025-01-04 20:24:03,937 - httpx - INFO - HTTP Request: POST https://name.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-08-01-preview "HTTP/1.1 200 OK"
2025-01-04 20:24:04,659 - research - INFO - Starting research for query: The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study.
INFO:     [20:24:04] 🔍 Starting the research task for 'The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study.'...
INFO:     [20:24:04] 🩺 Healthcare Research Agent
2025-01-04 20:24:04,660 - research - INFO - Using web search
2025-01-04 20:24:04,660 - research - INFO - Starting web search for query: The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study.
2025-01-04 20:24:04,660 - research - INFO - Planning research for query: The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study.
INFO:     [20:24:04] 🌐 Browsing the web to learn more about the task: The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study....
2025-01-04 20:24:08,928 - research - INFO - Initial search results obtained: 6 results
INFO:     [20:24:08] 🤔 Planning the research strategy and subtasks...
2025-01-04 20:24:09,143 - httpx - INFO - HTTP Request: POST https://name.openai.azure.com/openai/deployments/o1-preview/chat/completions?api-version=2024-08-01-preview "HTTP/1.1 404 DeploymentNotFound"
2025-01-04 20:24:09,145 - gpt_researcher.actions.query_processing - WARNING - Error with strategic LLM: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}}. Retrying with max_tokens=4000.
2025-01-04 20:24:09,145 - gpt_researcher.actions.query_processing - WARNING - See https://github.com/assafelovic/gpt-researcher/issues/1022
2025-01-04 20:24:09,344 - httpx - INFO - HTTP Request: POST https://name.openai.azure.com/openai/deployments/o1-preview/chat/completions?api-version=2024-08-01-preview "HTTP/1.1 404 DeploymentNotFound"
2025-01-04 20:24:09,345 - gpt_researcher.actions.query_processing - WARNING - Retrying with max_tokens=4000 failed.
2025-01-04 20:24:09,346 - gpt_researcher.actions.query_processing - WARNING - Error with strategic LLM: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}}. Falling back to smart LLM.
2025-01-04 20:24:10,464 - httpx - INFO - HTTP Request: POST https://name.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-08-01-preview "HTTP/1.1 200 OK"
2025-01-04 20:24:10,472 - research - INFO - Research outline planned: ['Impact of mobile health technology on hypertension management in Uganda 2022-2023', 'Rocket Health Uganda mobile technology hypertension study cross-sectional 2022-2023', 'Effectiveness of mHealth solutions for blood pressure control in Africa 2022-2023', 'Barriers and facilitators to mobile health adoption for hypertension care in Uganda']
2025-01-04 20:24:10,472 - research - INFO - Generated sub-queries: ['Impact of mobile health technology on hypertension management in Uganda 2022-2023', 'Rocket Health Uganda mobile technology hypertension study cross-sectional 2022-2023', 'Effectiveness of mHealth solutions for blood pressure control in Africa 2022-2023', 'Barriers and facilitators to mobile health adoption for hypertension care in Uganda']
INFO:     [20:24:10] 🗂️ I will conduct my research based on the following queries: ['Impact of mobile health technology on hypertension management in Uganda 2022-2023', 'Rocket Health Uganda mobile technology hypertension study cross-sectional 2022-2023', 'Effectiveness of mHealth solutions for blood pressure control in Africa 2022-2023', 'Barriers and facilitators to mobile health adoption for hypertension care in Uganda', 'The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study.']...
INFO:     [20:24:10]
🔍 Running research for 'Impact of mobile health technology on hypertension management in Uganda 2022-2023'...
INFO:     [20:24:10]
🔍 Running research for 'Rocket Health Uganda mobile technology hypertension study cross-sectional 2022-2023'...
INFO:     [20:24:10]
🔍 Running research for 'Effectiveness of mHealth solutions for blood pressure control in Africa 2022-2023'...
INFO:     [20:24:10]
🔍 Running research for 'Barriers and facilitators to mobile health adoption for hypertension care in Uganda'...
INFO:     [20:24:10]
🔍 Running research for 'The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study.'...
INFO:     [20:24:11] ✅ Added source url to research: https://www.thelancet.com/journals/eclinm/article/PIIS2589-5370(24)00011-7/fulltext

INFO:     [20:24:11] ✅ Added source url to research: https://www.researchgate.net/publication/348415766_Acceptability_and_feasibility_of_a_mobile_health_application_for_blood_pressure_monitoring_in_rural_Uganda

INFO:     [20:24:11] ✅ Added source url to research: https://journals.sagepub.com/doi/10.1177/20552076241277172?icid=int.sj-abstract.citing-articles.21

INFO:     [20:24:11] ✅ Added source url to research: https://www.researchgate.net/publication/373855146_The_effect_of_mobile_health_technology_on_blood_pressure_control_among_patients_with_hypertension_in_Ghana_and_Nigeria

INFO:     [20:24:11] ✅ Added source url to research: https://academic.oup.com/jamiaopen/article/4/3/ooaa068/6071214

INFO:     [20:24:11] 🤔 Researching for relevant information across multiple sources...

INFO:     [20:24:11] 🌐 Scraping content from 5 URLs...
INFO:     [20:24:12] 📄 Scraped 5 pages of content
INFO:     [20:24:12] 🖼️ Selected 0 new images from 0 total images
INFO:     [20:24:12] 🌐 Scraping complete
2025-01-04 20:24:12,121 - research - INFO - Scraped data size: 5
INFO:     [20:24:12] 📚 Getting relevant content based on query: Impact of mobile health technology on hypertension management in Uganda 2022-2023...
2025-01-04 20:24:12,656 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/embeddings "HTTP/1.1 401 Unauthorized"
2025-01-04 20:24:12,657 - research - ERROR - Error processing sub-query Impact of mobile health technology on hypertension management in Uganda 2022-2023: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Traceback (most recent call last):
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/researcher.py", line 270, in _process_sub_query
    content = await self.researcher.context_manager.get_similar_content_by_query(sub_query, scraped_data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/context_manager.py", line 26, in get_similar_content_by_query
    return await context_compressor.async_get_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/context/compression.py", line 71, in async_get_context
    relevant_docs = await asyncio.to_thread(compressed_docs.invoke, query)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 266, in invoke
    raise e
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 259, in invoke
    result = self._get_relevant_documents(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/contextual_compression.py", line 48, in _get_relevant_documents
    compressed_docs = self.base_compressor.compress_documents(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/base.py", line 39, in compress_documents
    documents = _transformer.compress_documents(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/embeddings_filter.py", line 73, in compress_documents
    embedded_documents = _get_embeddings_from_stateful_docs(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_community/document_transformers/embeddings_redundant_filter.py", line 71, in _get_embeddings_from_stateful_docs
    embedded_documents = embeddings.embed_documents(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 588, in embed_documents
    return self._get_len_safe_embeddings(texts, engine=engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 483, in _get_len_safe_embeddings
    response = self.client.create(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/resources/embeddings.py", line 124, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1280, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 957, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1061, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
INFO:     [20:24:13] ✅ Added source url to research: https://thesai.org/Publications/ViewPaper?Volume=13&Issue=11&Code=IJACSA&SerialNo=6

INFO:     [20:24:13] ✅ Added source url to research: https://pmc.ncbi.nlm.nih.gov/articles/PMC7675159/

INFO:     [20:24:13] ✅ Added source url to research: https://bmcmedinformdecismak.biomedcentral.com/articles/10.1186/s12911-023-02284-3

INFO:     [20:24:13] ✅ Added source url to research: https://pmc.ncbi.nlm.nih.gov/articles/PMC10543310/

INFO:     [20:24:13] ✅ Added source url to research: https://www.researchprotocols.org/2023/1/e46614/

INFO:     [20:24:13] 🤔 Researching for relevant information across multiple sources...

INFO:     [20:24:13] 🌐 Scraping content from 5 URLs...
INFO:     [20:24:15] 📄 Scraped 5 pages of content
INFO:     [20:24:15] 🖼️ Selected 2 new images from 2 total images
INFO:     [20:24:15] 🌐 Scraping complete
2025-01-04 20:24:15,307 - research - INFO - Scraped data size: 5
INFO:     [20:24:15] 📚 Getting relevant content based on query: The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study....
INFO:     [20:24:15] ✅ Added source url to research: https://www.cdc.gov/pcd/issues/2023/22_0236.htm

INFO:     [20:24:15] ✅ Added source url to research: https://pmc.ncbi.nlm.nih.gov/articles/PMC8423417/

INFO:     [20:24:15] ✅ Added source url to research: https://journals.sagepub.com/doi/abs/10.1177/20552076231225133

INFO:     [20:24:15] ✅ Added source url to research: https://www.researchgate.net/publication/360839363_Barriers_and_Facilitators_of_eHealth_Adoption_Among_Healthcare_Providers_in_Uganda_-_A_Quantitative_Study

INFO:     [20:24:15] 🤔 Researching for relevant information across multiple sources...

INFO:     [20:24:15] 🌐 Scraping content from 4 URLs...
INFO:     [20:24:17] 📄 Scraped 4 pages of content
INFO:     [20:24:17] 🖼️ Selected 0 new images from 0 total images
INFO:     [20:24:17] 🌐 Scraping complete
2025-01-04 20:24:17,130 - research - INFO - Scraped data size: 4
INFO:     [20:24:17] 📚 Getting relevant content based on query: Barriers and facilitators to mobile health adoption for hypertension care in Uganda...
INFO:     [20:24:17] ✅ Added source url to research: https://library.health.go.ug/sites/default/files/resources/Conference+Agenda_Uganda+National+Digital+Health+Conference.pdf

INFO:     [20:24:17] ✅ Added source url to research: https://onlinelibrary.wiley.com/doi/full/10.1111/hiv.13572

INFO:     [20:24:17] ✅ Added source url to research: https://www.researchgate.net/publication/351515566_Lessons_Learnt_from_Initial_Deployments_of_Rocket_Health_Telemedicine_Service_to_Deliver_Last_Mile_Medical_Services_in_Uganda

INFO:     [20:24:17] ✅ Added source url to research: https://africahealthcollaborative.org/2024/05/22/venture-spotlight-rocket-health/

INFO:     [20:24:17] ✅ Added source url to research: https://conf2023.theunion.org/wp-content/uploads/2023/12/UNION2023_Abstracts.pdf

INFO:     [20:24:17] 🤔 Researching for relevant information across multiple sources...

INFO:     [20:24:17] 🌐 Scraping content from 5 URLs...
Error loading PDF : https://library.health.go.ug/sites/default/files/resources/Conference+Agenda_Uganda+National+Digital+Health+Conference.pdf HTTPSConnectionPool(host='library.health.go.ug', port=443): Max retries exceeded with url: /sites/default/files/resources/Conference+Agenda_Uganda+National+Digital+Health+Conference.pdf (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:992)')))
2025-01-04 20:24:19,750 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/embeddings "HTTP/1.1 401 Unauthorized"
2025-01-04 20:24:22,990 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/embeddings "HTTP/1.1 401 Unauthorized"
INFO:     [20:24:27] 📄 Scraped 3 pages of content
INFO:     [20:24:27] 🖼️ Selected 4 new images from 10 total images
INFO:     [20:24:27] 🌐 Scraping complete
2025-01-04 20:24:27,140 - research - INFO - Scraped data size: 3
INFO:     [20:24:27] 📚 Getting relevant content based on query: Rocket Health Uganda mobile technology hypertension study cross-sectional 2022-2023...
INFO:     [20:24:27] ✅ Added source url to research: https://formative.jmir.org/2023/1/e45061

INFO:     [20:24:27] ✅ Added source url to research: https://pmc.ncbi.nlm.nih.gov/articles/PMC10477453/

INFO:     [20:24:27] ✅ Added source url to research: https://mhealth.jmir.org/2024/1/e50248

INFO:     [20:24:27] 🤔 Researching for relevant information across multiple sources...

INFO:     [20:24:27] 🌐 Scraping content from 3 URLs...
2025-01-04 20:24:27,294 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/embeddings "HTTP/1.1 401 Unauthorized"
INFO:     [20:24:28] 📄 Scraped 3 pages of content
INFO:     [20:24:28] 🖼️ Selected 1 new images from 1 total images
INFO:     [20:24:28] 🌐 Scraping complete
2025-01-04 20:24:28,370 - research - INFO - Scraped data size: 3
INFO:     [20:24:28] 📚 Getting relevant content based on query: Effectiveness of mHealth solutions for blood pressure control in Africa 2022-2023...
2025-01-04 20:24:29,215 - research - ERROR - Error processing sub-query Barriers and facilitators to mobile health adoption for hypertension care in Uganda: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Traceback (most recent call last):
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/researcher.py", line 270, in _process_sub_query
    content = await self.researcher.context_manager.get_similar_content_by_query(sub_query, scraped_data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/context_manager.py", line 26, in get_similar_content_by_query
    return await context_compressor.async_get_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/context/compression.py", line 71, in async_get_context
    relevant_docs = await asyncio.to_thread(compressed_docs.invoke, query)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 266, in invoke
    raise e
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 259, in invoke
    result = self._get_relevant_documents(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/contextual_compression.py", line 48, in _get_relevant_documents
    compressed_docs = self.base_compressor.compress_documents(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/base.py", line 39, in compress_documents
    documents = _transformer.compress_documents(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/embeddings_filter.py", line 73, in compress_documents
    embedded_documents = _get_embeddings_from_stateful_docs(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_community/document_transformers/embeddings_redundant_filter.py", line 71, in _get_embeddings_from_stateful_docs
    embedded_documents = embeddings.embed_documents(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 588, in embed_documents
    return self._get_len_safe_embeddings(texts, engine=engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 483, in _get_len_safe_embeddings
    response = self.client.create(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/resources/embeddings.py", line 124, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1280, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 957, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1061, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
2025-01-04 20:24:29,230 - research - ERROR - Error processing sub-query The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study.: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Traceback (most recent call last):
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/researcher.py", line 270, in _process_sub_query
    content = await self.researcher.context_manager.get_similar_content_by_query(sub_query, scraped_data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/context_manager.py", line 26, in get_similar_content_by_query
    return await context_compressor.async_get_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/context/compression.py", line 71, in async_get_context
    relevant_docs = await asyncio.to_thread(compressed_docs.invoke, query)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 266, in invoke
    raise e
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 259, in invoke
    result = self._get_relevant_documents(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/contextual_compression.py", line 48, in _get_relevant_documents
    compressed_docs = self.base_compressor.compress_documents(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/base.py", line 39, in compress_documents
    documents = _transformer.compress_documents(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/embeddings_filter.py", line 73, in compress_documents
    embedded_documents = _get_embeddings_from_stateful_docs(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_community/document_transformers/embeddings_redundant_filter.py", line 71, in _get_embeddings_from_stateful_docs
    embedded_documents = embeddings.embed_documents(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 588, in embed_documents
    return self._get_len_safe_embeddings(texts, engine=engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 483, in _get_len_safe_embeddings
    response = self.client.create(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/resources/embeddings.py", line 124, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1280, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 957, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1061, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
2025-01-04 20:24:29,275 - research - ERROR - Error processing sub-query Rocket Health Uganda mobile technology hypertension study cross-sectional 2022-2023: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Traceback (most recent call last):
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/researcher.py", line 270, in _process_sub_query
    content = await self.researcher.context_manager.get_similar_content_by_query(sub_query, scraped_data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/context_manager.py", line 26, in get_similar_content_by_query
    return await context_compressor.async_get_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/context/compression.py", line 71, in async_get_context
    relevant_docs = await asyncio.to_thread(compressed_docs.invoke, query)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 266, in invoke
    raise e
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 259, in invoke
    result = self._get_relevant_documents(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/contextual_compression.py", line 48, in _get_relevant_documents
    compressed_docs = self.base_compressor.compress_documents(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/base.py", line 39, in compress_documents
    documents = _transformer.compress_documents(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/embeddings_filter.py", line 73, in compress_documents
    embedded_documents = _get_embeddings_from_stateful_docs(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_community/document_transformers/embeddings_redundant_filter.py", line 71, in _get_embeddings_from_stateful_docs
    embedded_documents = embeddings.embed_documents(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 588, in embed_documents
    return self._get_len_safe_embeddings(texts, engine=engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 483, in _get_len_safe_embeddings
    response = self.client.create(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/resources/embeddings.py", line 124, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1280, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 957, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1061, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
2025-01-04 20:24:33,596 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/embeddings "HTTP/1.1 401 Unauthorized"
2025-01-04 20:24:33,597 - research - ERROR - Error processing sub-query Effectiveness of mHealth solutions for blood pressure control in Africa 2022-2023: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Traceback (most recent call last):
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/researcher.py", line 270, in _process_sub_query
    content = await self.researcher.context_manager.get_similar_content_by_query(sub_query, scraped_data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/skills/context_manager.py", line 26, in get_similar_content_by_query
    return await context_compressor.async_get_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/gpt_researcher/context/compression.py", line 71, in async_get_context
    relevant_docs = await asyncio.to_thread(compressed_docs.invoke, query)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 266, in invoke
    raise e
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_core/retrievers.py", line 259, in invoke
    result = self._get_relevant_documents(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/contextual_compression.py", line 48, in _get_relevant_documents
    compressed_docs = self.base_compressor.compress_documents(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/base.py", line 39, in compress_documents
    documents = _transformer.compress_documents(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain/retrievers/document_compressors/embeddings_filter.py", line 73, in compress_documents
    embedded_documents = _get_embeddings_from_stateful_docs(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_community/document_transformers/embeddings_redundant_filter.py", line 71, in _get_embeddings_from_stateful_docs
    embedded_documents = embeddings.embed_documents(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 588, in embed_documents
    return self._get_len_safe_embeddings(texts, engine=engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 483, in _get_len_safe_embeddings
    response = self.client.create(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/resources/embeddings.py", line 124, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1280, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 957, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/bitnami/gpt-researcher/env/lib/python3.11/site-packages/openai/_base_client.py", line 1061, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 8wRdA7wO************************************************************************u4av. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
2025-01-04 20:24:33,617 - research - INFO - Gathered context from 5 sub-queries
INFO:     [20:24:33] Finalized research step.
💸 Total Research Costs: $0.03551252
2025-01-04 20:24:33,618 - research - INFO - Research completed. Context size: 2
INFO:     [20:24:33] ✍️ Writing report for 'The Impact of Mobile Technology on the management of hypertensive patients at Rocket Health Uganda for the years 2022 and 2023: A Cross-sectional study.'...
2025-01-04 20:24:33,791 - httpx - INFO - HTTP Request: POST https://name.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-08-01-preview "HTTP/1.1 429 Too Many Requests"
2025-01-04 20:24:33,792 - openai._base_client - INFO - Retrying request to /chat/completions in 36.000000 seconds


@assafelovic
Copy link
Owner

@Videmak Can you try adding an env var EMBEDDING_PROVIDER=azure_openai?

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

3 participants