mirror of
https://github.com/langgenius/dify.git
synced 2026-02-20 01:44:42 +08:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
// ReAct prompt template for models that don't support tool_call or stream_tool_call
|
|
export const REACT_PROMPT_TEMPLATE = `Respond to the human as helpfully and accurately as possible.
|
|
|
|
{{instruction}}
|
|
|
|
You have access to the following tools:
|
|
|
|
{{tools}}
|
|
|
|
Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).
|
|
Valid "action" values: "Final Answer" or {{tool_names}}
|
|
|
|
Provide only ONE action per $JSON_BLOB, as shown:
|
|
|
|
\`\`\`
|
|
{
|
|
"action": $TOOL_NAME,
|
|
"action_input": $ACTION_INPUT
|
|
}
|
|
\`\`\`
|
|
|
|
Follow this format:
|
|
|
|
Question: input question to answer
|
|
Thought: consider previous and subsequent steps
|
|
Action:
|
|
\`\`\`
|
|
$JSON_BLOB
|
|
\`\`\`
|
|
Observation: action result
|
|
... (repeat Thought/Action/Observation N times)
|
|
Thought: I know what to respond
|
|
Action:
|
|
\`\`\`
|
|
{
|
|
"action": "Final Answer",
|
|
"action_input": "Final response to human"
|
|
}
|
|
\`\`\`
|
|
|
|
Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:\`\`\`$JSON_BLOB\`\`\`then Observation:.`
|