Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cbh778899 opened this issue Sep 19, 2024 · 0 comments
Open

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

cbh778899 opened this issue Sep 19, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@cbh778899
Copy link
Collaborator

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

@cbh778899 cbh778899 added the help wanted Extra attention is needed label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant