when applying chat template to messages, will vllm set generation_prompt=True itself?
vLLM在调用LLM.chat方法时,默认会自动将add_generation_prompt参数设置为True,即会在应用chat template时自动添加生成提示(generation prompt),除非你显式传入add_generation_prompt=False。如果你不希望自动添加,可以手动设置为False。详细参数说明见官方API文档。
如果你直接用llm.generate方法,则不会自动应用chat template,也不会自动加generation prompt,需要你自己处理模板和提示。更多细节可参考快速入门文档。
需要更详细的解释吗?
Sources:
- https://docs.vllm.ai/en/latest/api/vllm/entrypoints/llm/#__code_38
- https://docs.vllm.ai/en/latest/getting_started/quickstart/#__span-6-7
Hint: Mention @RunLLM in the post for followups.