{"id":49209396,"url":"https://github.com/idaholab/ranger","last_synced_at":"2026-04-23T20:33:10.947Z","repository":{"id":329002437,"uuid":"1050548800","full_name":"idaholab/ranger","owner":"idaholab","description":"This repository contains a Python-based auto-response bot that uses the GitHub API and LlamaIndex package to monitor and generate relevant responses for new discussions in the GitHub MOOSE repository.","archived":false,"fork":false,"pushed_at":"2025-12-16T18:02:12.000Z","size":14398,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-20T09:06:54.693Z","etag":null,"topics":["discussions","moose","vector-database"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idaholab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-04T15:29:46.000Z","updated_at":"2025-12-16T18:02:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/idaholab/ranger","commit_stats":null,"previous_names":["idaholab/ranger"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/idaholab/ranger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idaholab%2Franger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idaholab%2Franger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idaholab%2Franger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idaholab%2Franger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idaholab","download_url":"https://codeload.github.com/idaholab/ranger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idaholab%2Franger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32198231,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T20:19:26.138Z","status":"ssl_error","status_checked_at":"2026-04-23T20:19:23.520Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discussions","moose","vector-database"],"created_at":"2026-04-23T20:33:09.228Z","updated_at":"2026-04-23T20:33:10.937Z","avatar_url":"https://github.com/idaholab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RANGER\n\nThis repository contains a Python-based auto-response bot that leverages the GitHub API and the open-source LlamaIndex package to automatically generate responses to discussions on GitHub. The bot monitors GitHub MOOSE repository discussions and provides the most relevant posts when a new discussion is initiated by users. We call it R.A.N.G.E.R. – \"Responsive Assistant for Navigating and Guiding Engineering with Rigor\"\n\n## How It Works\nThe bot uses the GitHub API to fetch discussions from a MOOSE repository and store the data in a vector database. When a new discussion is initiated, the algorithm compares the discussion title with the content of all previous discussions (title + discussions) in the database and provides the most relevant posts to the user. The database is updated regularly to include all new posts, potentially on a monthly basis.\n\n## Repository Contents\nThe repository includes the source code for discussion data parsing, vector database generation, relevant post suggestions, and unit test scripts.\n\n### GitHubAPI.py\nThis script fetches relevant information from the GitHub discussion forum using GraphQL queries.\n\n**Environment Variable Required:**\n- `GITHUB_TOKEN`: The token should be granted sufficient access to read the repository.\n\n**Functionality:**\n- Automatically traverses through pagination to fetch information from each discussion post.\n- Stores each page in JSON format, including the original question and comments.\n\n**Prerequisites:**\n- `query.gql.in`\n- `GITHUB_TOKEN`\n\n### IndexGenerator.py\nThis script embeds the relevant discussion information into a vector database using LlamaIndex functions.\n\n**Functionality:**\n- Uses `SimpleDirectoryReader` to read JSON data from `GitHubAPI.py` and save it as a `Document` object.\n- Uses `HuggingFaceEmbedding` to load the embedding model. The default model is \"all-MiniLM-L6-v2\".\n- Uses `SemanticSplitterNodeParser` to chunk content into nodes according to their semantic similarity.\n- Uses `VectorStoreIndex` to generate the vector database and save it locally.\n\n**Prerequisites:**\n- Transformer model (default: all-MiniLM-L6-v2)\n\n### GitHubBot.py\nThis script loads the vector database, generates the most relevant posts according to the title of a new post, and posts the result as a reply.\n\n**Functionality:**\n- Uses cosine similarity search to find the similarity between the new post's title and previous posts' titles and discussion contents.\n- Adjustable parameters: `top_n` (number of most relevant posts) and `threshold` (similarity cutoff).\n\n**Prerequisites:**\n- Transformer model (default: all-MiniLM-L6-v2)\n- Vector database (`/db_dir`)\n\n**Note:** It is recommended to use the same transformer model for vector database embedding and retrieval for best performance.\n\n## Submodule\n- `all-MiniLM-L12-v2` is a sentence-transformer model used to embed content into a vector index. It maps sentences and paragraphs to a 384-dimensional dense vector space for tasks like clustering or semantic search.\n\n## Installation\nTo install and set up the `moose-discussion-bot`, follow these steps:\n\n1. Install [Miniforge](https://github.com/conda-forge/miniforge)\n2. Create your environment:\n    ```bash\n    conda create -n RANGER python pip\n    conda activate RANGER\n    ```\n3. Clone the repository:\n    ```bash\n    git clone https://github.com/idaholab/moose-discussion-bot.git\n    ```\n4. Navigate to the repository directory:\n    ```bash\n    cd moose-discussion-bot\n    ```\n5. Install the required dependencies:\n    ```bash\n    pip install -r requirements.txt\n    ```\n6. Configure the bot by creating a `.env` file with the necessary environment variables:\n    ```plaintext\n    GITHUB_TOKEN=your_github_token\n    REPO_OWNER=your_repo_owner\n    REPO_NAME=your_repo_name\n    ```\n\n## Testing\nSeparate unit tests are developed for each class in the repository using `unittest`. The tests are organized as follows:\n\n1. `test_GitHubAPI.py`: Contains unit tests for `GitHubAPI.py`.\n2. `test_IndexGenerator.py`: Contains unit tests for `IndexGenerator.py`.\n3. `test_GitHubBot.py`: Contains unit tests for `GitHubBot.py`.\n\nTo run the tests:\n```bash\npytest\n```\n\n## Validation Mode\n\nUse the `validation` subcommand to run a small, reproducible, **offline** check of the pipeline:\n\n1. Read a pin file (e.g., `pinned.txt`) that lists discussions to fetch (`owner/repo#123` or full discussion URLs).\n2. Fetch those discussions into a raw folder (`--val-out-dir`).\n3. Build a fresh vector database (`--val-db`).\n4. Answer a one-off `--prompt` using the offline index.\n5. Optionally write and/or compare a golden result (`--write-golden`, `--golden`).\n\n**Example**\n```bash\npython RANGER.py --config config.yaml validation\n```\n\n## References\n1. [MOOSE GitHub Mining](https://github.com/hugary1995/moose-gh-mining)\n2. [Discuss-Bot](https://github.com/dhrubasaha08/Discuss-Bot)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidaholab%2Franger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidaholab%2Franger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidaholab%2Franger/lists"}