Skip to content

Commit

Permalink
Simplify github models to be based of llm-azure (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyatt authored Jan 30, 2025
1 parent d86a8ca commit 1aafa60
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions llm-github.el
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,13 @@
;;; Code:

(require 'llm)
(require 'llm-openai)
(require 'cl-lib)
(require 'llm-azure)

(cl-defstruct (llm-github (:include llm-openai-compatible (url "https://models.inference.ai.azure.com"))))

(cl-defmethod llm-nonfree-message-info ((_ llm-github))
"Return GitHub's nonfree terms of service."
"https://docs.github.com/en/site-policy/github-terms/github-terms-of-service")
(cl-defstruct (llm-github (:include llm-azure
(url "https://models.inference.ai.azure.com"))))

(cl-defmethod llm-provider-chat-url ((provider llm-github))
(format "%s/chat/completions"
(llm-github-url provider)))

(cl-defmethod llm-provider-embedding-url ((provider llm-github) &optional _)
(format "%s/embeddings/"
(llm-github-url provider)))

(cl-defmethod llm-provider-headers ((provider llm-github))
`(("api-key" . ,(llm-github-key provider))))

(cl-defmethod llm-capabilities ((_ llm-github))
(list 'streaming 'embedding))
(format "%s/chat/completions" (llm-azure-url provider)))

(cl-defmethod llm-name ((provider llm-github))
(format "GitHub Models %s" (llm-github-chat-model provider)))
Expand Down

0 comments on commit 1aafa60

Please sign in to comment.