/ docs-website / versioned_docs / version-2.18 / tools / ready-made-tools / githubissueviewertool.mdx
githubissueviewertool.mdx
  1  ---
  2  title: "GitHubIssueViewerTool"
  3  id: githubissueviewertool
  4  slug: "/githubissueviewertool"
  5  description: "A Tool that allows Agents and ToolInvokers to fetch and parse GitHub issues into documents."
  6  ---
  7  
  8  # GitHubIssueViewerTool
  9  
 10  A Tool that allows Agents and ToolInvokers to fetch and parse GitHub issues into documents.
 11  
 12  |                   |                                                                                          |
 13  | ----------------- | ---------------------------------------------------------------------------------------- |
 14  | **API reference** | [Tools](/reference/tools-api)                                                            |
 15  | **GitHub link**   | https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/github |
 16  
 17  ## Overview
 18  
 19  `GitHubIssueViewerTool` wraps the [`GitHubIssueViewer`](../../pipeline-components/connectors/githubissueviewer.mdx) component, providing a tool interface for use in agent workflows and tool-based pipelines.
 20  
 21  The tool takes a GitHub issue URL and returns a list of documents where:
 22  
 23  - The first document contains the main issue content,
 24  - Subsequent documents contain the issue comments (if any).
 25  
 26  Each document includes rich metadata such as the issue title, number, state, creation date, author, and more.
 27  
 28  ### Parameters
 29  
 30  - `name` is _optional_ and defaults to "issue_viewer". Specifies the name of the tool.
 31  - `description` is _optional_ and provides context to the LLM about what the tool does.
 32  - `github_token` is _optional_ but recommended for private repositories or to avoid rate limiting.
 33  - `raise_on_failure` is _optional_ and defaults to `True`. If False, errors are returned as documents instead of raising exceptions.
 34  - `retry_attempts` is _optional_ and defaults to `2`. Number of retry attempts for failed requests.
 35  
 36  ## Usage
 37  
 38  Install the GitHub integration to use the `GitHubIssueViewerTool`:
 39  
 40  ```shell
 41  pip install github-haystack
 42  ```
 43  
 44  :::note
 45  Repository Placeholder
 46  
 47  To run the following code snippets, you need to replace the `owner/repo` with your own GitHub repository name.
 48  :::
 49  
 50  ### On its own
 51  
 52  ```python
 53  from haystack_integrations.tools.github import GitHubIssueViewerTool
 54  
 55  tool = GitHubIssueViewerTool()
 56  result = tool.invoke(url="https://github.com/deepset-ai/haystack/issues/123")
 57  
 58  print(result)
 59  ```
 60  
 61  ```bash
 62  {'documents': [Document(id=3989459bbd8c2a8420a9ba7f3cd3cf79bb41d78bd0738882e57d509e1293c67a, content: 'sentence-transformers = 0.2.6.1
 63  haystack = latest
 64  farm = 0.4.3 latest branch
 65  
 66  In the call to Emb...', meta: {'type': 'issue', 'title': 'SentenceTransformer no longer accepts \'gpu" as argument', 'number': 123, 'state': 'closed', 'created_at': '2020-05-28T04:49:31Z', 'updated_at': '2020-05-28T07:11:43Z', 'author': 'predoctech', 'url': 'https://github.com/deepset-ai/haystack/issues/123'}), Document(id=a8a56b9ad119244678804d5873b13da0784587773d8f839e07f644c4d02c167a, content: 'Thanks for reporting!
 67  Fixed with #124 ', meta: {'type': 'comment', 'issue_number': 123, 'created_at': '2020-05-28T07:11:42Z', 'updated_at': '2020-05-28T07:11:42Z', 'author': 'tholor', 'url': 'https://github.com/deepset-ai/haystack/issues/123#issuecomment-635153940'})]}
 68  ```
 69  
 70  ### With an Agent
 71  
 72  You can use `GitHubIssueViewerTool` with the [Agent](../../pipeline-components/agents-1/agent.mdx) component. The Agent will automatically invoke the tool when needed to fetch GitHub issue information.
 73  
 74  ```python
 75  from haystack.components.generators.chat import OpenAIChatGenerator
 76  from haystack.dataclasses import ChatMessage
 77  from haystack.components.agents import Agent
 78  from haystack_integrations.tools.github import GitHubIssueViewerTool
 79  
 80  issue_tool = GitHubIssueViewerTool(name="github_issue_viewer")
 81  
 82  agent = Agent(
 83      chat_generator=OpenAIChatGenerator(),
 84      tools=[issue_tool],
 85      exit_conditions=["text"],
 86  )
 87  
 88  agent.warm_up()
 89  response = agent.run(
 90      messages=[
 91          ChatMessage.from_user(
 92              "Please analyze this GitHub issue and summarize the main problem: https://github.com/deepset-ai/haystack/issues/123",
 93          ),
 94      ],
 95  )
 96  
 97  print(response["last_message"].text)
 98  ```
 99  
100  ```bash
101  The GitHub issue titled "SentenceTransformer no longer accepts 'gpu' as argument" (issue \#123) discusses a problem encountered when using the `EmbeddingRetriever()` function. The user reports that passing the argument `gpu=True` now causes an error because the method that processes this argument does not accept "gpu" anymore; instead, it previously accepted "cuda" without issues.
102  
103  The user indicates that this change is problematic since it prevents users from instantiating the embedding model with GPU support, forcing them to default to using only the CPU for model execution.
104  
105  The issue was later closed with a comment indicating it was fixed in another pull request (#124).
106  ```