From 72c167e7ded1727bf628b9cc2d7ff2397afec49f Mon Sep 17 00:00:00 2001 From: Jiang Yucheng Date: Tue, 19 Dec 2023 10:14:50 +0800 Subject: [PATCH] docs: Fix the code error at "Creating the agent function" (#922) --- examples/How_to_build_an_agent_with_the_node_sdk.mdx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/How_to_build_an_agent_with_the_node_sdk.mdx b/examples/How_to_build_an_agent_with_the_node_sdk.mdx index 05eedf9..89c3978 100644 --- a/examples/How_to_build_an_agent_with_the_node_sdk.mdx +++ b/examples/How_to_build_an_agent_with_the_node_sdk.mdx @@ -129,12 +129,10 @@ We start by pushing the `userInput` to the messages array. This time, we set the ```js async function agent(userInput) { - messages.push([ - { - role: "user", - content: userInput, - }, - ]); + messages.push({ + role: "user", + content: userInput, + }); const response = await openai.chat.completions.create({ model: "gpt-4", messages: messages,