Examples and guides for using the OpenAI API
docs: Fix the code error at "Creating the agent function" (#922)
Jiang Yucheng72c167e7ded1
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.mdxindex 05eedf9b..89c39786 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```jsasync 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,