hangyav / textLSP

Language server for text spell and grammar check with various tools.
GNU General Public License v3.0
52 stars 3 forks source link

OpenAI text correction : possibility to modify prompt on configuration? #44

Open mahaaaham opened 1 week ago

mahaaaham commented 1 week ago

Hi

This is maybe a very naive question, as I am not at ease with these tools.

I would like if there is a way to "fine-tune" the behavior of open AI text correct through a prompt, in the configuration of textlsp? For example, I would like to indicate the kind of document and tone, in order for it to find more mistakes.

For information, I use nvim with nvim-lspconfig and mason.

Thank you for your tool and for reading me!

hangyav commented 3 days ago

Hi,

Yes, this is already supported. You can use the edit_instruction property to set the prompt used for checking for errors:

textLSP = {
    analysers = {
        openai = {
            ...
            edit_instruction = 'Fix spelling and grammar errors.', -- This is the default
            ...
        },
    },
}

Please let us know if you come up with some interesting prompts ;)

mahaaaham commented 2 days ago

Thank you! My prompt will sadly be very specific, I guess ^^. I want English correction for a math article.