Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add adaptors to config and completion request #68

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,27 @@ All of the above still applies, but note:
> [!NOTE]
> Spaces are important here

#### Ollama
noahbald marked this conversation as resolved.
Show resolved Hide resolved

```lua
{
tokens_to_clear = { "<EOT>" },
fim = {
enabled = true,
prefix = "<PRE> ",
middle = " <MID>",
suffix = " <SUF>",
},
model = "http://localhost:11435/api/generate",
context_window = 4096,
tokenizer = {
repository = "codellama/CodeLlama-7b-hf",
},
adaptor = "ollama",
request_body = { model = "codellama:7b-code" },
}
```

### [**llm-ls**](https://github.com/huggingface/llm-ls)

By default, **llm-ls** is installed by **llm.nvim** the first time it is loaded. The binary is downloaded from the [release page](https://github.com/huggingface/llm-ls/releases) and stored in:
Expand Down Expand Up @@ -263,6 +284,8 @@ llm.setup({
context_window = 8192, -- max number of tokens for the context window
enable_suggestions_on_startup = true,
enable_suggestions_on_files = "*", -- pattern matching syntax to enable suggestions on specific files, either a string or a list of strings
adaptor = "huggingface", -- The name of the provider llm-ls will adapt requests with
request_body = {}, -- Additional data you can add to an adaptor's request
})

```
Expand Down
2 changes: 2 additions & 0 deletions lua/llm/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ local default_config = {
enable_suggestions_on_startup = true,
---@type string|table
enable_suggestions_on_files = "*",
adaptor = "huggingface",
request_body = {},
}

local M = {
Expand Down
2 changes: 2 additions & 0 deletions lua/llm/language_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ function M.get_completions(callback)
params.tokenizer_config = config.get().tokenizer
params.context_window = config.get().context_window
params.tls_skip_verify_insecure = config.get().tls_skip_verify_insecure
params.adaptor = config.get().adaptor
params.request_body = config.get().request_body
params.ide = "neovim"

local client = lsp.get_client_by_id(M.client_id)
Expand Down