graphrag icon indicating copy to clipboard operation
graphrag copied to clipboard

[bug fix]Optimize map prompt of global query to output JSON stably

Open KylinMountain opened this issue 1 year ago • 1 comments

Description

Optimize the map prompt with a valid example to output JSON in stable.

Related Issues

https://github.com/microsoft/graphrag/issues/471 https://github.com/microsoft/graphrag/issues/475

Proposed Changes

Optimize the map prompt with a valid example to output JSON in stable.

Checklist

  • [x] I have tested these changes locally.
  • [x] I have reviewed the code changes.
  • [ ] I have updated the documentation (if necessary).
  • [] I have added appropriate unit tests (if applicable).

Additional Notes

[Add any additional notes or context that may be helpful for the reviewer(s).]

KylinMountain avatar Jul 10 '24 05:07 KylinMountain

it has passed unit test. image

KylinMountain avatar Jul 10 '24 05:07 KylinMountain

我按照你的改了,还是有问题

dustelf avatar Jul 19 '24 10:07 dustelf

我按照你的改了,还是有问题

我认为仅通过优化提示并提供示例只能提示LLM,但无法强制其输出正确的JSON格式,效果仍然不理想。我不确定是否有其他开源LLM支持像OpenAI那样的JSON输出模型,但你可以尝试一些更大的LLM,可能会更好地遵循提示和示例中的指示。


You’re right. While an optimized prompt with examples can guide the LLM, it can’t guarantee the correct JSON output. There’s still some inconsistency. I’m not sure if other OSS LLMs support JSON output as well as OpenAI’s models do, but trying a larger LLM might improve adherence to the instructions and examples in the prompt.

KylinMountain avatar Jul 20 '24 02:07 KylinMountain