simonw / llm-replicate

LLM plugin for models hosted on Replicate
Apache License 2.0
59 stars 6 forks source link

Ability to register extra models #2

Closed simonw closed 1 year ago

simonw commented 1 year ago

The plugin currently only works with models retrieved from this collection: https://replicate.com/collections/language-models

I want to be able to manually register other models too, like this one: https://replicate.com/joehoover/falcon-40b-instruct

simonw commented 1 year ago

The TODO here:

https://github.com/simonw/llm-replicate/blob/b8bdaca87fb0524220475c2ff528f5eda56a4fa2/llm_replicate.py#L40-L50

simonw commented 1 year ago

I think this is an extra command:

llm replicate add joehoover/falcon-40b-instruct

This can look up the version ID (or you can pass --version xxx if you want to) and the persist it to a file.

The model ID will be replicate-joehoover-falcon-40b-instruct - but you can use one or more --alias commands to assign aliases to it.

It will go in a YAML file which you can then edit if you want to.

simonw commented 1 year ago

Got this working:

llm -m 'replicate-joehoover-falcon-40b-instruct' '4 names for a pet tiger'
  1. Tiger
  2. Shere Khan
  3. Rajah
  4. Leo
simonw commented 1 year ago

I'm going to add a llm replicate edit-models command to directly edit models.json - rather than doing remove commands and suchlike.

simonw commented 1 year ago

Got aliases working too:

llm models list
...
ReplicateModel: replicate-replit-code-v1-3b
ReplicateModel: replicate-replit-replit-code-v1-3b
ReplicateModel: replicate-joehoover-falcon-40b-instruct (aliases: falcon)
llm -m falcon '3 reasons to get a pet falcon'
  1. Falconry is a centuries-old sport that is fascinating to watch and participate in.
  2. Falcons are majestic and powerful birds that can fly at incredible speeds and heights.
  3. Owning a falcon requires a lot of responsibility and knowledge, but can also be a rewarding experience.