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

[Bug]: Unable to use dirft mode and local mode, the error was traced to llm/openai/utils/try_parse_json_object, and json could not be loaded. #1367

Open
2 of 3 tasks
shaoqing404 opened this issue Nov 6, 2024 · 0 comments
Labels
bug Something isn't working triage Default label assignment, indicates new issue needs reviewed by a maintainer

Comments

@shaoqing404
Copy link

Do you need to file an issue?

  • I have searched the existing issues and this bug is not already filed.
  • My model is hosted on OpenAI or Azure. If not, please look at the "model providers" issue and don't file a new one here.
  • I believe this is a legitimate bug, not just a question. If this is a question, please use the Discussions area.

Describe the bug

I encountered a problem: when using local search, I received an error TypeError: Query column vector must be a vector. Got list<item: double>.

This also caused an error in the DRIFT search mode: RuntimeError: No intermediate answers found in primer response. Ensure that the primer response includes intermediate answers.
Image
Image

Steps to reproduce

Conduct a search on the database built in version 0.3.6 and version 0.4. The search code is as follows: When an aircraft cabin fire occurs, what emergency measures should ATC take?
graphrag query --method drift --query "When an aircraft cabin fire occurs, what emergency measures should ATC take?" --streaming

graphrag query --method drift --local"When an aircraft cabin fire occurs, what emergency measures should ATC take?" --streaming

Expected Behavior

normal operation

GraphRAG Config Used

encoding_model: cl100k_base
skip_workflows: []
llm:
  type: openai_chat # or azure_openai_chat
  model: gpt-4o
  model_supports_json: false # recommended if this is available for your model.
#  max_tokens: 8192
  # request_timeout: 180.0
  # api_base: https://<instance>.openai.azure.com
  # api_version: 2024-02-15-preview
  # organization: <organization_id>
  # deployment_name: <azure_model_deployment_name>
  # tokens_per_minute: 150_000 # set a leaky bucket throttle
  # requests_per_minute: 10_000 # set a leaky bucket throttle
  temperature: 0.7
  max_retries: 10
  max_retry_wait: 10.0
  # sleep_on_rate_limit_recommendation: true # whether to sleep when azure suggests wait-times
  # concurrent_requests: 25 # the number of parallel inflight requests that may be made

parallelization:
  stagger: 0.3
  # num_threads: 50 # the number of threads to use for parallel processing

async_mode: threaded # or asyncio

embeddings:
  async_mode: threaded # or asyncio
  llm:
    type: openai_embedding # or azure_openai_embedding
    model: text-embedding-3-large
    # api_version: 2024-02-15-preview
    # organization: <organization_id>
    # deployment_name: <azure_model_deployment_name>
    # tokens_per_minute: 150_000 # set a leaky bucket throttle
    # requests_per_minute: 10_000 # set a leaky bucket throttle
    max_retries: 10
    max_retry_wait: 10.0
    # sleep_on_rate_limit_recommendation: true # whether to sleep when azure suggests wait-times
    # concurrent_requests: 25 # the number of parallel inflight requests that may be made
    # batch_size: 16 # the number of documents to send in a single request
    # batch_max_tokens: 8191 # the maximum number of tokens to send in a single request
    # target: required # or optional


chunks:
  size: 2000
  overlap: 200
  group_by_columns: [id] # by default, we don't allow chunks to cross documents

input:
  type: file # or blob
  file_type: text # or csv
  base_dir: "input"
  file_encoding: utf-8
  file_pattern: ".*\\.txt$"

cache:
  type: file # or blob
  base_dir: "cache"
  # connection_string: <azure_blob_storage_connection_string>
  # container_name: <azure_blob_storage_container_name>

storage:
  type: file # or blob
  base_dir: "output"
  # connection_string: <azure_blob_storage_connection_string>
  # container_name: <azure_blob_storage_container_name>

reporting:
  type: file # or console, blob
  base_dir: "output"
  # connection_string: <azure_blob_storage_connection_string>
  # container_name: <azure_blob_storage_container_name>

entity_extraction:
  ## strategy: fully override the entity extraction strategy.
  ##   type: one of graph_intelligence, graph_intelligence_json and nltk
  ## llm: override the global llm settings for this task
  ## parallelization: override the global parallelization settings for this task
  ## async_mode: override the global async_mode settings for this task
  prompt: "prompts/entity_extraction.txt"
  entity_types: [ORGANIZATION, PERSON, GOAL, EVENT, ACTIVITY, EQUIPMENT, FACILITIES, DEPARTMENT, ROLE, POSITION, OPERATION, TASK, PARAMETER, INDICATOR, DOCUMENT, SYSTEM, AIRCRAFT, VEHICLE, EVENT, COMPANY]
  max_gleanings: 10

summarize_descriptions:
  ## llm: override the global llm settings for this task
  ## parallelization: override the global parallelization settings for this task
  ## async_mode: override the global async_mode settings for this task
  prompt: "prompts/summarize_descriptions.txt"
  max_length: 2000

claim_extraction:
  ## llm: override the global llm settings for this task
  ## parallelization: override the global parallelization settings for this task
  ## async_mode: override the global async_mode settings for this task
  # enabled: true
  prompt: "prompts/claim_extraction.txt"
  description: "Any claims or facts that could be relevant to information discovery."
  max_gleanings: 10

community_reports:
  ## llm: override the global llm settings for this task
  ## parallelization: override the global parallelization settings for this task
  ## async_mode: override the global async_mode settings for this task
  prompt: "prompts/community_report.txt"
  max_length: 3000
  max_input_length: 10000

cluster_graph:
  max_cluster_size: 10

embed_graph:
  enabled: true # if true, will generate node2vec embeddings for nodes
  num_walks: 10
  walk_length: 40
  window_size: 2
  iterations: 3
  random_seed: 597832


umap:
  enabled: true # if true, will generate UMAP embeddings for nodes

snapshots:
  graphml: true
  raw_entities: true
  top_level_nodes: true



local_search:
  text_unit_prop: 0.5
  community_prop: 0.1
  conversation_history_max_turns: 5
  top_k_mapped_entities: 10
  top_k_relationships: 10
  max_tokens: 12000

global_search:
  max_tokens: 12000
  data_max_tokens: 12000
  map_max_tokens: 1000
  reduce_max_tokens: 2000
  concurrency: 32

Logs and screenshots

creating llm client with {'api_key': 'REDACTED,len=51', 'type': "openai_chat", 'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.7, 'top_p': 1.0, 'n': 1, 'request_timeout': 180.0, 'api_base': 'https://api.gogoai.cloud', 'api_version': None, 'organization': None, 'proxy': None, 'audience': None, 'deployment_name': None, 'model_supports_json': False, 'tokens_per_minute': 0, 'requests_per_minute': 0, 'max_retries': 10, 'max_retry_wait': 10.0, 'sleep_on_rate_limit_recommendation': True, 'concurrent_requests': 25}
creating embedding llm client with {'api_key': 'REDACTED,len=49', 'type': "openai_embedding", 'model': 'embedding-2', 'max_tokens': 4000, 'temperature': 0, 'top_p': 1, 'n': 1, 'request_timeout': 180.0, 'api_base': 'https://open.bigmodel.cn/api/paas/v4', 'api_version': None, 'organization': None, 'proxy': None, 'audience': None, 'deployment_name': None, 'model_supports_json': None, 'tokens_per_minute': 0, 'requests_per_minute': 0, 'max_retries': 10, 'max_retry_wait': 10.0, 'sleep_on_rate_limit_recommendation': True, 'concurrent_requests': 25}
Failed to generate expansion for query: When an aircraft cabin fire occurs, what emergency measures should ATC take?
D:\element_path\miniconda\envs\graph\Lib\site-packages\numpy\core\fromnumeric.py:59: FutureWarning: 'DataFrame.swapaxes' is deprecated and will be removed in a future version. Please use 'DataFrame.transpose' instead.
return bound(*args, **kwds)
0%| | 0/5 [00:00<?, ?it/s]not expected dict type. type=<class 'str'>:
Traceback (most recent call last):
File "D:\element_path\miniconda\envs\graph\Lib\site-packages\graphrag\llm\openai\utils.py", line 130, in try_parse_json_object
result = json.loads(input)
^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
20%|████████████████████▍ | 1/5 [00:01<00:05, 1.39s/it]not expected dict type. type=<class 'str'>:
Traceback (most recent call last):
File "D:\element_path\miniconda\envs\graph\Lib\site-packages\graphrag\llm\openai\utils.py", line 130, in try_parse_json_object
result = json.loads(input)
^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json_init
.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
40%|████████████████████████████████████████▊ | 2/5 [00:01<00:01, 1.57it/s]not expected dict type. type=<class 'str'>:
Traceback (most recent call last):
File "D:\element_path\miniconda\envs\graph\Lib\site-packages\graphrag\llm\openai\utils.py", line 130, in try_parse_json_object
result = json.loads(input)
^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json_init
.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
60%|█████████████████████████████████████████████████████████████▏ | 3/5 [00:01<00:01, 1.97it/s]not expected dict type. type=<class 'str'>:
Traceback (most recent call last):
File "D:\element_path\miniconda\envs\graph\Lib\site-packages\graphrag\llm\openai\utils.py", line 130, in try_parse_json_object
result = json.loads(input)
^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json_init
.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
80%|█████████████████████████████████████████████████████████████████████████████████▌ | 4/5 [00:02<00:00, 2.26it/s]not expected dict type. type=<class 'str'>:
Traceback (most recent call last):
File "D:\element_path\miniconda\envs\graph\Lib\site-packages\graphrag\llm\openai\utils.py", line 130, in try_parse_json_object
result = json.loads(input)
^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json_init
.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\element_path\miniconda\envs\graph\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:02<00:00, 1.69it/s]
╭────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────╮

Additional Information

  • GraphRAG Version:0.4
  • Operating System:windows
  • Python Version:3.11
  • Related Issues:
@shaoqing404 shaoqing404 added bug Something isn't working triage Default label assignment, indicates new issue needs reviewed by a maintainer labels Nov 6, 2024
@shaoqing404 shaoqing404 changed the title [Bug]: <title> [Bug]: Unable to use dirft mode and local mode, the error was traced to llm/openai/utils/try_parse_json_object, and json could not be loaded. Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Default label assignment, indicates new issue needs reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant