-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: introduce api leveling proposal #3317
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
Conversation
cc @nathan-weinberg since I know you wanted a look at this :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
focusing only on the openai compat apis, how would this framework classify the following and why -
- /v1/chat/completions
- /v1/completions
- /v1/files
- /v1/batches
great point @mattf As the Off the top of my head though: /v1/chat/completions -- seems stable, so likely would remain with completions and chat completions though I know there are various features going in as we approach 0.3.0, so we'd need to evaluate if any of these are breaking, if they are -- it'd need to be /v1/files -- I have seen a few major enhancements to files go in recently like (#3283) and the s3 provider in general, so I'd imagine this would be /v1/batches -- given the large changes like #3309 and maybe #3261, #3171, etc etc I think this should be
and just a note -- the reason I chose alpha and not beta is as the doc states, beta is almost a stepping stone briefly between alpha and v1 where not much major development should happen. |
working through some examples will help, at least me, understand the framework.
🙏
by definition, the shape of these apis (path, input, output) is set and as stable as openai makes them. there are variations in completeness of the implementation.
the first of these is arguably a gap to close. the second is arguably a bug to fix, but may not be feasible. for instance, the nvidia service does not honor the number of logprobs requested. the llama api service is stricter about json schema for tool calls than other providers. how would these provider differences impact the classification of the api under this framework? how would you describe the third using this framework?
also by definition, the shape is stable. it may be new to stack, but it isn't changing. in the case of /v1/files, the localfs adapter does not implement expiration, while the s3 adapter does. how does the difference in adapter implementation impact the classification of the api?
by definition here, the shape is also stable. missing from the implementation is support for /v1/embeddings and /v1/responses, which happen to be part of the openapi spec (endpoint is an enum of /v1/responses, /v1/chat/completinos, /v1/embeddings, /v1/completions). the api shape for a Batch includes a status enum with fields validating, failed, in_progress, finalizing, completed, expired, cancelling, cancelled. the adapter will not produce a finalizing status. unlike the inference and files endpoints, /v1/batches only has one inline provider. how do these aspects impact the classification?
a practical consideration here, when using the
|
@mattf I think simply put: If any of our OpenAI compatible APIs are not "API complete" in the sense that a new route is added to the API itself (not a provider), or a breaking change to the api datatypes is made (like changing of required params for a route or return type) that is when something needs to be so if our OpenAI compatible APIs are missing something that is in the OpenAI spec, I think that merits a less than an example: lets say post_training needs a massive change and however, lets say the So generally: provider changes do not correlate to API maturity, but rather API level datatype or structural changes to required endpoints necessitate a lower level than Does this align with your thinking? |
2107957
to
0f3ba22
Compare
I think there are two aspects here:
And it is not clear whether one should merge both concerns into a single token "v1alpha1". I am sure this issue has been thought of by other projects before? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, @cdoern! This looks great, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested some small improvements though.
yeah @ashwinb that is the proper delineation. I think in LLS specifically, what matters most is the API definiton: datatypes, API routes+parameter+return types I kind of view the providers similarly to operators in k8s, where the maturity of an individual operator is not correlated to the maturity of all high level APIs. Of course, there is some intertwined nature, but this proposal is basically saying: Providers can iterate as much as they want on functionality as long as they work within the bounds of an API, if they need to change the API, then the API should not be |
going to make some of the above suggestions and repush the proposal as is, generally. |
0f3ba22
to
6195e99
Compare
Great work, @cdoern ! Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
4ba538c
to
84a4adc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
one last nit would be to include a proposal over the current state of APIs in this
thanks @franciscojavierarceo ! I think this warrants its own piece of work as a follow up. I was imagining this would merge and then the work to actually define which apis are at which level would happen immediately after so that no assumptions are made without research into the actual stability. hope that makes sense! |
84a4adc
to
06ae8ae
Compare
@mattf changed the verbiage discussing
|
06ae8ae
to
dbfc850
Compare
+1 -- let's handle it separately (both defining which APIs are which, and figuring out how to reflect it in the docs) |
|
||
Providers can iterate as much as they want on functionality as long as they work within the bounds of an API. If they need to change the API, then the API should not be `/v1`, or those breaking changes can only happen on a y-stream release basis. | ||
|
||
### Approval and Announcement Process for Breaking Changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably also include something like this to define a protocol for when there is a breaking change - #3260. A PR that is titled a specific way will not fail the oasdiff check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 it'll make it easier for calling out in the release notes and any sorts of additional announcements (e.g., in discord, email, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so by this you mean: I should add a bullet here describing how the PR title and commit message should include an indicator of a breaking change? I can add that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a section here, luckily conventional commits outlines how to handle this: https://www.conventionalcommits.org/en/v1.0.0/#specification
dbfc850
to
884d541
Compare
884d541
to
f4f2f8e
Compare
|
||
### Migration of API routes under `/v1alpha`, `/v1beta`, and `/v1` | ||
|
||
Instead of placing every API under `/v1`, any API that is not fully stable or complete should go under `/v1alpha` or `/v1beta`. For example, at the time of this writing, `post_training` belongs here, as well as any OpenAI-compatible API whose surface does not exactly match the upstream OpenAI API it mimics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we place any OpenAI-compatible APIs anywhere other than /v1
, that means that clients in the wild won't be able to find that API to use it, right? An OpenAI client or the various frameworks in the wild will expect all of the OpenAI APIs to live at the same place, behind a /v1
URL, and not be in different /v1alpha
or similar URLs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I 100% agree, and if we merge this and then find that openai APIs qualify as not v1
, I think we should re-evalute this proposal.
I am really just concerned with placing APIs under their proper levels to convey to users our level of confidence in the API. all sorts of new routes, parameters, etc, can be added to a v1
API, just following the proper processes.
- an API can graduate from `v1beta` to `v1` if the API surface and datatypes are complete as identified by the team. The parameters and return types that are mandatory for each route are stable. All aspects of graduating from `v1alpha1` to `v1beta` apply as well. | ||
- Optional parameters, routes, or parts of the return type can be added after graduating to `v1` | ||
|
||
### v1 (stable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is v1
, how do things become v2
? is there a v2alpha
process also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2
is something I think I'd avoid, especially given the openai routes. given the criteria here is rather loose (v1 apis can make breaking changes between Y-streams), I don't see a reason to graduate to v2
unless openai does.
I personally have seen most APIs who use this stability schema stick to v1
unless a major refactor occurs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a section for this outlining how a migration to v2
would go
|
||
### API Stability vs. Provider Stability | ||
|
||
The leveling introduced in this document relates to the stability of the API and not specifically the providers within the API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can perhaps add tables which show which providers are considered stable vs. not. at various points we have wanted to do this but never actually managed to run tests and do the maintenance given the surface area. anyhow just a drive-by comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, but this should likely be a separate document about provider stability guarantees.
|
||
### Migration of API routes under `/v1alpha`, `/v1beta`, and `/v1` | ||
|
||
Instead of placing every API under `/v1`, any API that is not fully stable or complete should go under `/v1alpha` or `/v1beta`. For example, at the time of this writing, `post_training` belongs here, as well as any OpenAI-compatible API whose surface does not exactly match the upstream OpenAI API it mimics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about the OpenAI stuff. Do you consider the extensions of the OpenAI API we add to be kosher or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think openAI apis are all v1 by default for usability concerns, and the net-new additions we make to them are OK as long as clients can upgrade to use them in a non-breaking manner. This is the grey area between concerns about API structure and API implementation (providers).
Generally speaking, any new routes and their implementations (providers) are ok for these APIs as long as between Z-stream releases, users aren't broken.
I think we could write a whole separate doc just about this "implementation" concern, but this doc is primarily about enforcing API structure norms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks pretty good. I would just want some discussion of "v1 -> v2" to also be included in the same document. It seems odd to have everything be just limited to "v1"
f4f2f8e
to
7c3ad5b
Compare
@ashwinb I added a section about |
this document outlines different API stability levels, how to enforce them, and next steps Signed-off-by: Charlie Doern <[email protected]>
7c3ad5b
to
4e096ba
Compare
@cdoern are you waiting for more feedback, or is this good to go? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All comments have been addressed, let's move forward, thanks!
What does this PR do?
this document outlines different API stability levels, how to enforce them, and next steps
Next Steps
Following the adoption of this document, all existing APIs should follow the enforcement protocol.
relates to #3237