Azure-Samples / graphrag-accelerator

One-click deploy of a Knowledge Graph powered RAG (GraphRAG) in Azure
https://github.com/microsoft/graphrag
MIT License
1.65k stars 250 forks source link

[BUG] Indexer is running but in the log there is an error invoking the LLM. #153

Open adnanakram82 opened 3 weeks ago

adnanakram82 commented 3 weeks ago

Describe the bug I have followed the Quick start notebook with Wikipedia.

image

The status has not changed in 2 hours and when I go to the log file I see following message. any guidance on how to fix it.

'type': 'on_workflow_start', 'data': 'Index: wiki-idx -- Workflow (4/16): create_summarized_entities started.', 'details': { 'workflow_name': 'create_summarized_entities', 'index_name': 'wiki-idx', }, } { 'type': 'error', 'data': 'Error Invoking LLM', 'cause': 'Connection error.', 'stack': ( 'Traceback (most recent call last):\n' ' File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exc' 'eptions\n' ' yield\n' ' File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 373, in handle_async_re' 'quest\n' ' resp = await self._pool.handle_async_request(req)\n' ' File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_as' 'ync_request\n' ' raise exc from None\n' ' File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_as' 'ync_request\n' ' response = await connection.handle_async_request(\n' ' File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 101, in handle_async_r' 'equest\n' ' return await self._connection.handle_async_request(request)\n' ' File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 143, in handle_async_reque' 'st\n' ' raise exc\n' ' File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 113, in handle_async_reque' 'st\n' ' ) = await self._receive_response_headers(kwargs)\n' ' File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 186, in _receiveresponse' 'headers\n' ' event = await self._receive_event(timeout=timeout)\n' ' File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 224, in _receive_event\n' ' data = await self._network_stream.read(\n' ' File "/usr/local/lib/python3.10/site-packages/httpcore/_backends/anyio.py", line 32, in read\n' ' with map_exceptions(exc_map):\n' ' File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit\n' ' self.gen.throw(typ, value, traceback)\n' ' File "/usr/local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions\n' ' raise to_exc(exc) from exc\n' 'httpcore.ReadError\n' '\n' 'The above exception was the direct cause of the following exception:\n' '\n' 'Traceback (most recent call last):\n' ' File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1558, in _request\n' ' response = await self._client.send(\n' ' File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1661, in send\n' ' response = await self._send_handling_auth(\n' ' File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1689, in _send_handling_auth\n' ' response = await self._send_handling_redirects(\n' ' File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects\n' ' response = await self._send_single_request(request)\n' ' File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1763, in _send_single_request\n' ' response = await transport.handle_async_request(request)\n' ' File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 372, in handle_async_re' 'quest\n' ' with map_httpcore_exceptions():\n' ' File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit\n' ' self.gen.throw(typ, value, traceback)\n' ' File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exc' 'eptions\n' ' raise mapped_exc(message) from exc\n' 'httpx.ReadError\n' '\n' 'The above exception was the direct cause of the following exception:\n' '\n' 'Traceback (most recent call last):\n' ' File "/usr/local/lib/python3.10/site-packages/graphrag/llm/base/base_llm.py", line 53, in _invoke\n' ' output = await self._execute_llm(input, kwargs)\n' ' File "/usr/local/lib/python3.10/site-packages/graphrag/llm/openai/openai_chat_llm.py", line 55, in _execu' 'te_llm\n' ' completion = await self.client.chat.completions.create(\n' ' File "/usr/local/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 1289, in create' '\n' ' return await self._post(\n' ' File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1826, in post\n' ' return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)\n' ' File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1519, in request\n' ' return await self._request(\n' ' File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1592, in _request\n' ' raise APIConnectionError(request=request) from err\n' 'openai.APIConnectionError: Connection error.\n'

rnpramasamyai commented 3 weeks ago

@ adnanakram82. openai.APIConnectionError: Connection error. Please go to graphrag-accelerator/blob/main/backend/src/api/pipeline-settings.yaml file, Add an api_key property to each LLM node.

michalmar commented 3 weeks ago

@rnpramasamyai (i have similar issue) how this change will affect the behavior? I though the settings/keys/endpoints etc. are already deployed in AKS in Azure. The local notebook just fires an event through APIM... so how does this change in my local repo afect the deployment - or am I missing something?

I am getting similar:

{
      'type': 'error',
      'data': 'Error Invoking LLM',
      'cause': (
          "Error code: 400 - {'error': {'code': 'BadRequest', 'message': 'Please provide a custom subdomain for token "
          "authentication, otherwise API key is required. (Please see https://aka.ms/cogsvc-authenticatewithtoken)'}}"
      ),
      'stack': (
          'Traceback (most recent call last):\n'
          '  File "/usr/local/lib/python3.10/site-packages/graphrag/llm/base/base_llm.py", line 53, in _invoke\n'
          '    output = await self._execute_llm(input, **kwargs)\n'
          '  File "/usr/local/lib/python3.10/site-packages/graphrag/llm/openai/openai_chat_llm.py", line 55, in _execu'
          'te_llm\n'
          '    completion = await self.client.chat.completions.create(\n'
          '  File "/usr/local/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 1289, in create'
          '\n'
          '    return await self._post(\n'
          '  File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1826, in post\n'
          '    return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)\n'
          '  File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1519, in request\n'
          '    return await self._request(\n'
          '  File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1620, in _request\n'
          '    raise self._make_status_error_from_response(err.response) from None\n'
          "openai.BadRequestError: Error code: 400 - {'error': {'code': 'BadRequest', 'message': 'Please provide a cus"
          'tom subdomain for token authentication, otherwise API key is required. (Please see https://aka.ms/cogsvc-au'
          "thenticatewithtoken)'}}\n"
      ),
      'details': {
          'input': (
rnpramasamyai commented 3 weeks ago

@michalmar I had the same issue. I added the API key, and it worked fine.

Pls check this below error: 'cause': ( "Error code: 400 - {'error': {'code': 'BadRequest', 'message': 'Please provide a custom subdomain for token " "authentication, otherwise API key is required. (Please see https://aka.ms/cogsvc-authenticatewithtoken)'}}" ),

Please check your cloned project, update the key, and rerun the deployment script. If the issue persists, consider deleting the existing deployment and starting from scratch.

jgbradley1 commented 3 weeks ago

By default, the accelerator deployment will set up and use managed identity to access the AOAI service that you configure it to use.

Without knowing the details and security configuration of your AOAI service, I can only guess that adding managed identity access to the AOAI failed - perhaps the AOAI service is configured to not allow managed identity or is setup in a different subscription in a way that the deployment script cannot add the appropriate role assignment for managed identity access.

michalmar commented 3 weeks ago

@rnpramasamyai @jgbradley1 my deployment went OK - it seems that the MI had all RBAC (Cognitive Services/OpenAI contributor role), also I provided valid URL and KEY to the deploy.parameters.json file... still got that 400 error.

What concers me is the error - 400 Please provide a custom subdomain for token... seems like its is not correctly setup with some domain name - is that the cognitive services GRAPHRAG_COGNITIVE_SERVICES_ENDPOINT which I left as default?

If it was using KEY and the key was incorrect, I would probably got 401 Unauthorized error... so its probably trying with MI.

I run the deployment with bash deploy.sh -dgp deploy.parameters.json

rnpramasamyai commented 2 weeks ago

@michalmar 'cause': ( "Error code: 400 - {'error': {'code': 'BadRequest', 'message': 'Please provide a custom subdomain for token " "authentication, otherwise API key is required. (Please see https://aka.ms/cogsvc-authenticatewithtoken)'}}" )