-
Notifications
You must be signed in to change notification settings - Fork 354
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
OpenAI compat API adapter #466
Conversation
This is a great idea although I would probably simplify the syntax a bit into a single object. Is there any other project that does this currently? If theres an establish spec I could follow it. |
Without any other spec, what about something like: "adapter": { With any missing or null field replaced with the default value for it. What's a good use case for after_last_mes? Seems like it would break most bot responses |
@LostRuins thanks, I've implemented preliminary support in my lib OpenAiNg, however the format can be changed, I'm open to the one you've proposed. As for |
I see. I think the |
Hi @lofcz please take a look, I have simplified the API as mentioned, let me know if it works adequately with your frontend (try both with and without the adapter to see if everything is ok) |
@LostRuins thanks for the edit, I've tried it both with and without and it works great. I'd share a video but my frontend is not in English so it wouldn't be legible for most. |
okay then looks good to me. will merge this :) cheers |
thanks! |
Nice addition lofcz and LostRuins!!! Very cool. |
What is the final format expected? |
As shown above. Just add the adapter to the regular json request body. |
The current OpenAI-like API uses hardcoded chat templates. This PR implements a non-breaking adapter users can exploit to use models requiring various chat templates. Testing request against Mistral7B Dolphin:
This PR proposes the following non-breaking addition to
/v1/chat/completions
endpoint:If users omit the
adapter
object in the request, we fall back to the default Vicuna-style template.Response with this patch:
Response with stock 1.46.1 build: