Skip to content

Commit e5b2cea

Browse files
committed
docs: update context example
Signed-off-by: Craig Jellick <[email protected]>
1 parent 31c8d9a commit e5b2cea

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

docs/docs/03-tools/05-context.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,18 @@ gptscript --disable-cache my_context_with_arg.gpt '{"search": "brave"}'
8989

9090
## Comprehensive Example of a Context Provider Tool
9191

92-
Here is a more comprehensive example of a context provider tool that aggregates multiple smaller contexts and tools:
92+
Here is a more streamlined example of a context provider tool that aggregates multiple smaller contexts and tools:
9393

9494
```yaml
9595
# tool.gpt
9696
name: Kevin Global Context
9797
description: This is the global context that all Kevin tools should reference. This context just aggregates a series of smaller contexts.
9898

9999
share context: github.com/gptscript-ai/context/cli
100-
share context: github.com/gptscript-ai/context/workspace
101-
#share context: github.com/gptscript-ai/context/history
102-
share context: ./chat-summary
103-
104100
share context: ./cmds.gpt
105-
share context: ./finish.gpt
106-
share context: ./agents.gpt
107101

108102
share tools: github.com/gptscript-ai/answers-from-the-internet
109103

110-
share input filters: ./atsyntax.gpt
111-
112104
#!sys.echo
113105
You are a slightly grumpy, but generally lovable assistant designed to help the user with Kubernetes.
114106
You were created in 2024 by @ibuildthecloud at Acorn Labs in a terrible experiment gone wrong.
@@ -118,5 +110,19 @@ Guidelines:
118110
2. If you see something that looks wrong, ask the user if they would like you to troubleshoot the issue.
119111
3. If the user does not specify or gives an empty prompt, ask them what they wish to do.
120112
```
113+
If the above tool were in a directory called `context`, it could be referenced by a tool like this:
114+
```yaml
115+
name: Kevin
116+
context: ./context
117+
118+
...
119+
```
120+
When a directory is specified as a context or tool, gptscript will look for a `tool.gpt` in that directory and use it.
121+
122+
The above example context tool has several interesting features:
123+
124+
The `share context` directive is used to include additional context from other tools or files into the tool that referenced this context. This allows you to aggregate multiple smaller contexts into a single, comprehensive context. Each `share context` line points to another context provider, which can be a local file or a remote tool. The content from these shared contexts is prepended to the instruction of the calling tool, providing a richer and more detailed prompt for the LLM to work with.
125+
126+
The `share tools` directive is similar to the `share context` directive. Tools specified here will be made available as tools to the tool that referenced this context.
121127

122-
This example demonstrates how to aggregate multiple contexts and tools into a single global context, providing a robust and flexible setup for your GPTScript tools.
128+
The `#!sys.echo` directive is a simple way to directly output plain text for the context. In this example, it outputs a description of the assistant's personality and guidelines for its behavior, which will be included in the context provided to the LLM.

0 commit comments

Comments
 (0)