Open gwpl opened 1 month ago
@gwpl
To clarify, you don't need to specify client= for ollama models if you use this code:
import ell
ell.init(verbose=True, store='./logdir')
ell.models.ollama.register(base_url="http://localhost:11434/v1")
# in terminal run ollama list to see available models
@ell.simple(model="llama3.1:latest", temperature=0.1)
def write_a_story():
return "write me a story"
Everything else should use the default OpenAI client instance.
If you're looking to parameterize the model
kwarg that is used for a particular LMP (like write_a_story
), you could define a variable for the model
kwarg. I believe you can also override this parameter when you invoke it with write_a_story(model="llama3.2")
,
Sure!
(btw. do ell.config.register_model("foo",...)
overwirte earlier resolution for "foo" https://docs.ell.so/core_concepts/models_and_api_clients.html )
Here I was thinking about more sophisticated setups,
that ofc I can make by making ollama api compatible proxy that would have resolution logic,
but I thought that maybe I could register own dispatcher (e.g. ell.config.register_providers_dispatcher( my_dispatcher(fallback=ell.config.get_current_providers_dispatcher()))
)
do ell.config.register_model("foo",...) overwirte earlier resolution for "foo" https://docs.ell.so/core_concepts/models_and_api_clients.html
They should yes.
If you look at the provider and model files you can do a lot more custom stuff, maybe along the lines of what you’re describing.
I’m having a hard time seeing the end goal you want to achieve. If you could paint more of a picture for me there I may be able to help with a particular implementation that achieves it.
Setting custom dispacher, like I mentioned:
ell.config.register_providers_dispatcher( my_dispatcher(fallback=ell.config.get_current_providers_dispatcher())) )
could be good when playing on small scale with setup utilizing either load balancing, failover or just resolution of unregistered models.
However for more production setup, very likely it should use suggested by you, e.g. Ollama or just ell.config.via_proxy(...)
to make everything regardless of model go via proxy and do all the magic inside the proxy.
Situation:
client=
in decoratorclient=my_client_dispacher
, somy_client_dispacher
for some values ofmodel
would return defaultclient
, and for other , one of few custom clients?dotenv
(.env
) or other way?client
for most models, and for some (matching patterns), to route them tocustom_defined_clients
... (e.g. local or shared ollama server etc)