Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Doc: Add parsers to reference (#911)

Kilian Lieretce9a4b7424c4
diff --git a/docs/config/config.md b/docs/config/config.md
index 38e6e399..2abec222 100644
--- a/docs/config/config.md
+++ b/docs/config/config.md
@@ -7,9 +7,11 @@ This page contains details describing how to write your own configurations to co
A configuration is represented in one or more `.yaml` files, specified by the `--config` flag in the [command line interface](../usage/cl_tutorial.md), allowing you to...
-* Define the **commands** that agents may use to traverse + modify a codebase (see [here](tools.md) for more details)
-* Write **prompts** that are deterministically/conditionally shown to the agent over the course of a single trajectory.
-* Control the **input/output interface** that sits between the agent and `SWEEnv`.
+* Define the [**tools**](tools.md) that agents may use to traverse + modify a codebase.
+* Write [**prompts**](templates.md) that are deterministically/conditionally shown to the agent over the course of a single trajectory.
+* Use [**demonstrations**](demonstrations.md) to guide the agent's behavior.
+* Change the [**model behavior**](models.md) of the agent.
+* Control the **input/output interface** that sits between the agent and the environment
!!! tip "Default config files"
Our default config files are in the [`config/`](https://github.com/SWE-agent/SWE-agent/tree/main/config) directory.
diff --git a/docs/config/models.md b/docs/config/models.md
new file mode 100644
index 00000000..7d2377d0
--- /dev/null
+++ b/docs/config/models.md
@@ -0,0 +1,5 @@
+# Models
+
+* See [the model section](../installation/keys.md) in the installation guide for more details on how to configure models.
+* See [the model config reference](../reference/model_config.md) for the full list of model options
+* To control how the agent extracts the actions from the model response, see the [action parsers](../reference/parsers.md) reference
diff --git a/docs/reference/parsers.md b/docs/reference/parsers.md
new file mode 100644
index 00000000..d9fd8df4
--- /dev/null
+++ b/docs/reference/parsers.md
@@ -0,0 +1,3 @@
+# Action parsers
+
+::: sweagent.tools.parsing
\ No newline at end of file
diff --git a/mkdocs.yml b/mkdocs.yml
index a3eef73f..fefada8a 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -84,6 +84,7 @@ nav:
- "index": "config/index.md"
- "Config files": "config/config.md"
- "Templates": "config/templates.md"
+ - "Models": "config/models.md"
- "Demonstrations": "config/demonstrations.md"
- "Tools": "config/tools.md"
- "Environments": "config/environments.md"
@@ -105,6 +106,7 @@ nav:
- "Templates": "reference/template_config.md"
- "Tools": "reference/tools_config.md"
- "History processors": "reference/history_processor_config.md"
+ - "Action parsers": "reference/parsers.md"
- "Environment config": "reference/env_config.md"
- "Tool bundle config": "reference/bundle_config.md"
- Classes:
diff --git a/sweagent/tools/parsing.py b/sweagent/tools/parsing.py
index d24a4439..4e28b1cf 100644
--- a/sweagent/tools/parsing.py
+++ b/sweagent/tools/parsing.py
@@ -1,4 +1,26 @@
-"""Parse output from the LM into thoughts and actions."""
+"""Our parsers parse output from the LM into thoughts and actions.
+
+For example, our most basic parser is the `ThoughtActionParser`.
+It expects the model response to be a discussion followed by a command wrapped in backticks like so:
+
+```
+
+Let's look at the files in the current directory.
+
+Action:
+ ```
+ls -l
+ ```
+```
+
+To use a specific parser, set the `parse_function` key in your tool config to the `type` field of the parser.
+
+```yaml
+tools:
+ ...
+ parse_function: "thought_action"
+```
+"""
import json
import re