llm.nvim icon indicating copy to clipboard operation
llm.nvim copied to clipboard

No Auto-Completions and weird offset_encodings warning

Open mAmineChniti opened this issue 1 year ago • 5 comments

WindowsTerminal_EkvgUjPfun

As you see i'm getting this weird warning and no completion when trying to write cpp, this is my llm.nvim setup using lazy

{
    'huggingface/llm.nvim',
    opts = {
      backend = 'ollama',
      model = 'deepseek-coder',
      accept_keymap = '<Tab>',
      dismiss_keymap = '<S-Tab>',
      url = 'http://localhost:11434/api/generate',
      request_body = {
        options = {
          temperature = 0.2,
          top_p = 0.95,
        },
      },
      enable_suggestions_on_startup = false,
      lsp = {
        bin_path = vim.api.nvim_call_function('stdpath', { 'data' }) .. '/mason/bin/llm-ls',
      },
    },
  },

mAmineChniti avatar Mar 20 '24 09:03 mAmineChniti

i'm using this configuration now

{
    'huggingface/llm.nvim',
    opts = {
      backend = 'ollama',
      model = 'gemma:2b',
      url = 'http://localhost:11434/api/generate',
      tokens_to_clear = { '<|endoftext|>' },
      request_body = {
        parameters = {
          max_new_tokens = 60,
          temperature = 0.2,
          top_p = 0.95,
        },
      },
      debounce_ms = 150,
      accept_keymap = '<Tab>',
      dismiss_keymap = '<S-Tab>',
      tls_skip_verify_insecure = false,
      lsp = {
        bin_path = nil,
        host = nil,
        port = nil,
        version = '0.5.2',
      },
      tokenizer = nil,
      context_window = 8192,
      enable_suggestions_on_startup = true,
      enable_suggestions_on_files = '*',
    },
  },

and its giving me this error now image

mAmineChniti avatar Mar 20 '24 16:03 mAmineChniti

Using ollama, you shouldn't set the /api/generate suffix as it is explained in the README file

metal3d avatar Jun 05 '24 13:06 metal3d

Using ollama, you shouldn't set the /api/generate suffix as it is explained in the README file

can you link me to the correct way?

mAmineChniti avatar Jun 05 '24 14:06 mAmineChniti

Just remove the suffix 🙂 use only the url to the root of your server, http://xxx:yyy without any path.

metal3d avatar Jun 05 '24 19:06 metal3d

@mAmineChniti do you happen to use clangd lsp? You may need to set the following:

local cmp_nvim_lsp = require "cmp_nvim_lsp"

require("lspconfig").clangd.setup {
  on_attach = on_attach,
  capabilities = cmp_nvim_lsp.default_capabilities(),
  cmd = {
    "clangd",
    "--offset-encoding=utf-16",
  },
}

https://www.reddit.com/r/neovim/comments/12qbcua/multiple_different_client_offset_encodings/

McPatate avatar Jun 11 '24 08:06 McPatate