community[patch]: Change github endpoint in GithubLoader (#17622)

Description- 
- Changed the GitHub endpoint as existing was not working and giving 404
not found error
- Also the existing function was failing if file_filter is not passed as
the tree api return all paths including directory as well, and when
get_file_content was iterating over these path, the function was failing
for directory as the api was returning list of files inside the
directory, so added a condition to ignore the paths if it a directory
- Fixes this issue -
https://github.com/langchain-ai/langchain/issues/17453

Co-authored-by: Radhika Bansal <Radhika.Bansal@veritas.com>
This commit is contained in:
RadhikaBansal97
2024-03-01 23:06:31 +05:30
committed by GitHub
parent 2b93206f02
commit 8bafd2df5e
2 changed files with 14 additions and 8 deletions

View File

@@ -147,7 +147,7 @@ def test_github_file_content_get_file_paths(mocker: MockerFixture) -> None:
"type": "blob",
"sha": "789",
"size": 37,
"url": "https://github.com/api/v3/repos/shufanhao/langchain/git/blobs/789",
"url": "https://github.com/repos/shufanhao/langchain/git/blobs/789",
}
]
},
@@ -206,7 +206,7 @@ def test_github_file_content_loader(mocker: MockerFixture) -> None:
"type": "blob",
"sha": "789",
"size": 37,
"url": "https://github.com/api/v3/repos/shufanhao/langchain/git/blobs/789",
"url": "https://github.com/repos/shufanhao/langchain/git/blobs/789",
}
]
},