codecompanion.nvim icon indicating copy to clipboard operation
codecompanion.nvim copied to clipboard

Set the default Ollama Schema from the Modelfile

Open JPyke3 opened this issue 1 year ago • 1 comments

This PR is to address https://github.com/olimorris/codecompanion.nvim/pull/61#issuecomment-2241827860

I ran into a bit of a snag as I couldn't actually fetch the current model the user had specified from the Schema in the Adapter itself. As such, I added an init function that you can declare, to effectively run some extra code with the user's options pre-populated in case you want to modify them after Initializing the adapter

But as this is quite a change on the general Adapter side, I wanted to get some confirmation from @olimorris that this is the right approach to take before proceeding too far (Still not quite confident on Lua best practice haha)

As of current, this PR does fetch the new values from the Modelfile (Even if they aren't currently existing in the schema) as well as using any new defaults the modelfile provides: image

However, currently it is bugged for a few reasons:

  • [ ] The Completions don't currently work at all
  • [ ] Some parameters that can have multiple values, such as stop will just take the last value.

If we decide to go ahead I will fix these up and finalise the PR

JPyke3 avatar Jul 22 '24 05:07 JPyke3

@JPyke3 - I've added some changes in the last few days which use the Ollama APIs to get the available models. Would love your feedback on that.

olimorris avatar Aug 20 '24 18:08 olimorris

Closing this for now but happy to open again at a later point in time.

olimorris avatar Aug 30 '24 21:08 olimorris