-
Notifications
You must be signed in to change notification settings - Fork 15
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
docs: remove toc from first tool guide and add unique ids to markdown headers #580
Merged
njhale
merged 1 commit into
obot-platform:main
from
njhale:docs/remove-toc-from-first-tool-guide
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## Writing your first tool in Go | ||
## Writing your first tool in Go {#writing-your-first-tool-in-go-eb5bb8c4} | ||
|
||
[go-hash-tool](https://github.com/otto8-ai/go-hash-tool) contains a reference `Go` implementation of the `Hash` Tool. | ||
|
||
|
@@ -12,7 +12,7 @@ git clone [email protected]:otto8-ai/go-hash-tool | |
|
||
<br/> | ||
|
||
## Tool Repo Structure | ||
## Tool Repo Structure {#tool-repo-structure-eb5bb8c4} | ||
|
||
The directory tree below highlights the files required to implement `Hash` in Go and package it for `Otto8`. | ||
|
||
|
@@ -30,7 +30,7 @@ go-hash-tool | |
|
||
<br/> | ||
|
||
## Defining the `Hash` Tool | ||
## Defining the `Hash` Tool {#defining-the-hash-tool-eb5bb8c4} | ||
|
||
The `tool.gpt` file contains [GPTScript Tool Definitions](https://docs.gptscript.ai/tools/gpt-file-reference) which describe a set of Tools that can be used by Agents in `Otto8`. | ||
Every Tool repository must have a `tool.gpt` file in its root directory. | ||
|
@@ -89,7 +89,7 @@ Param: algo: The algorithm to generate a hash with. Default is "sha256". Support | |
|
||
<br/> | ||
|
||
## Tool Metadata | ||
## Tool Metadata {#tool-metadata-eb5bb8c4} | ||
|
||
The `tool.gpt` file also provides the following metadata for use in `Otto8`: | ||
|
||
|
@@ -150,7 +150,7 @@ https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/duotone/fingerprint-d | |
|
||
<br/> | ||
|
||
## Implementing Business Logic | ||
## Implementing Business Logic {#implementing-business-logic-eb5bb8c4} | ||
|
||
The `main.go` file is the entry point of the `gptscript-go-tool` binary that is executed by `Otto8` when the `Hash` Tool is called. | ||
|
||
|
@@ -202,7 +202,7 @@ The Body of the `Verify` Tool definition would then simply pass `verify` to `gpt | |
|
||
```yaml | ||
Name: Verify | ||
# ... | ||
# ... {#-eb5bb8c4} | ||
|
||
#!{GPTSCRIPT_TOOL_DIR}/bin/gptscript-go-tool verify | ||
``` | ||
|
@@ -371,7 +371,7 @@ func keys[V any](m map[string]V) []string { | |
|
||
<br/> | ||
|
||
## Testing `main.go` Locally | ||
## Testing `main.go` Locally {#testing-main-go-locally-eb5bb8c4} | ||
|
||
Before adding a Tool to `Otto8`, verify that the Go business logic works on your machine. | ||
|
||
|
@@ -394,7 +394,7 @@ To do this, run through the following steps in the root of your local fork: | |
|
||
<br/> | ||
|
||
## Adding The `Hash` Tool to `Otto8` | ||
## Adding The `Hash` Tool to `Otto8` {#adding-the-hash-tool-to-otto8-eb5bb8c4} | ||
|
||
Before a Tool can be used by an Agent, an admin must first add the Tool to `Otto8` by performing the steps below: | ||
|
||
|
@@ -432,7 +432,7 @@ Before a Tool can be used by an Agent, an admin must first add the Tool to `Otto | |
</div> | ||
</details> | ||
|
||
## Using The `Hash` Tool in an Agent | ||
## Using The `Hash` Tool in an Agent {#using-the-hash-tool-in-an-agent-eb5bb8c4} | ||
|
||
To use the `Hash` Tool in an Agent, open the Agent's Edit page, then: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## Writing your first tool in Node.js (with Typescript) | ||
## Writing your first tool in Node.js (with Typescript) {#writing-your-first-tool-in-node-js-with-typescript-aeed7f15} | ||
|
||
[node-hash-tool](https://github.com/otto8-ai/node-hash-tool) contains a reference Typescript `Node.js` implementation of the `Hash` Tool. | ||
|
||
|
@@ -11,7 +11,7 @@ git clone [email protected]:otto8-ai/node-hash-tool | |
``` | ||
<br/> | ||
|
||
## Tool Repo Structure | ||
## Tool Repo Structure {#tool-repo-structure-aeed7f15} | ||
|
||
The directory tree below highlights the files required to implement `Hash` in Typescript and package it for `Otto8`. | ||
|
||
|
@@ -31,7 +31,7 @@ node-hash-tool | |
|
||
<br/> | ||
|
||
## Defining the `Hash` Tool | ||
## Defining the `Hash` Tool {#defining-the-hash-tool-aeed7f15} | ||
|
||
The `tool.gpt` file contains [GPTScript Tool Definitions](https://docs.gptscript.ai/tools/gpt-file-reference) which describe a set of Tools that can be used by Agents in `Otto8`. | ||
Every Tool repository must have a `tool.gpt` file in its root directory. | ||
|
@@ -90,7 +90,7 @@ Param: algo: The algorithm to generate a hash with. Default is "sha256". Support | |
|
||
<br/> | ||
|
||
## Tool Metadata | ||
## Tool Metadata {#tool-metadata-aeed7f15} | ||
|
||
The `tool.gpt` file also provides the following metadata for use in `Otto8`: | ||
|
||
|
@@ -151,7 +151,7 @@ https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/duotone/fingerprint-d | |
|
||
<br/> | ||
|
||
## Implementing Business Logic | ||
## Implementing Business Logic {#implementing-business-logic-aeed7f15} | ||
|
||
As we saw earlier, the `npm` command invoked by the `Tool Body` passes `hash` as an argument to the `tool` script. | ||
|
||
|
@@ -226,7 +226,7 @@ And the Body of the `Verify` Tool would pass `verify` to the `tool` script inste | |
|
||
```yaml | ||
Name: Verify | ||
# ... | ||
# ... {#-aeed7f15} | ||
|
||
#!/usr/bin/env npm --silent --prefix ${GPTSCRIPT_TOOL_DIR} run tool -- verify | ||
``` | ||
|
@@ -351,7 +351,7 @@ export function hash(data: string = '', algo = 'sha256'): string { | |
|
||
<br/> | ||
|
||
## Testing `src/tools.ts` and `src/hash.ts` Locally | ||
## Testing `src/tools.ts` and `src/hash.ts` Locally {#testing-src-tools-ts-and-src-hash-ts-locally-aeed7f15} | ||
|
||
Before adding a Tool to `Otto8`, verify that the Typescript business logic works on your machine. | ||
|
||
|
@@ -374,7 +374,7 @@ To do this, run through the following steps in the root of your local fork: | |
|
||
<br/> | ||
|
||
## Adding The `Hash` Tool to `Otto8` | ||
## Adding The `Hash` Tool to `Otto8` {#adding-the-hash-tool-to-otto8-aeed7f15} | ||
|
||
Before a Tool can be used by an Agent, an admin must first add the Tool to `Otto8` by performing the steps below: | ||
|
||
|
@@ -412,7 +412,7 @@ Before a Tool can be used by an Agent, an admin must first add the Tool to `Otto | |
</div> | ||
</details> | ||
|
||
## Using The `Hash` Tool in an Agent | ||
## Using The `Hash` Tool in an Agent {#using-the-hash-tool-in-an-agent-aeed7f15} | ||
|
||
To use the `Hash` Tool in an Agent, open the Agent's Edit page, then: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## Writing your first tool in Python | ||
## Writing your first tool in Python {#writing-your-first-tool-in-python-28572835} | ||
|
||
[python-hash-tool](https://github.com/otto8-ai/python-hash-tool) contains a reference `Python` implementation of the `Hash` Tool. | ||
|
||
|
@@ -12,7 +12,7 @@ git clone [email protected]:otto8-ai/python-hash-tool | |
|
||
<br/> | ||
|
||
## Tool Repo Structure | ||
## Tool Repo Structure {#tool-repo-structure-28572835} | ||
|
||
The directory tree below highlights the files required to implement `Hash` in Python and package it for `Otto8`. | ||
|
||
|
@@ -24,7 +24,7 @@ python-hash-tool | |
``` | ||
<br/> | ||
|
||
## Defining the `Hash` Tool | ||
## Defining the `Hash` Tool {#defining-the-hash-tool-28572835} | ||
|
||
The `tool.gpt` file contains [GPTScript Tool Definitions](https://docs.gptscript.ai/tools/gpt-file-reference) which describe a set of Tools that can be used by Agents in `Otto8`. | ||
Every Tool repository must have a `tool.gpt` file in its root directory. | ||
|
@@ -84,7 +84,7 @@ Param: algo: The algorithm to generate a hash with. Default is "sha256". Support | |
|
||
<br/> | ||
|
||
## Tool Metadata | ||
## Tool Metadata {#tool-metadata-28572835} | ||
|
||
The `tool.gpt` file also provides the following metadata for use in `Otto8`: | ||
|
||
|
@@ -144,7 +144,7 @@ https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/duotone/fingerprint-d | |
|
||
<br/> | ||
|
||
## Implementing Business Logic | ||
## Implementing Business Logic {#implementing-business-logic-28572835} | ||
|
||
The `hash.py` file executed by the `Tool Body` is the concrete implementation of the Tool's business logic. | ||
|
||
|
@@ -261,7 +261,7 @@ if __name__ == '__main__': | |
|
||
<br/> | ||
|
||
## Testing `hash.py` Locally | ||
## Testing `hash.py` Locally {#testing-hash-py-locally-28572835} | ||
|
||
Before adding a Tool to `Otto8`, verify that the Python business logic works on your machine. | ||
|
||
|
@@ -298,7 +298,7 @@ To do this, run through the following steps in the root of your local fork: | |
|
||
<br/> | ||
|
||
## Adding The `Hash` Tool to `Otto8` | ||
## Adding The `Hash` Tool to `Otto8` {#adding-the-hash-tool-to-otto8-28572835} | ||
|
||
Before a Tool can be used by an Agent, an admin must first add the Tool to `Otto8` by performing the steps below: | ||
|
||
|
@@ -336,7 +336,7 @@ Before a Tool can be used by an Agent, an admin must first add the Tool to `Otto | |
</div> | ||
</details> | ||
|
||
## Using The `Hash` Tool in an Agent | ||
## Using The `Hash` Tool in an Agent {#using-the-hash-tool-in-an-agent-28572835} | ||
|
||
To use the `Hash` Tool in an Agent, open the Agent's Edit page, then: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary? Can we just add the IDs directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it easier for folks to fetch and use Markdown from any repo together without having to make changes to those repos to make the IDs unique.
Also, the syntax to add these IDs is
mdx
, so any IDs would render in GitHub's markdown preview: