auto-triager
automatically triages Grafana issues using OpenAI Models
You can use the tool with GitHub Actions to automatically triage issues.
For more information, refer to GitHub Action integration
-
Go 1.22.3 or higher installed
-
The
GH_TOKEN
environment variable set to a GitHub personal access token with at least read access to public repositories. -
The
OPENAI_API_KEY
environment variable set to an OpenAI API key.If you want the tool to also update the issue with the generated labels you can pass the
-addLabels=true
flag. To update issues with labels, your token must also have the permissions to add labels to issues.
To run auto-triager
, use the following command:
mage -v run:triagerOpenAI <ISSUE ID>
Where ISSUE ID
is the issue ID you want to triage.
Usage of ./bin/linux_amd64/triager-openai:
-addLabels
Add labels to the issue in the repo via the GitHub API
-categorizerModel string
Model to use (default "gpt-4o")
-issueId int
Github Issue ID (only the number)
-repo string
Github repo to push the issue to (default "grafana/grafana")
-retries int
Number of retries to use when categorizing an issue (default 5)
-labelsFile string
Labels file. One label per line (default "fixtures/categoryLabels.txt")
-typesFile string
Types file. One label per line (default "fixtures/typeLabels.txt")
-promptFile string
Prompt with instructions on how to categorize the issue (default "fixtures/prompt.txt")
flowchart TD
Start([Tool Called]) --> ReadIssue[Read GitHub Issue]
ReadIssue --> |"-issueId from -repo"| ConsultLLM[Consult LLM]
subgraph LLM Process
ConsultLLM --> |"-prompt\n-labelsFile\n-typesFile"| ModelProcess[Process with Model]
ModelProcess --> Categories[Return Categories]
end
Categories --> AddLabels{"-addLabels\npassed?"}
AddLabels --> |Yes| GHToken{Valid\nGH_TOKEN?}
GHToken --> |Yes| AssignLabels[Assign Labels to Issue]
GHToken --> |No| PrintJSON[Print Result JSON]
AddLabels --> |No| PrintJSON
AssignLabels --> PrintJSON
PrintJSON --> End([End])