Fix OpenAIFunctionAgent that function not return string result

refer to https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain/agents/format_scratchpad/openai_functions.py#L29

and fix the role of systemMessage from `ai` to `system`.
This commit is contained in:
YISH
2024-01-10 17:41:53 +08:00
committed by Ilango
parent a3ea487ecb
commit c8f624de9c
@@ -112,7 +112,7 @@ const prepareAgent = (
const inputKey = memory.inputKey ? memory.inputKey : 'input'
const prompt = ChatPromptTemplate.fromMessages([
['ai', systemMessage ? systemMessage : `You are a helpful AI assistant.`],
['system', systemMessage ? systemMessage : `You are a helpful AI assistant.`],
new MessagesPlaceholder(memoryKey),
['human', `{${inputKey}}`],
new MessagesPlaceholder('agent_scratchpad')