microsoft / graphrag

A modular graph-based Retrieval-Augmented Generation (RAG) system
https://microsoft.github.io/graphrag/
MIT License
20.19k stars 1.97k forks source link

Specify prompts for local and global search via config/CLI #917

Open yangxue-1 opened 3 months ago

yangxue-1 commented 3 months ago

Is there an existing issue for this?

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

natoverse commented 3 months ago

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).