lucgagan / completions

Node.js SDK for interacting with OpenAI Chat API.
https://ray.run/
MIT License
45 stars 8 forks source link

Seeing truncated responses #15

Open lucgagan opened 1 year ago

lucgagan commented 1 year ago

It appears like a glitch by OpenAI, but seeing an increased number of truncated responses.

Example:

could not parse chunk:

"""
 data: {"id":"chatcmpl-7YkvP6XEACyebJa9awrHeEENrAQNc","object":"chat.completion.chunk","created":168851788
"""

read value:

"""
 data: {"id":"chatcmpl-7YkvP6XEACyebJa9awrHeEENrAQNc","object":"chat.completion.chunk","created":1688517887,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"role":"assistant","content":null,"function_call":{"name":"print_tags","arguments":""}},"finish_reason":null}]}

data: {"id":"chatcmpl-7YkvP6XEACyebJa9awrHeEENrAQNc","object":"chat.completion.chunk","created":1688517887,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"function_call":{"arguments":"{\n"}},"finish_reason":null}]}

data: {"id":"chatcmpl-7YkvP6XEACyebJa9awrHeEENrAQNc","object":"chat.completion.chunk","created":168851788
"""
pahar0 commented 1 year ago

I've been getting the same error:

could not parse chunk:

"""
 data: {"id":"chatcmpl-7fxAnT0JILLZxrdQwoMrTUilawTQV","object":"chat.completion.chunk","created":1690233265,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":" upon 
"""

read value:

"""
 data: {"id":"chatcmpl-7fxAnT0JILLZxrdQwoMrTUilawTQV","object":"chat.completion.chunk","created":1690233265,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}

data: {"id":"chatcmpl-7fxAnT0JILLZxrdQwoMrTUilawTQV","object":"chat.completion.chunk","created":1690233265,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"Once"},"finish_reason":null}]}

data: {"id":"chatcmpl-7fxAnT0JILLZxrdQwoMrTUilawTQV","object":"chat.completion.chunk","created":1690233265,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":" upon 
"""
SyntaxError: Unterminated string in JSON at position 177
    at JSON.parse (<anonymous>)
    at consumeStream (/home/ubuntu/api/node_modules/completions/dist/createCompletions.js:133:67)
pahar0 commented 1 year ago

Could the metaprompt be responsible? Allowing users to modify or change it would be great. I'm not sure if the owner is still maintaining this repo, though... Any future plans on working on it?

floomby commented 1 year ago

I had been using this library, but have since moved over to the official openai sdk as it now supports streaming and functions very well. I had not really planned on doing any more work, especially because the prs that I have that address some issues are still sitting open without response.

lucgagan commented 1 year ago

I had been using this library, but have since moved over to the official openai sdk as it now supports streaming and functions very well. I had not really planned on doing any more work, especially because the prs that I have that address some issues are still sitting open without response.

To be fair, those PRs are open b/c they have conflicts in them.