Skip to content
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

Azure API deprecation #55

Closed
chrisbetz opened this issue Feb 9, 2024 · 2 comments · Fixed by #56
Closed

Azure API deprecation #55

chrisbetz opened this issue Feb 9, 2024 · 2 comments · Fixed by #56

Comments

@chrisbetz
Copy link

As stated in https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation, MS will deprecate certain versions of the OpenAI inference API.

I was able to "patch" this for my use with a little hack, but you might want to update to

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-12-01-preview/inference.json

The hack (for others to use, with the inference file in your resources folder as AzureOpenAI/2023-12-01-preview.json) is

(ns azure.openai.patch)


(in-ns 'wkok.openai-clojure.azure)


(defn load-openai-spec []
  (json/decode (slurp (io/resource "AzureOpenAI/2023-12-01-preview.json")) keyword))

(def m
  (delay
    (patch-handler
      (martian/bootstrap-openapi "/openai"
                                 (load-openai-spec)
                                 (update
                                   martian-http/default-opts
                                   :interceptors
                                   #(-> (remove (comp #{martian-http/perform-request}) %)
                                        (concat [add-authentication-header
                                                 openai-interceptors/set-request-options
                                                 override-api-endpoint
                                                 sse/perform-sse-capable-request])))))))

(defn patch-params [params]
  {:api-version       "2023-12-01-preview"
   :deployment-id     (:model params)
   :martian.core/body (dissoc params :model)})

and then requiring azure.openai.patch at the right point in your code ;)

@wkok
Copy link
Owner

wkok commented Feb 9, 2024

Thanks!
Updated to latest spec in #56 if you'd like to confirm

@wkok wkok closed this as completed in #56 Feb 9, 2024
@chrisbetz
Copy link
Author

Yes, can confirm it's working. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants