gptel icon indicating copy to clipboard operation
gptel copied to clipboard

Allow customizing the formatting of context insertions to suit model expectations

Open algal opened this issue 5 months ago • 1 comments

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.

algal avatar Aug 26 '24 20:08 algal