« ^ »

生成系AIのAPIを使ってクロスレビューしてみている

所要時間: 約 1分

OpenAI APIとGoogle Gemini APIで、互いの指摘をクロスレビューしているけれど、Emaacsの指摘についてはOpenAI APIの方が正確なようにも思う。まあこのあたりは、使っているモデルが何かにもよるので、暫く試しながらチューニングしていきたい。

;;; ai --- Generative AI SaaS Utility -*- lexical-binding: t -*-

;; Copyright (C) 2024 TakesxiSximada

;; Author: TakesxiSximada <[email protected]>
;; Maintainer: TakesxiSximada <[email protected]>
;; Repository:
;; Version: 1
;; Package-Version: 20240301.0000
;; Package-Requires: ((emacs "28.0")
;; Date: 2024-03-03

;; This file is not part of Emacs.

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Code:

(require 'openai)
(require 'google-gemini)

;;;###autoload
(defun ai (txt func)
  (interactive
   (list (read-string-from-buffer
	  "AI" (if (region-active-p)
		   (let ((txt (buffer-substring-no-properties
			       (region-beginning) (region-end))))
		     (with-temp-buffer
		       (insert txt)
		       (goto-char (point-min))
		       (replace-regexp "^" "> ")
		       (buffer-string)))
		 ""))
	 (intern (completing-read "Select AI: "
				  '(openai-chat-question
				    google-gemini)))))
  (funcall func txt))

(provide 'ai)
;;; ai.el ends here