Skip to content

Chore: Add documentation for context #348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2024

Conversation

sangee2004
Copy link
Contributor

Add documentation for context

@sangee2004 sangee2004 requested a review from cloudnautique May 16, 2024 16:37

```yaml
# my-search-context-tool.gpt
name: search_context
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not put name: as it's not required. I more care about below not using the from sytnax. So the example below should just be context: ./my-search-context-tool.gpt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the suggested change.

Continuing with the above example, this is how you can use it in a script:

```yaml
context: search_context from my-search-context-tool.gpt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to context: ./my-search-context-tool.gpt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the suggested change.

@@ -0,0 +1,64 @@
# Context

GPTScript supports context provider tools which can be used to provide additional context for tool execution. Output from the context tool gets prepended to the instruction of the current tool that uses the context tool.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we document that exported tools from a context tools are added to the current tool's tools. (wow that was a bad way to say it). Also can we document that you can just do context: foo.txt if you just want to add a string. This is a simple way to share prompts across tools.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following documentation is now added:

GPTScript provides a mechanism to share prompt information across many tools using the tool parameter `context`. It is used to provide additional information to the calling tool on when to use a specific tool by prepending the `context` to the instruction of the calling tool.

- Context can point to a static text or a GPTScript.
- Context tools are just regular GPTScript tools, and any valid gptscript field can be used.
- Exported tools from a context tools are available as tools to the calling tool.
- When context points to a GPTScript tool, output from the context tool gets prepended to the instruction of the calling tool.

@@ -0,0 +1,64 @@
# Context

GPTScript supports context provider tools which can be used to provide additional context for tool execution. Output from the context tool gets prepended to the instruction of the current tool that uses the context tool.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use "context provider tools" in the definition as those are not yet defined.

I think we are trying to convey that context:

  • Provides a mechanism to use prompt information across many tools as an import mechanism.
  • Provide additional information to the calling tool on when to use a specific tool. (Helpful for using new CLIs for example)
  • These can be static txt or dynamic gptscripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following documentation has been added now:'

GPTScript provides a mechanism to share prompt information across many tools using the tool parameter `context`. It is used to provide additional information to the calling tool on when to use a specific tool by prepending the `context` to the instruction of the calling tool.

- Context can point to a static text or a GPTScript.
- Context tools are just regular GPTScript tools, and any valid gptscript field can be used.
- Exported tools from a context tools are available as tools to the calling tool.
- When context points to a GPTScript tool, output from the context tool gets prepended to the instruction of the calling tool.

@cloudnautique
Copy link
Contributor

I would also add a txt example to the docs.

Don't actually use this, but it could look like:
pirate.txt

talk like a pirate

Tool1:

Context: pirate.txt

Tell a joke

Tool2:

Context: pirate.txt

Say Hello

Showing you can reduce boiler plate and change behavior quickly

@sangee2004
Copy link
Contributor Author

@cloudnautique I have included an example for multiple tools using txt file as context.

@sangee2004 sangee2004 merged commit 025e638 into gptscript-ai:main May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants