This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Repository navigation
OpenAI API JSON formatted - #995
Merged
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchchat/995
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 0d3a5c3 with merge base a3bf37d ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
|
Can you add a video for non-chunked as well for record purposes |
Jack-Khuu
approved these changes
Aug 2, 2024
Jack-Khuu
left a comment
Contributor
There was a problem hiding this comment.
Some nits, but the content lgtm
Remember to verify the behavior lines up with how people plan on using OpenAI
Comment on lines
+222
to
+235
| self.system_fingerprint = ( | ||
| self.builder_args.device + type(self.builder_args.precision).__name__ | ||
| ) |
Contributor
There was a problem hiding this comment.
Let's add a comment that this field doesn't match the spec, but is populated
We'll fix in a separate PR
Comment on lines
+68
to
+69
| nextok = chunk.choices[0].delta.content | ||
| nextok = nextok if nextok is not None else "" |
Contributor
There was a problem hiding this comment.
Suggested change
| nextok = chunk.choices[0].delta.content | |
| nextok = nextok if nextok is not None else "" | |
| if (next_tok := chunk.choices[0].delta.content) is None: | |
| next_tok = "" |
vmpuri
force-pushed
the
openai_api_patches
branch
from
August 2, 2024 20:26
8472f6d to
975a817
Compare
Closed
vmpuri
force-pushed
the
openai_api_patches
branch
from
August 5, 2024 21:47
975a817 to
6401f55
Compare
vmpuri
force-pushed
the
openai_api_patches
branch
from
August 5, 2024 21:49
6401f55 to
4e26b22
Compare
byjlw
approved these changes
Aug 5, 2024
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement JSON formatted responses using OpenAI API types for server completion requests. Rather than giving single tokens at a time, the server will respond with a JSON following the API dataclasses corresponding to OpenAI API types.
Testing:
Server
Request (chunked)
Request (synchronous)
Screen.Recording.2024-08-02.at.1.22.21.PM.mov