feat: add ollama as supported provider (#1543)
* feat: add ollama as supported provider
*This implementation is only working with `stream = true`*
- Uses the actual ollama api and allows for passing additional options
- Properly passes the system prompt to api
Use ollama as provider in opts like this:
opts = {
debug = true,
provider = "ollama",
ollama = {
api_key_name = "",
endpoint = "http://127.0.0.1:11434",
model = "qwen2.5-coder:latest",
options = {
num_ctx = 32768,
temperature = 0,
},
stream = true,
},
* fix: ollama types
---------
Co-authored-by: jtabke <25010496+jtabke@users.noreply.github.com>
This commit is contained in:
@@ -20,7 +20,7 @@ local M = {}
|
||||
---@field custom_tools AvanteLLMToolPublic[]
|
||||
M._defaults = {
|
||||
debug = false,
|
||||
---@alias ProviderName "claude" | "openai" | "azure" | "gemini" | "vertex" | "cohere" | "copilot" | "bedrock" | string
|
||||
---@alias ProviderName "claude" | "openai" | "azure" | "gemini" | "vertex" | "cohere" | "copilot" | "bedrock" | "ollama" | string
|
||||
provider = "claude",
|
||||
-- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive,
|
||||
-- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048
|
||||
@@ -255,6 +255,15 @@ M._defaults = {
|
||||
temperature = 0,
|
||||
max_tokens = 4096,
|
||||
},
|
||||
---@type AvanteSupportedProvider
|
||||
ollama = {
|
||||
endpoint = "http://127.0.0.1:11434",
|
||||
timeout = 30000, -- Timeout in milliseconds
|
||||
options = {
|
||||
temperature = 0,
|
||||
num_ctx = 4096,
|
||||
},
|
||||
},
|
||||
---To add support for custom provider, follow the format below
|
||||
---See https://github.com/yetone/avante.nvim/wiki#custom-providers for more details
|
||||
---@type {[string]: AvanteProvider}
|
||||
|
||||
Reference in New Issue
Block a user