Skip to content

codellama unusable with llm-ls 0.5.1 #76

@williamspatrick

Description

@williamspatrick

I'm not sure if this is an issue for this repository or llm-ls, but it is unusable with the latest update. The <PRE>, <SUF>, etc. are not being properly stripped out anymore.

Things were working before with 0.4.0. I updated llm-ls with Mason and am at 38d6724f868211dc9a68a2a87a3c8caf3d1dbe65 with this repository (updated by Packer).

My config is as follow:

    require("llm").setup({
        tokens_to_clear = { "<EOT>" },
        fim = {
            enabled = true,
            prefix = "<PRE> ",
            middle = " <MID>",
            suffix = " <SUF>",
        },
        model = "codellama/CodeLlama-13b-hf",
        context_window = 4096,
        tokenizer = {
            repository = "codellama/CodeLlama-13b-hf",
        },
        lsp = {
            bin_path = vim.api.nvim_call_function("stdpath", { "data" })
                .. "/mason/bin/llm-ls",
        },
        accept_keymap = "<S-CR>",
        dismiss_keymap = "<C-CR>",
    })

Went a few lines into a file and did :LLMSuggestion and this is what I get. The <PRE> to <SUF> is what was above the line where the cursor is.

})
<PRE> require("mason").setup()
require("mason-lspconfig").setup({
    ensure_installed = {
        "gopls",
        "jedi_language_server",
        "jsonls",
        "lua_ls",
        "rust_analyzer",
    },
})
 <SUF>
local null_ls = require("null-ls")

null_ls.setup({
    sources = {
        null_ls.builtins.formatting.beautysh.with({
            extra_args = { "--force-function-style", "fnpar" },
        }),
        null_ls.builtins.formatting.black.with({
            extra_args = { "-l", "79", "--preview" },
        }),
        null_ls.builtins.formatting.clang_format,
        null_ls.builtins.formatting.gofmt,
        null_ls.builtins.formatting.isort.with({
            extra_args = { "--profile", "black" },
        }),
        null_ls.builtins.formatting.prettier.with({
            extra_args = { "--print-width=80", "--prose-wrap=always" },
        }),
        null_ls.builtins.formatting.rustfmt,
        null_ls.builtins.formatting.stylua.with({
            extra_args = { "--column-width", "80" },
        }),

        null_ls.builtins.diagnostics.cppcheck,
        null_ls.builtins.diagnostics.flake8.with({
            extra_args = { "--extend-ignore", "E203,E501" },
        }),
        null_ls.builtins.diagnostics.markdownlint.with({
            extra_args = { "--disable", "line-length", "--" },
        }),
        null_ls.builtins.diagnostics.mypy.with({
            extra_args = { "--strict" },
        }),
        null_ls.builtins.diagnostics.shellcheck,
        null_ls.builtins.diagnostics.zsh,

        null_ls.builtins.code_actions.shellcheck,
    },
})

vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
vim.keymap.set("n", "gt", vim.lsp.buf.type_definition, {})
vim.keymap.set("n", "gr", vim.lsp.buf.references, {})
vim.keymap.set({ "n", "i" }, "<c-k>", vim.lsp.buf.signature_help, {})
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, {})
vim.keymap.set("n", "<leader>cf", vim.lsp.buf.format, {})
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
vim.keymap.set("n", "<leader>ce", function()
    vim.diagnostic.open_float({ border = "rounded" })
end, {})

vim.keymap.set("n", "<leader>cm", "<cmd>Make<cr>", {})

-- Change style of LSP borders.
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
    border = "rounded",
})
vim.lsp.handlers["textDocument/signatureHelp"] =
    vim.lsp.with(vim.lsp.handlers.signature_help, {
        border = "rounded",
    })

vim.cmd([[highlight! link FloatBorder Comment]])
 <MID>
require("nvim-treesitter.configs").setup({
    ensure_installed = {
        "bash",
        "c",
        "cmake",
        "comment",
        "cpp",
        "css",
        "dockerfile",
       

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions