Skip to content

[Issue]: Not able to invoke with OpenAI JS SDK #86

Open
@cbh778899

Description

Contact Details(optional)

No response

What is the issue you are having?

It seems like when using OpenAI JavaScript SDK, this project won't work as expected.

Code:

import OpenAI from 'openai';
const client = new OpenAI({ apiKey: 'test-api-key', baseURL: 'http://localhost:8000/v1/' });

async function completions() {
    const stream = await client.chat.completions.create({stream: true, messages: [{role:'user', content: 'hello'}]});
    for await (const chunk of stream) {
        console.log(chunk.choices[0].delta.content);
    }
    console.log("Finished Response");
}

completions();
// Console output: Finished Response

And although the engine got response normally, the receiver doesn't received the chunk output.

Relevant log output

No response

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions