graphrag icon indicating copy to clipboard operation
graphrag copied to clipboard

Specify prompts for local and global search via config/CLI

Open yangxue-1 opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [ ] I have searched the existing issues
  • [ ] I have checked #657 to validate if my issue is covered by community support

Describe the issue

How to adjust the prompt template used for global search and local search? Is there any related document?

global prompt:map_system_prompt.py,reduce_system_prompt.py

local prompt:system_prompt.py

Steps to reproduce

No response

GraphRAG Config Used

# Paste your config here

Logs and screenshots

No response

Additional Information

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

yangxue-1 avatar Aug 13 '24 04:08 yangxue-1

The GlobalSearch and LocalSearch classes do accept prompts, so if you are building a search implementation you can supply edited prompts. We don't expose that through the CLI or config file right now, so I'll add this to the backlog for investigation. In the meantime, have a look at the search factories for examples of how to instantiate the classes directly (these factories are used by the CLI, so you can trace through).

natoverse avatar Aug 13 '24 20:08 natoverse

This has been around for awhile, but worth noting: newer versions of GraphRAG export all prompts when you do graphrag init. So you can edit the text files directly.

natoverse avatar Feb 06 '25 00:02 natoverse