[Feat] Add support for terminating events in streaming APIs #5096
Replies: 1 comment 2 replies
-
|
@baywet this was discussed quite a bit when adding the SSE support. The problem is that terminating events are not part of the media type, and the Media Type Object models media types (hence he name 😜 ). There are many ways that people make use of media types that add additional semantics, but we don't have a place for that beyond using schemas to convey constraints on the media type, which are often semantically significant. What's not clear to me is what would even be needed here. You can already provide a distinct subschema for a "done" event, and (while this is probably not obvious to most people and requires understanding JSON Schema annotations), you could use JSON Schema annotations to detect when one is seen. But the bigger issue here is that OpenAI's "done" sentinels are just one possible semantic convention built on top of the media type. If we want to model semantic conventions, those can't go in the media type object, unless they can be identified by a media type parameter such as a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
OAI 3.2.0 added support for streaming media types via the itemSchema property, and that's a great improvement!
Observing some APIs from wild that are widely used, it seems that it's a common practice to have a "terminating event" so the server can tell the client "we're done" (in an expected way, not like disconnecting them because something is wrong).
See OpenAI which will reply back
There does not seem to be a "place" for this information today, but maybe this is something that could be added to 3.3?
Beta Was this translation helpful? Give feedback.
All reactions