Quickstart example for node

Looking through the quickstart and for curl and python then the role (system and user) and content are very different to the role (system only) and content in the node example. I can see how in python/curl, the output would be to explain recursive programming as a poem. In node, it would simply be magic (or hardcoded - is this the VW dieselgate version :>)).
So is the node example missing code?

1 Like

I will be better if u post the abnormal image!

The page is
https://platform.openai.com/docs/quickstart?context=python&WT.mc_id=academic-105485-koreyst

The python code (just the relevant bit) is

completion = client.chat.completions.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},
    {"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."}
  ]
)

So from looking at that I can see that we are setting up chatGPT to return an explanation of recursion in poetic form.

Here is the node code

  const completion = await openai.chat.completions.create({
    messages: [{ role: "system", content: "You are a helpful assistant." }],
    model: "gpt-3.5-turbo",
  });

Is this right? How will the AI know to return a poem?

Absolutely technical for problems u can ask GPT-4o, she’s really good at it。
For this problem, the request body struct of nodejs and python is nearly the same!

Thanks to whoever changed the code in docs. It now makes sense.