Skip to content

Commit 7d57edf

Browse files
committed
Improve help_docs documentation with clearer structure and usage examples
1 parent 6950b3c commit 7d57edf

File tree

1 file changed

+44
-21
lines changed

1 file changed

+44
-21
lines changed

docs/docs/tools/help_docs.md

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,46 @@
11
## Overview
22

3-
The `help_docs` tool answers a question based on a given relative path of documentation (which defaults to docs/), either from the repository of this merge request or from a given one.
3+
The `help_docs` tool can answer a free-text question based on a git documentation folder.
4+
45
It can be invoked manually by commenting on any PR or Issue:
56
```
67
/help_docs "..."
8+
```
9+
Or configured to be triggered automatically when a [new issue is opened](#run-as-a-github-action).
10+
11+
The tool assumes by default that the documentation is located in the root of the repository, at `/docs` folder.
12+
However, this can be customized by setting the `docs_path` configuration option:
13+
14+
```toml
15+
[pr_help_docs]
16+
repo_url = "" # The repository to use as context
17+
docs_path = "docs" # The documentation folder
18+
repo_default_branch = "main" # The branch to use in case repo_url overwritten
19+
720
```
821

22+
See more configuration options in the [Configuration options](#configuration-options) section.
23+
924
## Example usage
10-
#### Asking a question about this repository:
11-
![help_docs on the documentation of this repository](https://codium.ai/images/pr_agent/help_docs_comment.png){width=512}
1225

13-
#### Asking a question about another repository under branch: main:
14-
![help_docs on the documentation of another repository](https://codium.ai/images/pr_agent/help_docs_comment_explicit_git.png){width=512}
26+
[//]: # (#### Asking a question about this repository:)
1527

16-
#### Response for the first question:
17-
![help_docs response](https://codium.ai/images/pr_agent/help_docs_response.png){width=512}
28+
[//]: # (![help_docs on the documentation of this repository](https://codium.ai/images/pr_agent/help_docs_comment.png){width=512})
1829

19-
## Configuration options
30+
**Asking a question about another repository**
2031

21-
Under the section `pr_help_docs`, the [configuration file](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L50) contains options to customize the 'help docs' tool:
32+
![help_docs on the documentation of another repository](https://codium.ai/images/pr_agent/help_docs_comment_explicit_git.png){width=512}
2233

23-
- `repo_url`: If not overwritten, will use the repo from where the context came from (issue or PR), otherwise - use the given repo as context.
24-
- `repo_default_branch`: The branch to use in case repo_url overwritten, otherwise - has no effect.
25-
- `docs_path`: Relative path from root of repository (either the one this PR has been issued for, or above repo url).
26-
- `exclude_root_readme`: Whether or not to exclude the root README file for querying the model.
27-
- `supported_doc_exts` : Which file extensions should be included for the purpose of querying the model.
34+
**Response**:
2835

29-
---
30-
## Run as a GitHub Action
36+
![help_docs response](https://codium.ai/images/pr_agent/help_docs_response.png){width=512}
37+
38+
## Run automatically when a new issue is opened
3139

32-
You can use our pre-built Github Action Docker image to run help_docs on any newly created issue, as a Github Action. Here's how:
40+
You can configure PR-Agent to run `help_docs` automatically on any newly created issue.
41+
This can be useful, for example, for providing immediate feedback to users who open issues with questions on open-source projects with extensive documentation.
42+
43+
Here's how:
3344

3445
1) Follow the steps depicted under [Run as a Github Action](https://qodo-merge-docs.qodo.ai/installation/github/#run-as-a-github-action) to create a new workflow, such as:`.github/workflows/help_docs.yml`:
3546

@@ -76,10 +87,22 @@ jobs:
7687
export github__user_token=$GITHUB_TOKEN && \
7788
export github__base_url=$GITHUB_API_URL && \
7889
export openai__key=$OPENAI_KEY && \
79-
export config__verbosity_level=2 && \
80-
python -m pr_agent.cli --issue_url=$ISSUE_URL help_docs \"$ISSUE_BODY\""
90+
python -m pr_agent.cli --issue_url=$ISSUE_URL --pr_help_docs.repo_url="..." --pr_help_docs.docs_path="..." --pr_help_docs.openai_key=$OPENAI_KEY && \help_docs \"$ISSUE_BODY\""
8191
```
8292
83-
3) Following completion of the remaining steps (such as adding secrets and any env. variables), merge this change to your main branch.
84-
When a new issue is opened, you should see a comment from `github-actions` bot with an auto response, assuming the question is a relevant one.
93+
3) Following completion of the remaining steps (such as adding secrets and relevant configurations, such as `repo_url` and `docs_path`) merge this change to your main branch.
94+
When a new issue is opened, you should see a comment from `github-actions` bot with an auto response, assuming the question is related to the documentation of the repository.
95+
---
96+
97+
98+
## Configuration options
99+
100+
Under the section `pr_help_docs`, the [configuration file](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L50) contains options to customize the 'help docs' tool:
101+
102+
- `repo_url`: If not overwritten, will use the repo from where the context came from (issue or PR), otherwise - use the given repo as context.
103+
- `repo_default_branch`: The branch to use in case repo_url overwritten, otherwise - has no effect.
104+
- `docs_path`: Relative path from root of repository (either the one this PR has been issued for, or above repo url).
105+
- `exclude_root_readme`: Whether or not to exclude the root README file for querying the model.
106+
- `supported_doc_exts` : Which file extensions should be included for the purpose of querying the model.
107+
85108
---

0 commit comments

Comments
 (0)