Closed nicehiro closed 6 months ago
Thanks for finding the solution! I think I've seen this problem with Curl + Windows + gptel before, I could remove the use of the compressed flag when Emacs is running on Windows.
I can make a PR if you are fine with this.
Is the PR to update the Azure instructions in the README?
Is the PR to update the Azure instructions in the README?
Yes. At first, I thought maybe add a notice for Windows users and also update the Azure instructions. But since you are gonna remove the compressed flag, I will only update the Azure instructions.
@nicehiro I've removed the --compressed
flag when using Windows. The PR with the correct Azure instructions will be very welcome!
I wonder if url
property of the gptel-backend
could be allowed to be a function. Because at least in my usage DEPLOYMENT == model
on azure. So I currently either have to register one backend per model for azure or resort to some advice hackery.
eg one would set url to something like (with host and port replaced by appropriate values)
(lambda ()
(let ((gptel-model-value (symbol-value 'gptel-model)))
(replace-regexp-in-string "%DEPLOYMENT%" gptel-model-value "https://host:port/openai/deployments/%DEPLOYMENT%/chat/completions?api-version=2023-09-01-preview" t t)))
@justussc I understand the issue. I'm trying to avoid the functionp
check that will be needed for the url with every API call. Can you think of some other way to achieve this?
i don't have a good idea how to get rid of that :( as i already had an advice for gpt-curl--get-args i am currently using that one:
(defun js/gptel-curl--get-args-advice (output)
(let ((model-string (symbol-value 'gptel-model)))
(cl-loop for el in ouput
unless (string= el "--compressed")
if (string= el "-m300")
append (list "-y300" "-Y1")
else
collect (replace-regex-in-string "%DEPLOYMENT%" model-string el))))
(advice-add 'gptel-curl--get-args :filter-return #js/gptel-curl--get-args-advice)
btw using -y300 -Y1
instead of -m300
might be a good idea for streaming. because as long as you still get new data you probably don't want to time out.
btw using -y300 -Y1 instead of -m300 might be a good idea for streaming. because as long as you still get new data you probably don't want to time out.
Thank you for this suggestion! Changed.
Hi, thanks for your great work.
I'm using Azure as a backend on Windows 11. My configurations are as follows,
The error messages:
Then I turned on the
gptel--debug
and found the error was the curl itself on Windows. More details are here.I solved this issue by using another version of curl rather than default win-32. I'm sharing it here for others' reference.
By the way, Azure endpoint seems not correct here. According to Azure OpenAI documents, the chat API endpoint should be "/openai/deployments/gpt-4/chat/completions?api-version=2023-05-15" and the one show in README is the completion API without "chat".
I can make a PR if you are fine with this.