Hello, I am trying to use stream: true but I can't get it to work. This is my code:
const source = new EventSource(
"https://api.openai.com/v1/engines/curie/completions",
{
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + OPENAI_API_KEY,
},
method: "POST",
payload: JSON.stringify({
prompt: fileTextToCursor,
temperature: 0.75,
top_p: 0.95,
max_tokens: 3,
stream: true,
stop: ["\n\n"],
}),
}
);
source.addEventListener("ping", (event) => {
console.log(event.data);
});