openai / openai-node

The official Node.js / Typescript library for the OpenAI API
https://www.npmjs.com/package/openai
Apache License 2.0
7.85k stars 850 forks source link

createChatCompletion how to get multiple results? #163

Closed baba43 closed 1 year ago

baba43 commented 1 year ago

Describe the bug

When I ask "Tell me 3 Jokes" in the Playground (Chat), it will print me 3 results. However, when using the node API, the response only returns a single item and I see no way of getting more than that. Is this intended or a bug? Or am I thinking totally wrong?

I also tried the "n" parameter, which actually gives me several results, but they are much worse compared to the Playground (they are too similar)

To Reproduce

createChatCompletion({
  model: "gpt-3.5-turbo-0301",
  messages: [
    {
      role: "system",
      content: "Tell me 3 jokes",
    },
  ],
}

Code snippets

No response

OS

Windows

Node version

v18.12.1

Library version

openai 3.2.1

baba43 commented 1 year ago

It was my bad. All items are contained within the first message that can be split at line breaks.