chore: update docs again (#77)

This commit is contained in:
lily-de
2024-09-25 14:20:49 -04:00
committed by GitHub
parent 31dfd48ac5
commit 4704b82bf1
77 changed files with 439 additions and 312 deletions
+60
View File
@@ -0,0 +1,60 @@
# Available Toolkits in Goose
Goose provides a variety of toolkits designed to help developers with different tasks. Here's an overview of each available toolkit and its functionalities:
## 1. Developer Toolkit
The **Developer** toolkit offers general-purpose development capabilities, including:
- **System Configuration Details:** Retrieves system configuration details.
- **Task Management:** Update the plan by overwriting all current tasks.
- **File Operations:**
- `patch_file`: Patch a file by replacing specific content.
- `read_file`: Read the content of a specified file.
- `write_file`: Write content to a specified file.
- **Shell Command Execution:** Execute shell commands with safety checks.
## 2. GitHub Toolkit
The **GitHub** toolkit provides detailed configuration and procedural guidelines for GitHub operations.
## 3. Lint Toolkit
The **Lint** toolkit ensures that all toolkits have proper documentation. It performs the following checks:
- Toolkit must have a docstring.
- The first line of the docstring should contain more than 5 words and fewer than 12 words.
- The first letter of the docstring should be capitalized.
## 4. RepoContext Toolkit
The **RepoContext** toolkit provides context about the current repository. It includes:
- **Repository Size:** Get the size of the repository.
- **Monorepo Check:** Determine if the repository is a monorepo.
- **Project Summarization:** Summarize the current project based on the repository or the current project directory.
## 5. Screen Toolkit
The **Screen** toolkit assists users in taking screenshots for debugging or designing purposes. It provides:
- **Take Screenshot:** Capture a screenshot and provide the path to the screenshot file.
- **System Instructions:** Instructions on how to work with screenshots.
## 6. SummarizeRepo Toolkit
The **SummarizeRepo** toolkit helps in summarizing a repository. It includes:
- **Summarize Repository:** Clone the repository (if not already cloned) and summarize the files based on specified extensions.
## 7. SummarizeProject Toolkit
The **SummarizeProject** toolkit generates or retrieves a summary of a project directory based on specified file extensions. It includes:
- **Get Project Summary:** Generate or retrieve a summary of the project in the specified directory.
## 8. SummarizeFile Toolkit
The **SummarizeFile** toolkit helps in summarizing a specific file. It includes:
- **Summarize File:** Summarize the contents of a specified file with optional instructions.
+63
View File
@@ -0,0 +1,63 @@
# Goose CLI Commands
Goose provides a command-line interface (CLI) with various commands to manage sessions, toolkits, and more. Below is a list of the available commands and their descriptions:
## Goose CLI
### `version`
**Usage:**
```sh
goose version
```
Lists the version of Goose and any associated plugins.
### `session`
#### `start`
**Usage:**
```sh
goose session start [--profile PROFILE] [--plan PLAN]
```
Starts a new Goose session.
#### `resume`
**Usage:**
```sh
goose session resume [NAME] [--profile PROFILE]
```
Resumes an existing Goose session.
#### `list`
**Usage:**
```sh
goose session list
```
Lists all Goose sessions.
#### `clear`
**Usage:**
```sh
goose session clear [--keep KEEP]
```
Deletes old Goose sessions, keeping the most recent ones as specified by the `--keep` option.
### `toolkit`
#### `list`
**Usage:**
```sh
goose toolkit list
```
Lists all available toolkits with their descriptions.
+94
View File
@@ -0,0 +1,94 @@
# Creating a New Toolkit
To add a toolkit, in your code (which doesn't necessarily need to be in the Goose package thanks to [plugin metadata][plugin]!), create a class that derives from the `Toolkit` class.
## Example toolkit class
Below is an example of a simple toolkit called `Demo` that derives from the `Toolkit` class. This toolkit provides an `authenticate` tool that outputs an authentication code for a user. It also provides system instructions for the model.
```python
import os
import platform
from goose.toolkit.base import Toolkit, tool
class Demo(Toolkit):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Provide any additional tools as needed!
# The docstring of the tool provides instructions to the LLM, so they are important to tune
# you do not have to provide any tools, but any function decorated with @tool will be available
@tool
def authenticate(self, user: str):
"""Output an authentication code for this user
Args:
user (str): The username to authenticate for
"""
# notifier supports any rich renderable https://rich.readthedocs.io/en/stable/introduction.html#quick-start
self.notifier.log(f"[bold red]auth: {str(hash(user))}[/]")
# Provide any system instructions for the model
# This can be generated dynamically, and is run at startup time
def system(self) -> str:
print("new")
return f"""**You must preceed your first message by using the authenticate tool for the current user**
```
platform: {platform.system()}
cwd: {os.getcwd()}
user: {os.environ.get('USER')}
```
"""
```
## Exposing the New Toolkit to Goose
To make the toolkit available, add it to the `pyproject.toml` file and then update your `profiles.yaml` file.
### Update the `pyproject.toml` file
If you're adding the new toolkit to Goose or the Goose Plugins repo, simply find the `[project.entry-points."goose.toolkit"]` section in `pyproject.toml` and add a line like this:
```toml
[project.entry-points."goose.toolkit"]
developer = "goose.toolkit.developer:Developer"
github = "goose.toolkit.github:Github"
# Add a line like this - the key becomes the name used in profiles
demo = "goose.toolkit.demo:Demo"
```
If you are adding the toolkit to a different package, see the docs for `goose-plugins` for more information on how to create a plugins repository that can be used by Goose.
### Update the `profiles.yaml` file
And then to set up a profile that uses it, add something to ~/.config/goose/profiles.yaml
```yaml
default:
provider: openai
processor: gpt-4o
accelerator: gpt-4o-mini
moderator: passive
toolkits:
- name: developer
requires: {}
demo-profile:
provider: openai
processor: gpt-4o
accelerator: gpt-4o-mini
moderator: passive
toolkits:
- developer
- demo
```
And now you can run goose with this new profile to use the new toolkit!
```sh
goose session start --profile demo-profile
```
> [!NOTE]
> If you're using a plugin from `goose-plugins`, make sure `goose-plugins` is installed in your environment. You can install it via pip:
>
> `pipx install goose-ai --preinstall goose-plugins`
[plugin]: https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-package-metadata
[goose-plugins]: https://github.com/square/goose-plugins
+15
View File
@@ -0,0 +1,15 @@
# Plugins in Goose
Goose's functionality is extended via plugins. These plugins fall into three main categories:
1. **Toolkits**:
* Provides Goose with tools (functions) it can call and optionally will load additional context into the system prompt (such as 'The Github CLI is called via `gh` and you should use it to run git commands').
* Toolkits can do basically anything, from calling external APIs, to taking a screenshot of your screen, to summarizing your current project.
2. **CLI commands**:
* Provides additional commands to the Goose CLI.
* These commands can be used to interact with the Goose system, such as listing available toolkits or summarizing a session.
3. **Providers**:
* Provides Goose with access to external LLMs.
* For example, the OpenAI provider allows Goose to interact with the OpenAI API.
* Most providers for Goose are defined in the Exchange library.
+14
View File
@@ -0,0 +1,14 @@
# Providers
Providers in Goose mean "LLM providers" that Goose can interact with. Providers are defined in the [Exchange library][exchange-providers] for the most part, but you can define your own.
**Currently available providers:**
* Anthropic
* Azure
* Bedrock
* Databricks
* Ollama
* OpenAI
[exchange-providers]: https://github.com/square/exchange/tree/main/src/exchange/providers
+41
View File
@@ -0,0 +1,41 @@
# Using Toolkits
Use `goose toolkit list` to list the available toolkits.
## Toolkits defined in Goose
Using Goose with toolkits is simple. You can add toolkits to your profile in the `profiles.yaml` file. Here's an example of how to add `my-toolkit` toolkit to your profile:
```yaml
my-profile:
provider: openai
processor: gpt-4o
accelerator: gpt-4o-mini
moderator: passive
toolkits:
- my-toolkit
```
Then run Goose with the specified profile:
```sh
goose session start --profile my-profile
```
## Toolkits defined in Goose Plugins
1. First make sure that `goose-plugins` is intalled with Goose:
```sh
pipx install goose-ai --preinstall goose-plugins
```
2. Update the `profiles.yaml` file to include the desired toolkit:
```yaml
my-profile:
provider: openai
processor: gpt-4o
accelerator: gpt-4o-mini
moderator: passive
toolkits:
- my-goose-plugins-toolkit
```