Closed antoninoLorenzo closed 1 week ago
Isn't ollama OpenAI compatible? Just out of curiosity, is litellm proxy really necessary here?
ollama/docs/openai.md at main · ollama/ollama · GitHub
Could you provide a link for a WIP Pull Request or point me to some branch you're working on? Maybe I can help!
Bumping down the version of uvicorn is fine, which should take care of the dependency conflict. I think having liteLLM could vert useful long term to add support for cloud providers like groq, together, etc
@cyborgmarina I was thinking exactly about not using litellm
.
I am working on the ollama-support
branch on my own fork given that I am not one of the repository main contributors, so I was implementing the prompts at devon_agent/agents/default/ollama_prompts.py
; you could either go in my fork and see if you can solve it or fork this repository and do it by yourself.
However personally I would wait for approval if you are considering removing litellm
.
@Mihir1003 also got a point however, using litellm
could be future-proof.
I usually prefer having less dependencies when I can, but at this point it is a decision of the owners.
One thing we can do to reduce bloated dependencies in the future is use python package extras. We could support devon_agent[litellm], however for now we want to add support for groq and other providers in the short run.
Once dependencies start getting bloated, we will divide them into extras. Also yes let me install ollama in the main repo so you can fork from there. Thanks!
https://github.com/BerriAI/liteLLM-proxy LiteLLM proxy seems to be deprecated
Ok so litellm proxy
is deprecated, @antoninoLorenzo you should just be able to do the completion as normal with the api_base
set to the ollama base url one as it is right now. For reference, here is the litellm page on ollama: https://docs.litellm.ai/docs/providers/ollama
Feel free follow up here if thats not working.
Longer term though, having litellm as a wrapper over different apis will make supporting new apis easier. More than willing to rip it out later as it shouldn't be too hard.
So i got ollama to work with litellm without the proxy. All I had to do was set completion (in LiteLLM) to this.
model_completion = completion(
messages=[{"role": "system", "content": system_message}] + messages,
max_tokens=self.model_metadata["max_tokens"],
model="ollama/phi3",
temperature=self.args.temperature,
stop=["</COMMAND>"],
api_base="http://localhost:11434"
)
@antoninoLorenzo hopefully that helps
how would we proceed with the cli? I was thinking it would be nice to be able to run devon configure <modelname> system_prompt.txt (optional) last_prompt(optional)
and infers correct class from it, like ollama/phi3
so we could basically use any ollama or litellm supported provider such as openrouter.
@Mihir1003 @killind-dev Thanks for the support, I made the required changes to OllamaModel
class and tested the system prompt within ollama_prompts.py
; it seems to work correctly, however to ensure correct behaviour I will implement a test, for now I am going to put it in devon_agent/agents/tests
, is it ok?
Sounds good to me! @antoninoLorenzo
@cyborgmarina yeah that seems correct
Ollama support merged. closing
Context I am working to add Ollama support for Devon, so I started working on the prompts in my fork inside the
ollama-support
branch; at the moment of writing there is theOllamaModel
class implemented as follows insidedevon_agent/agents/model.py
:Issue To run litellm the following command should be runned:
It relies on
litellm[proxy]
library, to install it the following command should be runned:The problem is that it causes a dependency error with poetry, as follows:
Possible Solution I think that the problem could be solved by removing
litellm
dependency inmodels.py
and directly using ollama for python. If there are other solutions I would appreciate some feedback, however until a solution is found I am unable to work one ollama support.