ppq: Highlight cheap models
This commit is contained in:
parent
09c338e16e
commit
18a7d1f126
1 changed files with 16 additions and 7 deletions
|
|
@ -129,6 +129,14 @@
|
||||||
(or completion 0)
|
(or completion 0)
|
||||||
currency))))
|
currency))))
|
||||||
|
|
||||||
|
(defun ppq--model-has-cheap-output-p (model)
|
||||||
|
"Check if MODEL has output price per 1M tokens in range [0, 1)."
|
||||||
|
(let* ((pricing (ppq--aget model 'pricing))
|
||||||
|
(completion (when pricing (ppq--aget pricing 'output_per_1M_tokens))))
|
||||||
|
(and (numberp completion)
|
||||||
|
(>= completion 0)
|
||||||
|
(< completion 1))))
|
||||||
|
|
||||||
(defun ppq--fetch-models-callback (status)
|
(defun ppq--fetch-models-callback (status)
|
||||||
"Callback for async model fetching. STATUS is the url-retrieve status."
|
"Callback for async model fetching. STATUS is the url-retrieve status."
|
||||||
(unless (plist-get status :error)
|
(unless (plist-get status :error)
|
||||||
|
|
@ -276,13 +284,14 @@
|
||||||
(setq tabulated-list-entries
|
(setq tabulated-list-entries
|
||||||
(mapcar
|
(mapcar
|
||||||
(lambda (model)
|
(lambda (model)
|
||||||
|
(let ((cheap-p (ppq--model-has-cheap-output-p model)))
|
||||||
(list (ppq--aget model 'id)
|
(list (ppq--aget model 'id)
|
||||||
(vector
|
(vector
|
||||||
(propertize (or (ppq--aget model 'name) "N/A") 'font-lock-face nil)
|
(propertize (or (ppq--aget model 'name) "N/A") 'font-lock-face (if cheap-p '(:foreground "green") nil))
|
||||||
(propertize (or (ppq--aget model 'id) "N/A") 'font-lock-face nil)
|
(propertize (or (ppq--aget model 'id) "N/A") 'font-lock-face (if cheap-p '(:foreground "green") nil))
|
||||||
(propertize (ppq--format-created-at (ppq--aget model 'created_at)) 'font-lock-face nil)
|
(propertize (ppq--format-created-at (ppq--aget model 'created_at)) 'font-lock-face (if cheap-p '(:foreground "green") nil))
|
||||||
(propertize (ppq--format-context-length (ppq--aget model 'context_length)) 'font-lock-face nil)
|
(propertize (ppq--format-context-length (ppq--aget model 'context_length)) 'font-lock-face (if cheap-p '(:foreground "green") nil))
|
||||||
(propertize (ppq--format-pricing model) 'font-lock-face nil))))
|
(propertize (ppq--format-pricing model) 'font-lock-face (if cheap-p '(:foreground "green") nil))))))
|
||||||
ppq--models-data))
|
ppq--models-data))
|
||||||
(tabulated-list-init-header)
|
(tabulated-list-init-header)
|
||||||
(tabulated-list-print))
|
(tabulated-list-print))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue