Skip to content

Commit

Permalink
Merge branch 'main' into tool-use
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyatt committed Jan 20, 2025
2 parents 7b2d8b7 + 8351ee9 commit a08525d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
1 change: 1 addition & 0 deletions NEWS.org
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
* Version 0.21.0
- Incompatible change to function calling, which is now tool use, affecting arguments and methods.
- Support image understanding in Claude
- Add ~llm-models-add~ as a convenience method to add a model to the known list.
* Version 0.20.0
- Add ability to output according to a JSON spec.
- Add Gemini 2.0 Flash, Gemini 2.0 Flash Thinking, and Llama 3.3 and QwQ models.
Expand Down
12 changes: 5 additions & 7 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,11 @@ When picking a chat or embedding model, anything can be used, as long as the ser

#+begin_src emacs-lisp
(require 'llm-models)
(add-to-list
'llm-models
(make-llm-model
:name "Mistral" :symbol 'mistral
:capabilities '(generation tool-use free-software)
:context-length 8192
:regex "mistral"))
(llm-models-add
:name "Mistral" :symbol 'mistral
:capabilities '(generation tool-use free-software)
:context-length 8192
:regex "mistral"))
#+end_src

The =:regex= needs to uniquely identify the model passed in from a provider's chat or embedding model.
Expand Down
2 changes: 1 addition & 1 deletion llm-models-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
;; the models to ensure that the first match is the unique match.
(let ((models-names-to-test '("gpt-3.5-turbo-instructo" "gpt-4" "gpt-4o"
"gemini-1.5-flash" "llama-3" "llama-3.1"
"llama3" "llama3.1")))
"llama3" "llama3.1" "gemini-2.0-flash-thinking")))
(dolist (model-name models-names-to-test)
(let ((model-forward (llm-models-match model-name))
(model-reverse (let ((llm-models (reverse llm-models)))
Expand Down
26 changes: 25 additions & 1 deletion llm-models.el
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ REGEX is a regular expression that can be used to identify the model, uniquely (
:name "Gemini 2.0 Flash" :symbol 'gemini-2.0-flash
:capabilities '(generation tool-use image-input audio-input video-input)
:context-length 1048576
:regex "gemini-2\\.0-flash")
:regex "gemini-2\\.0-flash\\(-exp\\)?$")
(make-llm-model
:name "Gemini 2.0 Flash Thinking" :symbol 'gemini-2.0-flash-thinking
:capabilities '(generation)
Expand Down Expand Up @@ -248,6 +248,30 @@ REGEX is a regular expression that can be used to identify the model, uniquely (
"Return the model that matches NAME."
(seq-find (lambda (model) (string-match-p (llm-model-regex model) (downcase name))) llm-models))

(cl-defun llm-models-add (&key name symbol capabilities context-length regex)
"Add a model to the list of models.
NAME is the name of the model, appropriate for showing a user.
SYMBOL is a symbol representing the model, which just needs to be a
unique symbol, and can also be searched on.
CAPABILITIES is a list of symbols representing the capabilities of the
model. See `llm-capabilities' for the potential list of supported
capabilities. This may have some capabilities not yet supported by the
`llm-capabilities'.
CONTEXT-LENGTH is the maximum length of the context that can be used as
input.
REGEX is a regular expression that will be used to identify the model
uniquely, matched against the model specified by the user."
(push (make-llm-model :name name
:symbol symbol
:capabilities capabilities
:context-length context-length
:regex regex) llm-models))

(provide 'llm-models)

;;; llm-models.el ends here

0 comments on commit a08525d

Please sign in to comment.