GitHubIssueViewerTool
GitHubIssueViewerTool
Agent가 GitHub 이슈를 가져와 문서로 파싱할 수 있게 해 주는 Tool이에요.
출처: 문서
본문
GitHubIssueViewerTool은 GitHubIssueViewer 구성 요소를 감싸서, 에이전트 워크플로와 tool 기반 파이프라인에서 쓸 수 있는 tool 인터페이스를 제공해요. GitHub 이슈 URL을 받아 문서 리스트를 반환해요:
- 첫 번째 문서는 주요 이슈 콘텐츠를 담아요.
- 이후 문서는 이슈 댓글(있을 경우)을 담아요.
각 문서에는 이슈 제목, 번호, 상태, 생성일, 작성자 등의 풍부한 메타데이터가 포함돼요.
Parameters
name— 선택. 기본값"issue_viewer". tool의 이름.description— 선택. tool이 무엇을 하는지 LLM에 알려주는 설명.github_token— _선택_이지만 비공개 저장소나 rate limiting을 피하려면 권장.raise_on_failure— 선택. 기본값True.False면 예외를 던지는 대신 에러를 문서로 반환.retry_attempts— 선택. 기본값2. 실패한 요청의 재시도 횟수.
Usage
pip install github-haystack
저장소 플레이스홀더: 아래 코드 스니펫을 실행하려면 owner/repo를 자신의 GitHub 저장소 이름으로 바꿔야 해요.
On its own
from haystack_integrations.tools.github import GitHubIssueViewerTool
tool = GitHubIssueViewerTool()
result = tool.invoke(url="https://github.com/deepset-ai/haystack/issues/123")
print(result)
{'documents': [Document(id=3989459bbd8c2a8420a9ba7f3cd3cf79bb41d78bd0738882e57d509e1293c67a, content: 'sentence-transformers = 0.2.6.1haystack = latestfarm = 0.4.3 latest branchIn 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!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'})]}
With an Agent
GitHubIssueViewerTool을 Agent 구성 요소와 함께 사용할 수 있어요. Agent는 GitHub 이슈 정보를 가져올 필요가 있을 때 자동으로 tool을 호출해요.
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
from haystack.components.agents import Agent
from haystack_integrations.tools.github import GitHubIssueViewerTool
issue_tool = GitHubIssueViewerTool(name="github_issue_viewer")
agent = Agent(
chat_generator=OpenAIChatGenerator(),
tools=[issue_tool],
exit_conditions=["text"],
)
response = agent.run(
messages=[
ChatMessage.from_user(
"Please analyze this GitHub issue and summarize the main problem: https://github.com/deepset-ai/haystack/issues/123"
),
],
)
print(response["last_message"].text)
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.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.The issue was later closed with a comment indicating it was fixed in another pull request (#124).