Fix: Parameter Extractor Uses Correct Prompt for Prompt Mode in Chat Models (#24636)
Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
@@ -52,6 +52,7 @@ from .exc import (
|
|||||||
)
|
)
|
||||||
from .prompts import (
|
from .prompts import (
|
||||||
CHAT_EXAMPLE,
|
CHAT_EXAMPLE,
|
||||||
|
CHAT_GENERATE_JSON_PROMPT,
|
||||||
CHAT_GENERATE_JSON_USER_MESSAGE_TEMPLATE,
|
CHAT_GENERATE_JSON_USER_MESSAGE_TEMPLATE,
|
||||||
COMPLETION_GENERATE_JSON_PROMPT,
|
COMPLETION_GENERATE_JSON_PROMPT,
|
||||||
FUNCTION_CALLING_EXTRACTOR_EXAMPLE,
|
FUNCTION_CALLING_EXTRACTOR_EXAMPLE,
|
||||||
@@ -752,7 +753,7 @@ class ParameterExtractorNode(BaseNode):
|
|||||||
if model_mode == ModelMode.CHAT:
|
if model_mode == ModelMode.CHAT:
|
||||||
system_prompt_messages = ChatModelMessage(
|
system_prompt_messages = ChatModelMessage(
|
||||||
role=PromptMessageRole.SYSTEM,
|
role=PromptMessageRole.SYSTEM,
|
||||||
text=FUNCTION_CALLING_EXTRACTOR_SYSTEM_PROMPT.format(histories=memory_str, instruction=instruction),
|
text=CHAT_GENERATE_JSON_PROMPT.format(histories=memory_str).replace("{{instructions}}", instruction),
|
||||||
)
|
)
|
||||||
user_prompt_message = ChatModelMessage(role=PromptMessageRole.USER, text=input_text)
|
user_prompt_message = ChatModelMessage(role=PromptMessageRole.USER, text=input_text)
|
||||||
return [system_prompt_messages, user_prompt_message]
|
return [system_prompt_messages, user_prompt_message]
|
||||||
|
Reference in New Issue
Block a user