gptel-ollama, gptel-openai: Add example of backend creation

README: Fix error with Ollama backend instructions
This commit is contained in:
Karthik Chikmagalur 2023-10-29 00:31:56 -07:00
parent 190d1d20e2
commit 1434bbac7b
3 changed files with 37 additions and 9 deletions

View file

@ -169,12 +169,11 @@ You can pick this backend from the transient menu when using gptel (see usage),
Register a backend with Register a backend with
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defvar gptel--ollama (gptel-make-ollama
(gptel-make-ollama
"Ollama" ;Any name of your choosing "Ollama" ;Any name of your choosing
:host "localhost:11434" ;Where it's running :host "localhost:11434" ;Where it's running
:models '("mistral:latest") ;Installed models :models '("mistral:latest") ;Installed models
:stream t)) ;Stream responses :stream t) ;Stream responses
#+end_src #+end_src
These are the required parameters, refer to the documentation of =gptel-make-gpt4all= for more. These are the required parameters, refer to the documentation of =gptel-make-gpt4all= for more.

View file

@ -113,7 +113,16 @@ alist, like:
KEY (optional) is a variable whose value is the API key, or KEY (optional) is a variable whose value is the API key, or
function that returns the key. This is typically not required for function that returns the key. This is typically not required for
local models like Ollama." local models like Ollama.
Example:
-------
(gptel-make-ollama
\"Ollama\"
:host \"localhost:11434\"
:models '(\"mistral:latest\")
:stream t)"
(let ((backend (gptel--make-ollama (let ((backend (gptel--make-ollama
:name name :name name
:host host :host host

View file

@ -166,7 +166,18 @@ alist, like:
((\"Content-Type\" . \"application/json\")) ((\"Content-Type\" . \"application/json\"))
KEY (optional) is a variable whose value is the API key, or KEY (optional) is a variable whose value is the API key, or
function that returns the key." function that returns the key.
Example:
-------
(gptel-make-azure
\"Azure-1\"
:protocol \"https\"
:host \"YOUR_RESOURCE_NAME.openai.azure.com\"
:endpoint \"/openai/deployments/YOUR_DEPLOYMENT_NAME/completions?api-version=2023-05-15\"
:stream t
:models '(\"gpt-3.5-turbo\" \"gpt-4\"))"
(let ((backend (gptel--make-openai (let ((backend (gptel--make-openai
:name name :name name
:host host :host host
@ -210,7 +221,16 @@ alist, like:
KEY (optional) is a variable whose value is the API key, or KEY (optional) is a variable whose value is the API key, or
function that returns the key. This is typically not required for function that returns the key. This is typically not required for
local models like GPT4All.") local models like GPT4All.
Example:
-------
(gptel-make-gpt4all
\"GPT4All\"
:protocol \"http\"
:host \"localhost:4891\"
:models '(\"mistral-7b-openorca.Q4_0.gguf\"))")
(provide 'gptel-openai) (provide 'gptel-openai)
;;; gptel-backends.el ends here ;;; gptel-backends.el ends here