Discrepancy in OpenAI npm Library Results Compared to Postman API and Web UI

The npm library for OpenAI is providing incorrect, random and irrelavant results, but when I make an API call using Postman, it works, and the OpenAI Web UI also returns the correct results

Code:

  // Send the limited text to ChatGPT
  const completion = await openai.chat.completions.create({
    messages: [{ role: 'user', content:  limitedText }], //"summary this text:" +
    model: 'gpt-3.5-turbo',
  });

  console.log(completion.choices);

Hi and welcome to the Developer Forum!

What version of the OpenAI library are you using?

1 Like

Hi @prof.coconut

Welcome to the OpenAI community.

What does limitedText hold?

1 Like

OpenAI node.js├── openai@4.6.0

**Limited Text**: Bitcoin: A Peer-to-Peer Electronic Cash System  Satoshi Nakamoto  satoshin@gmx.com    Abstract.   A purely peer-to-peer version of electronic cash would allow online  payments to be sent directly from one party to another without going through a  financial institution.   Digital signatures provide part of the solution, but the main  benefits are lost if a trusted third party is still required to prevent double-spending.  We propose a solution to the double-spending problem using a peer-to-peer network.  The network timestamps transactions by hashing them into an ongoing chain of  hash-based
PDF file saved successfully.
[
  {
    index: 0,
    message: {
      role: 'assistant',
      content: 'The text highlights the importance of education and the positive impact it has on individuals and society. It emphasizes the need for quality education that fosters critical thinking, creativity, and problem-solving skills. The author believes that education is not limited to formal schooling but also encompasses lifelong learning and personal development. Furthermore, the text emphasizes the importance of equal access to education for all individuals, regardless of their socio-economic background. Ultimately, the author argues that investing in education is crucial for building a strong and prosperous society.'
    },
    finish_reason: 'stop'
  }
]

From what I see, this could be, because you’re passing only limitedText, without any instructions in it or any system message, on what the model should do with it.

3 Likes

I have marked this as solution. Resovled. Thanks

2 Likes