Fabric icon indicating copy to clipboard operation
Fabric copied to clipboard

[Question]: What exactly is a "context" within this software?

Open JordanRL opened this issue 1 year ago • 4 comments

What is your question?

Normally the "context" in an AI refers to all the messages, including the system prompt, that the model uses to decide what to output. But the use in this project seems to refer to something else. (Similar to how "prompt" has been renamed "pattern" for some inexplicable reason.)

So what is the meaning of this word, how is it used, and what is it for?

JordanRL avatar Oct 22 '24 09:10 JordanRL

I haven't been able to find documentation on fabric context. Can anyone post a link?

andyl avatar Nov 11 '24 16:11 andyl

I'm trying to run with context with no success this can loop through the contexts dir but I don't know how to fit in the command.

fabric Context loop

Define the path to the contexts directory

CONTEXT_DIR="$HOME/.config/fabric/contexts"

Check if the contexts directory exists

if [ -d "$CONTEXT_DIR" ]; then for context_file in "$CONTEXT_DIR"/*; do # Ensure each item is a file (avoids errors with subdirectories) if [ -f "$context_file" ]; then # Extract the basename without the directory path context_name=$(basename "$context_file") # Create an alias that uses the context name alias "$context_name"="fabric --context $context_name" fi done else echo "Directory $CONTEXT_DIR does not exist." fi

pedroibl avatar Nov 15 '24 07:11 pedroibl

I was looking at #319 and saw the concept of "context" being discussed. It seems that we can use "contexts" to pass some additional info to the model.

Example:

Suppose that I want to make some calculations about purchasing iPhones.

I create a .config/fabric/contexts/iphone.md file with this content:

# Facts
An iPhone 15 costs 1000 euros.
An iPhone 15 Pro costs 1300 euros.

Now, I can use that data (via -C iphone.md) when I call the model:

$ fabric -C iphone.md  "How much should I pay for 2 iPhone 15 Pro's? Answer in one sentence only"
You should pay 2600 euros for 2 iPhone 15 Pro's.

Without the context we will get a generic answer.

$ fabric "How much should I pay for 2 iPhone 15 Pro's? Answer in one sentence only"
The cost for two iPhone 15 Pro models would depend on the storage capacity and any additional options you choose, but as of my last update, it would be around $3,749 to $6,498 USD.

smbl64 avatar Nov 19 '24 17:11 smbl64

On Nov 19, 2024, at 8:24 PM, Mohammad Banisaeid @.***> wrote: I was looking at #319 and saw the concept of "context" is discussed. It seems that we can use "contexts" to pass some additional info to the model. Example: Suppose that I want to make some calculations about purchasing iPhones. I create a .config/fabric/contexts/iphone.md file with this content:

Facts

An iPhone 15 costs 1000 euros. An iPhone 15 Pro costs 1300 euros. Now, I can use that data (via -C iphone.md) when I call the model: $ fabric -C iphone.md "How much should I pay for 2 iPhone 15 Pro's? Answer in one sentence only" You should pay 2600 euros for 2 iPhone 15 Pro's.

Without the context we will get a generic answer. $ fabric "How much should I pay for 2 iPhone 15 Pro's? Answer in one sentence only" The cost for two iPhone 15 Pro models would depend on the storage capacity and any additional options you choose, but as of my last update, it would be around $3,749 to $6,498 USD.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

yxy23 avatar Nov 20 '24 12:11 yxy23

See this:

https://github.com/danielmiessler/Fabric/discussions/1576#discussioncomment-13672504

ksylvan avatar Aug 31 '25 23:08 ksylvan