Fabric icon indicating copy to clipboard operation
Fabric copied to clipboard

[Question]: How do I use the cli with a pattern and a custom user prompt on a given input?

Open surajp opened this issue 1 year ago • 6 comments

What is your question?

How do I use the cli with an inline user prompt, on a given input and pattern? example in ollama: pbpaste | ollama run llama3 "what is this data indicating?" . Something like pbpaste | fabric -sp ai "what is this data indicating?"

surajp avatar May 30 '24 20:05 surajp

Very interesting question that I was about to ask! I tried a bit with echo and -t but unsuccessfully.

julliannailluj avatar May 31 '24 10:05 julliannailluj

Once you copy your custom pattern to the patterns directory, you should just be able to call it. Your example looks iike you are pasting the contents of your clipboard using pbpaste and also putting in another prompt in the quotes, and starting Ollama at the same time. If you already have Ollama running locally you don't need to run that command.

I use pbpaste | fabric -sp my-custom-command

barnesjr avatar Jun 01 '24 14:06 barnesjr

I think his question and mine is about giving a user prompt to a model through a pattern, after feeding it with a text.

Copied text -> question about the text -> pattern -> model

But maybe that's just not something Fabric is designed for.

julliannailluj avatar Jun 01 '24 14:06 julliannailluj

That's right. Of the 3 parts in a prompt: context, system prompt and user prompt, fabric seems to cover context and system prompt, but not user prompt. Still really love using it

surajp avatar Jun 01 '24 16:06 surajp

An example of what I'd like to do:

echo "Write a plausible conversation between Socrates and Omar Khayam" | fabric --agents | echo "translate the input to French" -sp ai

Instead, I made a custom pattern for translation and tried this:

echo "Write a plausible conversation between Socrates and Omar Khayam" | fabric --agents | fabric -p translate_fr

It worked. But for anything like single use, it would be nice to have user input.

julliannailluj avatar Jun 02 '24 00:06 julliannailluj

As a workaround you can use a session to ask further questions like: pbpaste | ai --session tmp; echo "what is this data indicating" | ai --session tmp; fabric --clearsession tmp

TobiasSchaffner avatar Jun 10 '24 09:06 TobiasSchaffner