Shubhamsaboo / awesome-llm-apps

Collection of awesome LLM apps with RAG using OpenAI, Anthropic, Gemini and opensource models.

Home Page:https://unwindai.substack.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get a bad credentials exception when trying to use chat with git

byjlw opened this issue · comments

I tried both the classic and beta versions of the git access tokens both give me the same exception

BadCredentialsException: 401 {"message": "Bad credentials", "documentation_url": "https://docs.github.com/rest"}

Searching data from github: 0%| | 0/1 [00:00<?, ?it/s]
2024-05-13 08:03:51.346 Uncaught app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/Users/jessewhite/Documents/source/awesome-llm-apps/chat_with_github/chat_github.py", line 29, in
app.add("repo:" + git_repo + " " + "type:repo", data_type="github", loader=loader)
File "/usr/local/lib/python3.11/site-packages/embedchain/embedchain.py", line 176, in add
documents, metadatas, _ids, new_chunks = self._load_and_embed(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/embedchain.py", line 309, in _load_and_embed
embeddings_data = chunker.create_chunks(loader, src, app_id=app_id, config=add_config.chunker)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/chunkers/base_chunker.py", line 33, in create_chunks
data_result = loader.load_data(src)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 305, in load_data
for search_data in tqdm(futures_map, total=len(search_types), desc="Searching data from github"):
File "/Users/jessewhite/Library/Python/3.11/lib/python/site-packages/tqdm/std.py", line 1182, in iter
for obj in iterable:
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
yield _result_or_cancel(fs.pop())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
return fut.result(timeout)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 237, in _search_github_data
data = self._github_search_repo(query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 117, in _github_search_repo
data = self._get_github_repo_data(updated_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 72, in _get_github_repo_data
repo = self.client.get_repo(repo_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/MainClass.py", line 363, in get_repo
headers, data = self.__requester.requestJsonAndCheck("GET", url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/Requester.py", line 442, in requestJsonAndCheck
return self.__check(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/Requester.py", line 487, in __check
raise self.__createException(status, responseHeaders, data)
github.GithubException.BadCredentialsException: 401 {"message": "Bad credentials", "documentation_url": "https://docs.github.com/rest"}
Searching data from github: 0%| | 0/1 [00:00<?, ?it/s]
2024-05-13 08:06:02.039 Uncaught app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/Users/jessewhite/Documents/source/awesome-llm-apps/chat_with_github/chat_github.py", line 29, in
app.add("repo:" + git_repo + " " + "type:repo", data_type="github", loader=loader)
File "/usr/local/lib/python3.11/site-packages/embedchain/embedchain.py", line 176, in add
documents, metadatas, _ids, new_chunks = self._load_and_embed(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/embedchain.py", line 309, in _load_and_embed
embeddings_data = chunker.create_chunks(loader, src, app_id=app_id, config=add_config.chunker)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/chunkers/base_chunker.py", line 33, in create_chunks
data_result = loader.load_data(src)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 305, in load_data
for search_data in tqdm(futures_map, total=len(search_types), desc="Searching data from github"):
File "/Users/jessewhite/Library/Python/3.11/lib/python/site-packages/tqdm/std.py", line 1182, in iter
for obj in iterable:
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
yield _result_or_cancel(fs.pop())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
return fut.result(timeout)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 237, in _search_github_data
data = self._github_search_repo(query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 117, in _github_search_repo
data = self._get_github_repo_data(updated_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 72, in _get_github_repo_data
repo = self.client.get_repo(repo_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/MainClass.py", line 363, in get_repo
headers, data = self.__requester.requestJsonAndCheck("GET", url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/Requester.py", line 442, in requestJsonAndCheck
return self.__check(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/Requester.py", line 487, in __check
raise self.__createException(status, responseHeaders, data)
github.GithubException.BadCredentialsException: 401 {"message": "Bad credentials", "documentation_url": "https://docs.github.com/rest"}
Searching data from github: 0%| | 0/1 [00:00<?, ?it/s]
2024-05-13 08:06:31.520 Uncaught app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/Users/jessewhite/Documents/source/awesome-llm-apps/chat_with_github/chat_github.py", line 29, in
app.add("repo:" + git_repo + " " + "type:repo", data_type="github", loader=loader)
File "/usr/local/lib/python3.11/site-packages/embedchain/embedchain.py", line 176, in add
documents, metadatas, _ids, new_chunks = self._load_and_embed(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/embedchain.py", line 309, in _load_and_embed
embeddings_data = chunker.create_chunks(loader, src, app_id=app_id, config=add_config.chunker)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/chunkers/base_chunker.py", line 33, in create_chunks
data_result = loader.load_data(src)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 305, in load_data
for search_data in tqdm(futures_map, total=len(search_types), desc="Searching data from github"):
File "/Users/jessewhite/Library/Python/3.11/lib/python/site-packages/tqdm/std.py", line 1182, in iter
for obj in iterable:
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
yield _result_or_cancel(fs.pop())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
return fut.result(timeout)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 237, in _search_github_data
data = self._github_search_repo(query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 117, in _github_search_repo
data = self._get_github_repo_data(updated_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 72, in _get_github_repo_data
repo = self.client.get_repo(repo_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/MainClass.py", line 363, in get_repo
headers, data = self.__requester.requestJsonAndCheck("GET", url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/Requester.py", line 442, in requestJsonAndCheck
return self.__check(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/Requester.py", line 487, in __check
raise self.__createException(status, responseHeaders, data)
github.GithubException.BadCredentialsException: 401 {"message": "Bad credentials", "documentation_url": "https://docs.github.com/rest"}
Searching data from github: 0%| | 0/1 [00:00<?, ?it/s]
2024-05-13 08:07:09.764 Uncaught app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/Users/jessewhite/Documents/source/awesome-llm-apps/chat_with_github/chat_github.py", line 29, in
app.add("repo:" + git_repo + " " + "type:repo", data_type="github", loader=loader)
File "/usr/local/lib/python3.11/site-packages/embedchain/embedchain.py", line 176, in add
documents, metadatas, _ids, new_chunks = self._load_and_embed(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/embedchain.py", line 309, in _load_and_embed
embeddings_data = chunker.create_chunks(loader, src, app_id=app_id, config=add_config.chunker)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/chunkers/base_chunker.py", line 33, in create_chunks
data_result = loader.load_data(src)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 305, in load_data
for search_data in tqdm(futures_map, total=len(search_types), desc="Searching data from github"):
File "/Users/jessewhite/Library/Python/3.11/lib/python/site-packages/tqdm/std.py", line 1182, in iter
for obj in iterable:
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
yield _result_or_cancel(fs.pop())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
return fut.result(timeout)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 237, in _search_github_data
data = self._github_search_repo(query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 117, in _github_search_repo
data = self._get_github_repo_data(updated_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/embedchain/loaders/github.py", line 72, in _get_github_repo_data
repo = self.client.get_repo(repo_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/MainClass.py", line 363, in get_repo
headers, data = self.__requester.requestJsonAndCheck("GET", url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/Requester.py", line 442, in requestJsonAndCheck
return self.__check(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/github/Requester.py", line 487, in __check
raise self.__createException(status, responseHeaders, data)
github.GithubException.BadCredentialsException: 401 {"message": "Bad credentials", "documentation_url": "https://docs.github.com/rest"}

Figured it out. Needed to add my token in chat_github.py.
Since the UI already asks the openAI api key in the UI why not do the same with the git api key?
loader = GithubLoader(
config={
"token":"",
}
)

For simplicity sake, I kept it like that.

You can easily add it to the UI and let users input the token similar to the OpenAI API key.

Either way. would recommend updating the readme since since the details are missing and i had to read the code to figure out how to get it to work.