-
Notifications
You must be signed in to change notification settings - Fork 325
Add annotations next to model completion candidates #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Move partial model info to gptel-anthropic-models constant. - Expand model info and add new plist keys. - Include information sources about the Anthropic models.
Also, given the amount of information now available for each model, perhaps we should allow the user to customize which specific properties are displayed, and/or decide which will be displayed by default. |
Thank you, this looks good so far. We need to add similar model information
Displayed where? As annotations when selecting a backend/model, or displayed in the mode-line/header line in chat buffers? |
I’m happy to add this now.
As annotations. |
- Move partial model info to gptel--gemini-models constant. - Expand model info and add new plist keys. - Include information sources about the Gemini models.
248560e
to
74ff8de
Compare
- Move partial model info to gptel--openai-models constant. - Expand model info and add new plist keys. - Include information sources about the OpenAI models.
I have now finished adding the relevant information for Claude, Anthropic and OpenAI. Note that the |
One more thing: I didn’t add information for |
No worries, we can get to it later (i.e. not as part of this PR).
|
Looks great so far, thanks! I particularly like that you included links to the sources for this information in the docstrings. The last remaining step is to update the annotation function in
I don't think it's worth making it customizable at this stage, since this is only relevant as a discoverability feature when changing models. We can always make the details customizable later. The screenshot you had in #315 looks like a good set of defaults. To save screen space we could list the the context size as |
Oh, and my revision doesn’t handle cases when a field exceeds its allotted size. I’m not sure what the proper way to handle this is (though I can easily find out with the help of |
To save some space I think we can omit the prefixes ("Context: ", "Updated: ", "Cost: "), these are fairly obvious from, uh, context. EDIT: The meaning of the date and cost fields should be obvious from the date and the
For the cost specifically, perhaps something like
It will just "overflow" and push the remaining columns to the right, I think that's fine. I suggest changing the ordering slightly to
although any ordering of the last three fields should be fine. |
1080p screen full width: 1000 px window: 720 px window: The display breaks down as the window width shrinks, a common problem with annotation strings with relative spacing. I think we need to prepend a space to the description at least. It might be a good idea to use fixed width fields, truncating the description to the field width when displaying it. This is how other packages like Citar show tabular data -- it remains stable at lower window widths: |
Here's what I'm trying right now as the annotation function: (lambda (comp)
(let* ((model (nth 2 (assoc comp models-alist)))
(desc (get model :description))
(caps (get model :capabilities))
(context (get model :context-window))
(input-cost (get model :input-cost))
(output-cost (get model :output-cost))
(updated (get model :updated)))
(when (or desc caps context input-cost output-cost updated)
(concat
(propertize " " 'display `(space :align-to 40))
(when desc (truncate-string-to-width desc 70 nil ? t t))
" " (propertize " " 'display `(space :align-to 112))
(when caps (prin1-to-string caps))
" " (propertize " " 'display `(space :align-to 138))
(when context (format "%6dk" context))
" " (propertize " " 'display `(space :align-to 145))
(when input-cost (format "%10s" (format "$%.2f in" input-cost)))
" " (propertize " " 'display `(space :align-to 154))
(when output-cost (format "%11s" (format "$%.2f out" output-cost)))
" " (propertize " " 'display `(space :align-to 170))
updated)))) It works better at all window widths, but it's not adaptive -- you need a minimum window width of around 180 chars to see a full annotation string. |
The adaptiveness problem could potentially be solved by setting the width of the fields to either the longest string to be displayed for that field (plus padding) or an upper string length limit, whichever is shorter. In your code, for |
|
The latest commits shorten the |
I see that there is one more case that we need to handle: when the length of the model name is greater than the value of `:align-to` in the `desc` line (currently 40). Thoughts?
I think 40 is a reasonable number for backend+model name, but there are a few exceptions. For example, I have
TogetherAI:mistralai/Mixtral-8x7B-Instruct-v0.1
which is 48 chars. Setting the width to 50 or the length of the longest string (48 here) for every entry seems like a waste of window space most of the time. Names like this are uncommon, I think we can get away with a field width of 40. What do you think?
|
I’d agree with you. The alternatives would be to truncate the model name in the prompt or to set the length of this field dynamically based on the longest model name in the completion candidates. Frankly, I don’t know how to implement either of those options (I spent some time trying to develop something with Claude but all efforts failed). |
Yeah, your ellipses character is single width, while mine isn't, or at least mine isn't as narrow. It depends on the font and some other details I don't understand. You can check by running EDIT: Just checked with a few other monospace fonts -- they work fine. Only Iosevka seems to have this problem. |
I have now processed your suggestions.
Not done, since I was not able to reproduce the issue (as mentioned).
Done.
Done.
Not done, since I was not able to confirm this. The official GPT-4 page still lists October 2023. Furthermore, when I asked GPT-4o, it responded that the cutoff dates, for both GPT-4 and GPT-4o, are October 2023. Separately, I have replaced |
This mirrors what we do for Gemini and Anthropic models.
I fixed a few more things. I’m pretty happy with the current version, so unless you have further suggestions, I think it can be merged. |
None of the OpenAI, Anthropic or Gemini models specify a cutoff date with day precision. So listing the first day of the month—or any other day—is inappropriate.
Looks good! Thanks for your hard work @benthamite. Here's hoping Emacs gets an easier way to display tabular data in annotation functions, the way |
Great! I’m happy to have contributed to what is my all-time favorite Emacs package. |
Add extra model information including model descriptions, input and output costs and cutoff dates for all the major LLM providers. * gptel-anthropic.el (gptel--anthropic-models): Move existing partial model info to `gptel-anthropic-models'. Add updated Anthropic models and properties. Include information sources about the Anthropic models. * gptel-gemini.el (gptel--gemini-models): Move existing partial model info to `gptel-gemini-models'. Add updated Gemini models and properties. Include information sources about the Gemini models. * gptel.el (gptel--openai-models): Move existing partial model info to `gptel-openai-models'. Add updated OpenAI models and properties. Include information sources about the OpenAI models. * gptel-transient.el (gptel--infix-provider): Update annotation function to show extra model details when changing models.
Continuing #315, I have added a commit that implements what we discussed for the Anthropic models. Let me know if this is what you had in mind, and if so I’ll proceed to make the relevant changes for the remaining models.