Earlier quoted context omitted.
Elaborate?
"YET ANOTHER shiny new toy to distract me. Can't help myself even though I think it's mostly a waste of time" Am I just projecting? Relatable, in any case :)
OpenAI: Streaming is now available in the Assistants API
21–30 of 89 posts
Re: OpenAI: Streaming is now available in the Assistants API
#22Earlier quoted context omitted.
Edit/remove/retry is just including the whole conversation over again (IIUC this is even how the app works.) It's part of why the API is so expensive
The Assistants API doesn't let you recreate the conversation (with edits or not) because you can't (re)create messages with role=assistant.
Re: OpenAI: Streaming is now available in the Assistants API
#23Any way to have a consistent system prompt across queries without sending it (and using tokens) for each completion?
and then on each run, you have the option to add more guidance to the run explicitly, without modifying the assistant instructions (system prompt)
It's a little bit different but kind of the same
Re: OpenAI: Streaming is now available in the Assistants API
#24I'd really like it if the streaming versions of their APIs could return a token usage count at the end.
The non-streaming APIs do this right now:
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" -d '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "A short fun fact about pigeons"
}
]
}'
Returns: {
"id": "chatcmpl-92UiIWQaf442wq7Eyp7kF8ge0e3fE",
"object": "chat.completion",
"created": 1710381746,
"model": "gpt-3.5-turbo-0125",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Pigeons are one of the few bird species that can drink water by sucking it up through their beaks, rather than tilting their heads back to swallow."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 33,
"total_tokens": 47
},
"system_fingerprint": "fp_4f0b692a78"
}
Note the "usage" block there telling me how many tokens were used (which tells me how much this cost).But if I add "stream": true I get back an SSE stream that looks like this:
...
data: {"id":"chatcmpl-92Uk81oNjrcUJQnPX8fSNqFINLfSI","object":"chat.completion.chunk","created":1710381860,"model":"gpt-3.5-turbo-0125","system_fingerprint":"fp_4f0b692a78","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-92Uk81oNjrcUJQnPX8fSNqFINLfSI","object":"chat.completion.chunk","created":1710381860,"model":"gpt-3.5-turbo-0125","system_fingerprint":"fp_4f0b692a78","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]}
data: [DONE]
There's no "usage" block, which means I have to try and account for the tokens myself. This is really inconvenient!I noticed the other day that the Claude streaming API returns a "usage" block with the last message. I'd love it if OpenAI's API did the same thing.
I need this right now because I'm starting to build features for end users of my own software, and I want to be able to give them X,000 tokens "free" before starting to charge them for extras. Counting those tokens myself (probably using tiktoken) is code I'd rather not have to write - especially since features like tools/functions or images make counting tokens a lot less obvious.
Re: OpenAI: Streaming is now available in the Assistants API
#25I really hope this will fade and focus will turn back to highlighting some broader actual human ingenuity in IT, rather than constant stream of "we used autocomplete for this new thing" or "we build this new API for this glorified autocomplete".
Boring.
Re: OpenAI: Streaming is now available in the Assistants API
#26Throwing a feature request in here just in case someone from OpenAI sees it. I'd really like it if the streaming versions of their APIs could return a token usage count at the end. The non-streaming APIs do this right now: curl https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" -d '{ "model": "gpt-3.5-turbo", "messages": [ { "role": "user", "c…
Re: OpenAI: Streaming is now available in the Assistants API
#27Throwing a feature request in here just in case someone from OpenAI sees it. I'd really like it if the streaming versions of their APIs could return a token usage count at the end. The non-streaming APIs do this right now: curl https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" -d '{ "model": "gpt-3.5-turbo", "messages": [ { "role": "user", "c…
Re: OpenAI: Streaming is now available in the Assistants API
#28This was one of the limitations of the Assistants API that made me entirely ignore it up until now. I am curious if the Assistants API lets you edit/remove/retry messages yet. I don't see anything implying this has changed. It's annoying that the Assistants API doesn't give you enough control to support basic things that the ChatGPT app does.
Like the other commenter said, edit/remove/retry messages can be implemented by the API client already. The API doesn't maintain state so every new message in a "conversation" includes previous messages as context. To edit a message you would re-submit the conversation history with the desired changes. I get what you're asking for though. It would be nice if this was easier. But that would require OpenAI changing the…
There is an API to modify messages, though I am not sure of its constraints.
Re: OpenAI: Streaming is now available in the Assistants API
#29Openai banned my account for suspicious payment activities, and I never was able to talk to a real person. Just several layers of chat bots posing as people. I literally want to give them my money and can't. Every few weeks for shirts and giggles i send an email to them saying, "any update on this?"
Re: OpenAI: Streaming is now available in the Assistants API
#302012 JavaScript called, it wants its callbacks wrapped in objects back. Why do we have a context manager named "stream" for which you call `.until_done()`? This could've been an iterator, or better - an asynchronous iterator, since this is streaming over the network. We could be destructing instances of named tuples with pattern matching, or even just doing `"".join(delta.text for delta in prompt (...)`. But no here subclass this instead, tells me the wrapper around a web API.