Skip to main content

GitHubIssueViewer

Fetch and parse GitHub issues into documents.

Basic Information

  • Type: haystack_integrations.components.connectors.github.issue_viewer.GitHubIssueViewer
  • Components it can connect with:
    • Input: Receives a GitHub issue URL as input.
    • ChatPromptBuilder: Sends issue documents as context for LLM-based analysis.
    • GitHubIssueCommenter: Works alongside to analyze and respond to issues.

Inputs

ParameterTypeDefaultDescription
urlstrGitHub issue URL.

Outputs

ParameterTypeDefaultDescription
documentsList[Document]List of documents containing issue content and comments.

Overview

GitHubIssueViewer fetches and parses GitHub issues into Haystack documents. It takes a GitHub issue URL and returns a list of documents where:

  • The first document contains the main issue content (title, body, labels, author).
  • Subsequent documents contain the issue comments in chronological order.

This component is useful for building pipelines that analyze, triage, or respond to GitHub issues.

Authorization

To use this component, you must create a secret with your GitHub personal access token. Type GITHUB_TOKEN as the secret key. For detailed instructions on creating secrets, see Create Secrets.

Usage Example

This pipeline uses GitHubIssueViewer to fetch and analyze GitHub issues:

components:
GitHubIssueViewer:
type: haystack_integrations.components.connectors.github.issue_viewer.GitHubIssueViewer
init_parameters:
github_token:
type: env_var
env_vars:
- GITHUB_TOKEN
strict: false
raise_on_failure: true
retry_attempts: 2

ChatPromptBuilder:
type: haystack.components.builders.chat_prompt_builder.ChatPromptBuilder
init_parameters:
template:
- role: system
content: "You are a GitHub issue triage assistant. Analyze the provided issue and its comments to provide insights."
- role: user
content: "Issue content:\n{% for doc in documents %}\n{{ doc.content }}\n{% endfor %}\n\nQuestion: {{ query }}"

OpenAIChatGenerator:
type: haystack.components.generators.chat.openai.OpenAIChatGenerator
init_parameters:
api_key:
type: env_var
env_vars:
- OPENAI_API_KEY
strict: false
model: gpt-4o-mini

OutputAdapter:
type: haystack.components.converters.output_adapter.OutputAdapter
init_parameters:
template: '{{ replies[0] }}'
output_type: List[str]

AnswerBuilder:
type: haystack.components.builders.answer_builder.AnswerBuilder
init_parameters:
pattern:
reference_pattern:

connections:
- sender: GitHubIssueViewer.documents
receiver: ChatPromptBuilder.documents
- sender: ChatPromptBuilder.prompt
receiver: OpenAIChatGenerator.messages
- sender: OpenAIChatGenerator.replies
receiver: OutputAdapter.replies
- sender: OutputAdapter.output
receiver: AnswerBuilder.replies
- sender: GitHubIssueViewer.documents
receiver: AnswerBuilder.documents

inputs:
query:
- ChatPromptBuilder.query
- AnswerBuilder.query
url:
- GitHubIssueViewer.url

outputs:
answers: AnswerBuilder.answers

max_runs_per_component: 100

metadata: {}

Parameters

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
github_tokenOptional[Secret]NoneGitHub personal access token for API authentication as a Secret.
raise_on_failureboolTrueIf True, raises exceptions on API errors.
retry_attemptsint2Number of retry attempts for failed requests.

Run Method Parameters

These are the parameters you can configure for the run() method. You can pass these parameters at query time through the API, in Playground, or when running a job.

ParameterTypeDefaultDescription
urlstrGitHub issue URL.