Added ForgeLLM

This commit is contained in:
Roger Gonzalez 2025-03-14 16:18:27 -03:00
parent 1a2162dd84
commit c7e011428b
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
5 changed files with 29 additions and 8 deletions

Binary file not shown.

View File

@ -365,15 +365,20 @@ text and copying to the killring."
(setq chatgpt-shell-openai-key openai-key) (setq chatgpt-shell-openai-key openai-key)
(setq dall-e-shell-openai-key openai-key) (setq dall-e-shell-openai-key openai-key)
(require 'llm-openai) (require 'llm-ollama)
(setq magit-gptcommit-llm-provider (make-llm-openai :key openai-key)) (setq magit-gptcommit-llm-provider (make-llm-ollama :scheme "http" :host "192.168.0.122" :embedding-model "tavernari/git-commit-message" :chat-model "tavernari/git-commit-message"))
(setq llm-warn-on-nonfree nil) (setq llm-warn-on-nonfree nil)
(after! magit (after! magit
(magit-gptcommit-mode 1) (magit-gptcommit-mode 1)
(setq magit-gptcommit-prompt "You are an expert programmer writing a commit message. You went over every file diff that was changed in it. Summarize the commit into a single specific and cohesive theme. Remember to write in only one line, no more than 50 characters. Write your response using the imperative tense following the kernel git commit style guide. Write a high level title. THE FILE DIFFS:```%s```. Now write Commit message in follow template: [one line of summary]") (setq magit-gptcommit-prompt "You are an expert programmer writing a commit message. You went over every file diff that was changed in it. Summarize the commit into a single specific and cohesive theme. Remember to write in only one line, no more than 50 characters. Write your response using the imperative tense following the kernel git commit style guide. Write a high level title. THE FILE DIFFS:```%s```. Now write Commit message in follow template: [one line of summary]. Respond only with the commit message and nothing else.")
(magit-gptcommit-status-buffer-setup)) (magit-gptcommit-status-buffer-setup))
(require 'forge-llm)
(forge-llm-setup)
(require 'llm-claude)
(setq forge-llm-llm-provider (make-llm-claude :key anthropic-key :chat-model "claude-3-7-sonnet-latest"))
(use-package! copilot (use-package! copilot
:hook (prog-mode . copilot-mode) :hook (prog-mode . copilot-mode)
:bind (:map copilot-completion-map :bind (:map copilot-completion-map

View File

@ -408,7 +408,7 @@ Here's where custom functionalities get configured.
:ID: af485cc4-be52-4bb4-889d-7de8bea1ed66 :ID: af485cc4-be52-4bb4-889d-7de8bea1ed66
:END: :END:
This function brings up a comparisson between the current ~init.el~ file and the example file This function brings up a comparison between the current ~init.el~ file and the example file
(~templates/init.example.el~). Very useful for upgrading manually. (~templates/init.example.el~). Very useful for upgrading manually.
More info here: https://github.com/doomemacs/doomemacs/issues/581#issuecomment-645448095 More info here: https://github.com/doomemacs/doomemacs/issues/581#issuecomment-645448095
@ -558,7 +558,7 @@ Clipmon is my clipboard manager in Emacs.
:around #'my/magit-gptcommit-commit-accept-wrapper) :around #'my/magit-gptcommit-commit-accept-wrapper)
#+end_src #+end_src
** ChatGPT ** LLM
:PROPERTIES: :PROPERTIES:
:ID: 0a32d2a9-2156-42a3-90f7-419ac1a25496 :ID: 0a32d2a9-2156-42a3-90f7-419ac1a25496
:END: :END:
@ -581,16 +581,28 @@ Clipmon is my clipboard manager in Emacs.
:END: :END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'llm-openai) (require 'llm-ollama)
(setq magit-gptcommit-llm-provider (make-llm-openai :key openai-key)) (setq magit-gptcommit-llm-provider (make-llm-ollama :scheme "http" :host "192.168.0.122" :embedding-model "tavernari/git-commit-message" :chat-model "tavernari/git-commit-message"))
(setq llm-warn-on-nonfree nil) (setq llm-warn-on-nonfree nil)
(after! magit (after! magit
(magit-gptcommit-mode 1) (magit-gptcommit-mode 1)
(setq magit-gptcommit-prompt "You are an expert programmer writing a commit message. You went over every file diff that was changed in it. Summarize the commit into a single specific and cohesive theme. Remember to write in only one line, no more than 50 characters. Write your response using the imperative tense following the kernel git commit style guide. Write a high level title. THE FILE DIFFS:```%s```. Now write Commit message in follow template: [one line of summary]") (setq magit-gptcommit-prompt "You are an expert programmer writing a commit message. You went over every file diff that was changed in it. Summarize the commit into a single specific and cohesive theme. Remember to write in only one line, no more than 50 characters. Write your response using the imperative tense following the kernel git commit style guide. Write a high level title. THE FILE DIFFS:```%s```. Now write Commit message in follow template: [one line of summary]. Respond only with the commit message and nothing else.")
(magit-gptcommit-status-buffer-setup)) (magit-gptcommit-status-buffer-setup))
#+end_src #+end_src
*** Forge LLM
:PROPERTIES:
:ID: 51b0f8e3-68b3-46af-91d4-a9b87b1e6b94
:END:
#+begin_src emacs-lisp
(require 'forge-llm)
(forge-llm-setup)
(require 'llm-claude)
(setq forge-llm-llm-provider (make-llm-claude :key anthropic-key :chat-model "claude-3-7-sonnet-latest"))
#+end_src
** Github Copilot ** Github Copilot
:PROPERTIES: :PROPERTIES:
:ID: 7f88ce20-846c-47e4-aeed-d853212c9db5 :ID: 7f88ce20-846c-47e4-aeed-d853212c9db5

View File

@ -1,5 +1,6 @@
;;; custom-packages/private.el -*- lexical-binding: t; -*- ;;; custom-packages/private.el -*- lexical-binding: t; -*-
(defvar openai-key "a-big-openai-key") (defvar openai-key "a-big-openai-key")
(defvar anthropic-key "a-big-anthropic-key")
(provide 'private) (provide 'private)

View File

@ -73,3 +73,6 @@
(package! org-auto-tangle) (package! org-auto-tangle)
(package! auto-virtualenv) (package! auto-virtualenv)
(package! magit-gptcommit) (package! magit-gptcommit)
(package! forge-llm
:recipe (:host gitlab :repo "rogs/forge-llm"))
(package! llm)