graphrag icon indicating copy to clipboard operation
graphrag copied to clipboard

[Bug]: prompt_tune: TypeError: sequence item 0: expected str instance, bool found

Open youyuanrsq opened this issue 1 year ago • 0 comments

Do you need to file an issue?

  • [X] I have searched the existing issues and this bug is not already filed.
  • [X] 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.
  • [x] I believe this is a legitimate bug, not just a question. If this is a question, please use the Discussions area.

Describe the bug

When I used the CLI command python -m graphrag.prompt_tune --root ./ragtest --output prompts --config ./ragtest/settings.yaml to generate prompts, I encountered this bug. After checking, the error code is located in graphrag/prompt_tune/generator/entity_relationship.py:

if entity_types:
    entity_types_str = (
        entity_types if isinstance(entity_types, str) else ", ".join(entity_types)
    )

I suspect that the entity_types list generated by the model contains True or False boolean values, which causes the program to crash. A possible solution is to convert each element in the entity_types list to a string:

if entity_types:
    entity_types_str = (
        entity_types if isinstance(entity_types, str) else ", ".join(map(str, entity_types))
    )

Steps to reproduce

No response

Expected Behavior

No response

GraphRAG Config Used

# Paste your config here

Logs and screenshots

No response

Additional Information

  • GraphRAG Version:
  • Operating System:
  • Python Version:
  • Related Issues:

youyuanrsq avatar Aug 16 '24 02:08 youyuanrsq