#CreateChatCompletionResponse appears to be wrong?

4 messages · Page 1 of 1 (latest)

viscid wing
#

I am using the ChatCompletions endpoint

const response = await fetch("https://api.openai.com/v1/chat/completions",

I am trying to destructure the response as a stream. When I look at the object it does not follow the Type for CreateChatCompletionResponse

This seems to work but typescript is saying the delta property does not exist.

completionResponse.choices[0].delta.content

Am I using the correct type for the response?

tepid star
#

The last part of the response [END] is not in a json structure. It may be part of your problem. Also sometimes you have to watch out for onprogress events that have a empty string

viscid wing
#

Sorry what do you mean the last part of the response is not in a JSON structure?

I think there is just a bug where the type doesn’t match the JSON.

I found this a little bit ago and it’s the same problem I am having.

https://github.com/openai/openai-node/issues/83

GitHub

Describe the bug Streamed data still uses CreateChatCompletionResponseChoicesInner type which still contains message instead of delta. To Reproduce Reference the CreateChatCompletionResponseChoices...

true thunder
#

@viscid wing same error with the python 0.27.1 version