Skip to content

Commit 7e0cb87

Browse files
committed
refactor!: improve provider resolution
Improve the way how different providers are resolved and configured. Make sure the output and input processing is more consistent between providers by providing common interface that providers must implement. Improvements: - Change embeddings field to embed for clarity - Add proper types for provider inputs and outputs - Make provider resolution more generic - Make common provider interface clearer - Add types for model and agent configs - Make prepare_input and prepare_output more consistent Signed-off-by: Tomas Slusny <[email protected]>
1 parent d27ebd2 commit 7e0cb87

File tree

3 files changed

+199
-136
lines changed

3 files changed

+199
-136
lines changed

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,11 @@ Here's how to implement an [ollama](https://ollama.com/) provider:
397397
{
398398
providers = {
399399
ollama = {
400-
embeddings = 'copilot_embeddings', -- Use Copilot as embedding provider
400+
embed = 'copilot_embeddings', -- Use Copilot as embedding provider
401+
402+
-- Copy copilot input and output processing
403+
prepare_input = require('CopilotChat.config.providers').copilot.prepare_input,
404+
prepare_output = require('CopilotChat.config.providers').copilot.prepare_output,
401405

402406
get_headers = function()
403407
return {
@@ -422,14 +426,6 @@ Here's how to implement an [ollama](https://ollama.com/) provider:
422426
return models
423427
end,
424428

425-
prepare_input = function(inputs, opts)
426-
return {
427-
model = opts.model,
428-
messages = inputs,
429-
stream = true,
430-
}
431-
end,
432-
433429
get_url = function()
434430
return 'http://localhost:11434/api/chat'
435431
end,

0 commit comments

Comments
 (0)