-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Support oobabooga/text-generation-webui
OpenAI API implementation.
#95
Comments
After trying with the settings, (setq org-ai-openai-chat-endpoint "http://localhost:1234/v1/chat/completions")
(setq org-ai-openai-completion-endpoint "http://localhost:1234/v1/completions") I can confirm it when testing with the server provided by lm-studio:
|
I used the server provided with oobabooga and I get the same thing. Set the same API key in textwebui and emacs to replicate. |
As a workaround, I changed the order of evaluation in ;; try openai streamed
(t (let ((choices (plist-get response 'choices)))
(cl-loop for choice across choices
append (or (when-let ((content (plist-get (plist-get choice 'delta) 'content)))
(list (make-org-ai--response :type 'text :payload content)))
(when-let ((finish-reason (plist-get choice 'finish_reason)))
(list (make-org-ai--response :type 'stop :payload finish-reason)))
(when-let ((role (plist-get (plist-get choice 'delta) 'role)))
(list (make-org-ai--response :type 'role :payload role)))
(when-let ((role (plist-get (plist-get choice 'delta) 'content)))
(list (make-org-ai--response :type 'text :payload role))))))) Downside of this is that the |
The old API from https://github.com/oobabooga/text-generation-webui is deprecated in support of their OpenAI API implementation, which is supposed to be a drop-in replacement. Simply setting the endpoints
org-ai-openai-chat-endpoint
andorg-ai-openai-completion-endpoint
almost works except theorg-ai--insert-chat-completion-response
function seems to assume thatdelta.role
anddelta.content
are mutually exclusive. This might be the case for OpenAI's implemention of the OpenAI API, but thetext-generation-webui
implementation may have both fields be non-empty while also repeating the same role. There does not seem to be any indication in the OpenAI API reference thatdelta.role
anddelta.content
need be mutually exclusive, so I don't think it would be correct to call this a bug ontext-generation-webui
's end.Consequently, I get results like this:
With this as the request buffer:
The text was updated successfully, but these errors were encountered: