Skip to content
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

Allow customizing the formatting of context insertions to suit model expectations #367

Open
algal opened this issue Aug 26, 2024 · 1 comment

Comments

@algal
Copy link
Contributor

algal commented Aug 26, 2024

Right now, gptel lets you add files and buffers to the context. But if I understand right, from from the code of functions like gptel-context--insert-buffer-string and gptel-context--file-string, it always adds this material to the context using header line like In file ...: or In buffer ...:.

However, Anthropic is very clear that their model performs better if quoted files and other such material are contained within XML-like tags. This has been my experience as well.

It would be valuable to be able to customize how gptel builds the context string, so that it could be optimized to work with a particular model. I think it'd be especially valuable to do this for Claude right now, since the sonnet-3.5 model is very strong at coding assistance in a conversational style.

I'd be happy to work on this change, if it seems like it would be worth pursuing.

@karthink
Copy link
Owner

If I understand correctly, you're looking for the option gptel-context-wrap-function. See its documentation for details, and let me know what you think.

I'll leave this issue open for now since I think there's room for improvement. Perhaps gptel can provide a few wrap functions out of the box tailored to the expectations of the big LLM providers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@algal @karthink and others