generative-ai-js icon indicating copy to clipboard operation
generative-ai-js copied to clipboard

Thoughts on the API

Open 0wwafa opened this issue 1 year ago • 2 comments

Description of the bug:

If I understood correctly, to have an interactive chat session you can for example:

  const askQuestion = async () => {
    readline.question("You: ", async (input) => {
      if (input.toLowerCase() === "quit") {
        readline.close();
        return;
      }

      const result = await chatSession.sendMessage(input);
      console.log("AI: " + result.response.text());
      askQuestion();
    });
  };

but I noticed that as the chat proceeds, the history grows and every single prompt ALL the history is sent.

Isn't this "stupid"? Shouldn't the "session" be kept server side and only the last prompt be sent?

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

0wwafa avatar Sep 02 '24 21:09 0wwafa

Is this a duplicate of #231?

IvanLH avatar Feb 26 '25 19:02 IvanLH

Is this a duplicate of #231?

No it is not.

0wwafa avatar Mar 13 '25 11:03 0wwafa