Skip to content

Commit bcfb227

Browse files
committed
fix(provider): model/models argument
1 parent a884f12 commit bcfb227

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lua/parrot/provider/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ M.init_provider = function(config)
99
assert(config.name, "config.name is required")
1010
assert(config.endpoint, "config.endpoint is required")
1111
assert(config.api_key, "config.api_key is required")
12-
assert(config.models, "config.model or config.models required")
12+
assert(config.model or config.models, "config.model or config.models required")
1313
return MultiProvider:new(config)
1414
end
1515

lua/parrot/provider/multi_provider.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ local Job = require("plenary.job")
99
---@field endpoint string
1010
---@field api_key string|table|function
1111
---@field model_endpoint string|table|function
12-
---@field model string|table
12+
---@field models table
1313
---@field name string
1414
---@field headers function|table
1515
---@field preprocess_payload_func function
@@ -220,7 +220,11 @@ function MultiProvider:new(config)
220220
self.endpoint = config.endpoint
221221
self.model_endpoint = config.model_endpoint or ""
222222
self.api_key = config.api_key
223-
self.models = config.model or config.models
223+
if config.model then
224+
self.models = type(config.model) == "string" and { config.model } or config.model
225+
else
226+
self.models = config.models
227+
end
224228

225229
-- Function overrides (use defaults if not provided)
226230
self.headers = config.headers or defaults.headers

0 commit comments

Comments
 (0)