Open 7flash opened 7 months ago
So if I understand well you would like your first example to be the equivalent of:
from outlines import generate
from pydantic import BaseModel
def generation(model):
prompt = "Generate a character"
class Character(BaseModel):
class: str
level: float
generator = generate.json(model, Character)
return generator(prompt)
I am not a huge fan of using configuration files instead of code. Not only do you need to parse them, but they also are untestable, and do not generalize well to complex use cases. I am however open to a code construct that would allow you to abstract and simplify this kind of workflow; outlines functions were designed with this in mind and we can think of ways to extend them.
Presentation of the new feature
Currently I have implemented following CLI tool which is using outlines:
It's reading prompt from given file path and writes completion into another output file.
I've found it extremely convenient editing my prompt with Helix editor and then viewing response in Helix again.
Therefore I added following workflow in Warp terminal.
It opens a new file where I write prompt, close it with :wq and then CLI tool creates completion on it, and opens output file in helix again.
This way I found to be more clean and productive than any other existing UI.
But what I'm missing, of course, other capabilities of outlines, such as json and regex. These can be embedded into prompt file with yaml frontmatter, which is a block of key-value pairs prepending actual file content.
Example 1. regexp
Example 2. json
Example 3. template
Example 4. choice, etc..
Note: first two examples are supposed to be working with local models, third example compatible with my original script.