Set the default Ollama Schema from the Modelfile
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:
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
stopwill just take the last value.
If we decide to go ahead I will fix these up and finalise the PR
@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.
Closing this for now but happy to open again at a later point in time.