feat(ollama): provide a helper to enable ollama when service is available
Ollama is disabled by default, as it normally does not require API keys
to be defined. Users are supposed to override is_env_set() method in
their configs to enable Ollama.
Provide check_endpoint_alive() helper in Ollama provider module that can
be used directly in place of is_env_set() and checks whether the server
replies to "get list of models" query:
...
ollama = {
is_env_set = require("avante.providers.ollama").check_endpoint_alive,
},
...
This commit is contained in:
@@ -1163,14 +1163,17 @@ This approach ensures that the apply model can quickly and accurately merge your
|
||||
|
||||
## Ollama
|
||||
|
||||
ollama is a first-class provider for avante.nvim. You can use it by setting `provider = "ollama"` in the configuration, and set the `model` field in `ollama` to the model you want to use. For example:
|
||||
Ollama is a first-class provider for avante.nvim. To start using it you need to set `provider = "ollama"`
|
||||
in the configuration, set the `model` field in `ollama` to the model you want to use. Ollama is disabled
|
||||
by default, you need to provide an implementation for its `is_env_set` method to properly enable it.
|
||||
For example:
|
||||
|
||||
```lua
|
||||
provider = "ollama",
|
||||
providers = {
|
||||
ollama = {
|
||||
endpoint = "http://localhost:11434",
|
||||
model = "qwq:32b",
|
||||
is_env_set = require("avante.providers.ollama").check_endpoint_alive,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user