groq / groq-typescript

The official Node.js / Typescript library for the Groq API
Apache License 2.0
145 stars 17 forks source link

Get finalChatCompletion from Stream #29

Open davidoort opened 3 months ago

davidoort commented 3 months ago

In the OpenAI API I can do something like this:

const stream = await client.beta.chat.completions.stream({
          ...body,
          stream: true,
        });
        for await (const chunk of stream) {
          chunk.choices?.forEach((chunk) => {
            const c = fromOpenAiChunkChoice(chunk);
            streamingCallback({
              index: c.index,
              content: c.message.content,
            });
          });
        }
        response = await stream.finalChatCompletion();

Is there something similar to finalChatCompletion() in the groq SDK?

gradenr commented 3 months ago

We are aware of these additional features which OpenAI has added and they are on the roadmap. But they are not currently available in our SDK.