-
Notifications
You must be signed in to change notification settings - Fork 16.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
community: adds support for getting github releases for the configure…
…d repository (#29318) **Description:** adds support for github tool to query github releases on the configure respository **Issue:** N/A **Dependencies:** N/A **Twitter handle:** @MacsDickinson --------- Co-authored-by: Chester Curme <chester.curme@gmail.com>
- Loading branch information
1 parent
ef1610e
commit 7378c95
Showing
6 changed files
with
192 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
libs/community/tests/unit_tests/agent_toolkits/test_github_toolkit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from unittest.mock import MagicMock | ||
|
||
from langchain_community.agent_toolkits.github.toolkit import GitHubToolkit | ||
from langchain_community.utilities.github import GitHubAPIWrapper | ||
|
||
|
||
def test_github_toolkit() -> None: | ||
# Create a mock GitHub wrapper with required attributes | ||
mock_github = MagicMock(spec=GitHubAPIWrapper) | ||
mock_github.github_repository = "fake/repo" | ||
mock_github.github_app_id = "fake_id" | ||
mock_github.github_app_private_key = "fake_key" | ||
mock_github.active_branch = "main" | ||
mock_github.github_base_branch = "main" | ||
|
||
# Test without release tools | ||
toolkit = GitHubToolkit.from_github_api_wrapper(mock_github) | ||
tools = toolkit.get_tools() | ||
assert len(tools) == 21 # Base number of tools | ||
|
||
# Test with release tools | ||
toolkit_with_releases = GitHubToolkit.from_github_api_wrapper( | ||
mock_github, include_release_tools=True | ||
) | ||
tools_with_releases = toolkit_with_releases.get_tools() | ||
assert len(tools_with_releases) == 24 # Base tools + 3 release tools |