Skip to content

Commit

Permalink
Reduce Open AI's context length; most users will have smaller ctxt (#116
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ahyatt authored Nov 29, 2024
1 parent 3d045dd commit 0f58971
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions NEWS.org
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Version 0.19.1
- Fix Open AI context length sizes, which are mostly smaller than advertised.
* Version 0.19.0
- Add JSON mode, for most providers with the exception of Claude.
- Add ability for keys to be functions, thanks to Daniel Mendler.
Expand Down
12 changes: 7 additions & 5 deletions llm-models.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,29 @@ REGEX is a regular expression that can be used to identify the model, uniquely (
(make-llm-model
:name "GPT-4o" :symbol 'gpt-4o
:capabilities '(generation tool-use image-input)
:context-length 128000
;; For here and below, context length is smaller for most customers than
;; advertised. Only some corporate accounts have the larger context length.
:context-length 30000
:regex "gpt-4o\\'")
(make-llm-model
:name "GPT-4o mini" :symbol 'gpt-4o-mini
:capabilities '(generation tool-use image-input)
:context-length 128000
:context-length 30000
:regex "gpt-4o-mini")
(make-llm-model
:name "o1 Preview" :symbol 'o1-preview
:capabilities '(generation)
:context-length 128000
:context-length 30000
:regex "o1-preview")
(make-llm-model
:name "o1 Mini" :symbol 'o1-mini
:capabilities '(generation)
:context-length 128000
:context-length 30000
:regex "o1-mini")
(make-llm-model
:name "GPT-4 Turbo" :symbol 'gpt-4-turbo
:capabilities '(generation tool-use image-input)
:context-length 128000
:context-length 30000
:regex (rx (or "gpt-4-turbo" "gpt-4-0125" "gpt-4-1106")))
(make-llm-model
:name "GPT-4" :symbol 'gpt-4
Expand Down
6 changes: 4 additions & 2 deletions llm-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@
;; From https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo
(should-have-token-limit "gpt-4" 8192)
(should-have-token-limit "gpt-4-0613" 8192)
(should-have-token-limit "gpt-4o" 128000)
(should-have-token-limit "gpt-4o-mini" 128000)
;; I couldn't find documentation on this, but the token limit is actually
;; 30k instead of 128k for most customers.
(should-have-token-limit "gpt-4o" 30000)
(should-have-token-limit "gpt-4o-mini" 30000)
(should-have-token-limit "unknown" 4096)))

(ert-deftest llm-test-capabilities-openai-compatible ()
Expand Down
2 changes: 1 addition & 1 deletion llm.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; Author: Andrew Hyatt <[email protected]>
;; Homepage: https://github.com/ahyatt/llm
;; Package-Requires: ((emacs "28.1") (plz "0.8") (plz-event-source "0.1.1") (plz-media-type "0.2.1"))
;; Package-Version: 0.19.0
;; Package-Version: 0.19.1
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
;; This program is free software; you can redistribute it and/or
Expand Down

0 comments on commit 0f58971

Please sign in to comment.