Giter VIP home page Giter VIP logo

lsp-ai.nvim's People

Contributors

superbo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lsp-ai.nvim's Issues

Key "end" cannot be used in lua

How would you advise configuring FIM with "end", as seen in this example?

{
  "memory": {
    "file_store": {}
  },
  "models": {
    "model1": {
      "type": "ollama",
      "model": "deepseek-coder"
    }
  },
  "completion": {
    "model": "model1",
    "parameters": {
      "fim": {
        "start": "<|fim▁begin|>",
        "middle": "<|fim▁hole|>",
        "end": "<|fim▁end|>"
      },
      "max_context": 2000,
      "options": {
        "num_predict": 32
      }
    }
  }
}

It does not quite work with Lua:

Screenshot 2024-06-17 at 17 30 32

This seems to work, but not the most beautiful:

local function ollama_fim_example()
  local server = {
    memory = {
      file_store = {},
    },
    models = {
      model1 = {
        type = "ollama",
        model = "codegemma",
      },
    },
    completion = {
      model = "model1",
      parameters = {

        start = "<|fim▁begin|>",
        middle = "<|fim▁hole|>",
        -- end = "<|fim▁end|>",
      },
      max_context = 2000,
      options = {
        num_predict = 32,
      },
    },
  }
  server.completion.parameters["end"] = "<|fim▁end|>" -- NOTE: workaround

  return server
end

return {

  {
    -- Invoke with `:LSPAIComplete`
    "SuperBo/lsp-ai.nvim",
    dependencies = { "neovim/nvim-lspconfig" },
    opts = {
      -- autostart = true,
      server = ollama_fim_example(),
    },
    config = function(_, opts)
      require("lsp_ai").setup(opts)
    end,
  },

Ability to configure keymaps for accept/cancel

Hey again 😄👋

It would be awesome to define which keymaps you wish to use for accepting or cancelling the generated code. As an example, I use the copilot.lua defaults for accepting code snippets (<M-l>) and would like to use the same keymap with lsp-ai.

Hardcoded to model1?

Is it possible that the desired model is hardcoded to model1?

I've got this config:

return {
  {
    "SuperBo/lsp-ai.nvim",
    dependencies = { "neovim/nvim-lspconfig" },
    opts = {
      autostart = true,
      server = {
        memory = {
          file_store = {},
        },
        models = {
          llama_cpp = {
            type = "llama_cpp",
            file_path = vim.fn.expand("~/code/public/CodeQwen1.5-7B-Chat-GGUF/codeqwen-1_5-7b-chat-q4_k_m.gguf"),
            n_ctx = 1024 * 4,
            n_gpu_layers = 500,
          },
          ollama = {
            type = "ollama",
            model = "llama3",
          },
        },
      },
      completion = {
        model = "ollama",
        parameters = {
          messages = {
            {
              role = "system",
              content = "You are a programming completion tool. Replace <CURSOR> with the correct code.",
            },
            {
              role = "user",
              content = "{CODE}",
            },
          },
        },
        max_context_size = 1024 * 4,
      },
    },
    config = function(_, opts)
      require("lsp_ai").setup(opts)
    end,
  },
}

And I get this error:

   Error  16:06:45 notify.error [LSP-AI] can't find model: model1

If I instead rename e.g. the ollama key into model1, I don't get the error and the completion works:

return {
  {
    "SuperBo/lsp-ai.nvim",
    dependencies = { "neovim/nvim-lspconfig" },
    opts = {
      autostart = true,
      server = {
        memory = {
          file_store = {},
        },
        models = {
          llama_cpp = {
            type = "llama_cpp",
            file_path = vim.fn.expand("~/code/public/CodeQwen1.5-7B-Chat-GGUF/codeqwen-1_5-7b-chat-q4_k_m.gguf"),
            n_ctx = 1024 * 4,
            n_gpu_layers = 500,
          },
-           ollama = {
+           model1 = {
            type = "ollama",
            model = "llama3",
          },
        },
      },
      completion = {
-         model = "ollama",
+         model = "model1",
        parameters = {
          messages = {
            {
              role = "system",
              content = "You are a programming completion tool. Replace <CURSOR> with the correct code.",
            },
            {
              role = "user",
              content = "{CODE}",
            },
          },
        },
        max_context_size = 1024 * 4,
      },
    },
    config = function(_, opts)
      require("lsp_ai").setup(opts)
    end,
  },
}

fail to start due to some errors

error:

Warning: Failed searching manifest: Failed downloading https://nvim-neorocks.github.io/rocks-binaries/dev/manifest-5.1 - failed downloading https://nvim-neorocks.github.io/rocks-binaries/dev/manifest-5.1

        Error: No results matching query were found for Lua 5.1.
        To check if it is available for other Lua versions, use --check-lua-versions.
        Failed installing lsp-ai.nvim with `luarocks`.

        --------------------------------------------------------------------------------

        Trying to build from source.
        Missing dependencies for lsp-ai.nvim scm-1:
           nvim-lspconfig >= 0.1.6 (not installed)

        lsp-ai.nvim scm-1 depends on lua >= 5.1 (5.1-1 provided by VM: success)
        lsp-ai.nvim scm-1 depends on nvim-lspconfig >= 0.1.6 (not installed)
        Installing https://luarocks.org/nvim-lspconfig-0.1.8-1.src.rock

        nvim-lspconfig 0.1.8-1 depends on lua >= 5.1 (5.1-1 provided by VM: success)
        No existing manifest. Attempting to rebuild...

Looks like lua version is hardcoded to 5.1. But I use 5.4.
And this link :https://nvim-neorocks.github.io/rocks-binaries/dev/manifest-5.1 is a 404 page.

Looks like you are using luarocks, a package manager. what benifits it brings?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.