Code Monkey home page Code Monkey logo

reporeader's Introduction

Code Repository Explorer

Explore and ask questions about a GitHub code repository using OpenAI's GPT-3 language model.

Prerequisites

  • Python 3.6+
  • OpenAI API key (set in the environment variable OPENAI_API_KEY)

Usage

  1. Set the OpenAI API key as an environment variable OPENAI_API_KEY.
  2. Run the script: reporeader.py
  3. Enter the GitHub URL of the repository to explore.
  4. Ask questions about the repository. Type exit() to quit.

Key Features

  • Clones and indexes the contents of a GitHub repository.
  • Supports various file types, including code, text, and Jupyter Notebook files.
  • Generates detailed answers to user queries based on the repository's contents.
  • Uses OpenAI's language model for generating responses.
  • Supports interactive conversation with the language model.
  • Presents top relevant documents for each question.

reporeader's People

Contributors

cmooredev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

reporeader's Issues

error loading files and openai

I might have done this wrong. I created a python environment and cloned the get repo. I installed a few packages that I didn't have but I still cant get it to run without errors. This is my terminal out put:

(.venv) PS D:\AI-projects\RepoReader> python app.py
[nltk_data] Downloading package punkt to
[nltk_data] C:\Users\Jacob\AppData\Roaming\nltk_data...
[nltk_data] Package punkt is already up-to-date!
Enter the GitHub URL of the repository: https://github.com/cpacker/MemGPT
Cloning the repository...
Cloning into 'C:\Users\Jacob\AppData\Local\Temp\tmpmuv5s_by'...
remote: Enumerating objects: 2406, done.
remote: Counting objects: 100% (1403/1403), done.
remote: Compressing objects: 100% (582/582), done.
remote: Total 2406 (delta 1058), reused 939 (delta 817), pack-reused 1003
Receiving objects: 100% (2406/2406), 4.46 MiB | 12.80 MiB/s, done.
Resolving deltas: 100% (1494/1494), done.
Error loading files with pattern '/*.py': 'charmap' codec can't decode byte 0x8f in position 14693: character maps to
Error loading files with pattern '
/.yml': Invalid file C:\Users\Jacob\AppData\Local\Temp\tmpmuv5s_by\mkdocs.yml. The FileType.UNK file type is not supported in partition.
Error loading files with pattern '**/
.toml': Invalid file C:\Users\Jacob\AppData\Local\Temp\tmpmuv5s_by\pyproject.toml. The FileType.UNK file type is not supported in partition.
Error loading files with pattern '**/*.ipynb': [Errno 13] Permission denied: 'C:\Users\Jacob\AppData\Local\Temp\tmpmuv5s_by'
Repository cloned. Indexing files...
D:\AI-projects\RepoReader.venv\Lib\site-packages\langchain\utils\utils.py:159: UserWarning: WARNING! api_key is not default parameter.
api_key was transferred to model_kwargs.
Please confirm that api_key is what you intended.
warnings.warn(

Ask a question about the repository (type 'exit()' to quit): how does memgpt store data
Thinking...
D:\AI-projects\RepoReader.venv\Lib\site-packages\sklearn\feature_extraction\text.py:525: UserWarning: The parameter 'token_pattern' will not be used since 'tokenizer' is not None'
warnings.warn(
An error occurred: module 'openai' has no attribute 'error'

requirements installing error

Because I'm using Windows so I got such error:

uvloop does not support Windows at the moment

Is there any solution?

Prompt issue?

Hey, I've feed the script a documentation but whenever I try to ask it something from it, I get this error that is using too much tokens.

My questions are simple though, "what is this repo"?

An error occurred: This model's maximum context length is 4097 tokens, however you requested 24116 tokens (23860 in your prompt; 256 for the completion). Please reduce your prompt; or completion length.

So many requirements?

I have noticed that there are a lot of libraries in requirements.txt, maybe you need to clean it up? 🤔

File Not found Error

Hi @cmooredev

Uploading Error_Screenshot.png…
I am facing below issue while trying to clone a repository if I define custom local_path as C:/Custom/My_Code

FileNotFoundError: [WinError 2] The system cannot find the file specified

Error_Screenshot

Full Error below


FileNotFoundError Traceback (most recent call last)
Cell In[7], line 20
18 print("Failed to clone the repository.")
19 if name == "main":
---> 20 main()

Cell In[7], line 9, in main()
7 local_path="C:/Custom/My_Code"
8 print("Local path",local_path)
----> 9 if clone_github_repo(github_url, local_path):
10 index, documents, file_type_counts, filenames = load_and_index_files(local_path)
11 if index is None:

Cell In[5], line 5, in clone_github_repo(github_url, local_path)
3 try:
4 print("Git path",github_url)
----> 5 subprocess.check_call(["git", "clone", github_url, local_path])
6 # subprocess.run(['git', 'clone', github_url, local_path], shell=True)
7 print("After subprocess")

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\subprocess.py:364, in check_call(*popenargs, **kwargs)
354 def check_call(*popenargs, **kwargs):
355 """Run command with arguments. Wait for command to complete. If
356 the exit code was zero then return, otherwise raise
357 CalledProcessError. The CalledProcessError object will have the
(...)
362 check_call(["ls", "-l"])
363 """
--> 364 retcode = call(*popenargs, **kwargs)
365 if retcode:
366 cmd = kwargs.get("args")

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\subprocess.py:345, in call(timeout, *popenargs, **kwargs)
337 def call(*popenargs, timeout=None, **kwargs):
338 """Run command with arguments. Wait for command to complete or
339 timeout, then return the returncode attribute.
340
(...)
343 retcode = call(["ls", "-l"])
344 """
--> 345 with Popen(*popenargs, **kwargs) as p:
346 try:
347 return p.wait(timeout=timeout)

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\subprocess.py:971, in Popen.init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize)
967 if self.text_mode:
968 self.stderr = io.TextIOWrapper(self.stderr,
969 encoding=encoding, errors=errors)
--> 971 self._execute_child(args, executable, preexec_fn, close_fds,
972 pass_fds, cwd, env,
973 startupinfo, creationflags, shell,
974 p2cread, p2cwrite,
975 c2pread, c2pwrite,
976 errread, errwrite,
977 restore_signals,
978 gid, gids, uid, umask,
979 start_new_session)
980 except:
981 # Cleanup if the child failed starting.
982 for f in filter(None, (self.stdin, self.stdout, self.stderr)):

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\subprocess.py:1456, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
1454 # Start the process
1455 try:
-> 1456 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
1457 # no special security
1458 None, None,
1459 int(not close_fds),
1460 creationflags,
1461 env,
1462 cwd,
1463 startupinfo)
1464 finally:
1465 # Child is launched. Close the parent's copy of those pipe
1466 # handles that only the child should have open. You need
(...)
1469 # pipe will not close when the child process exits and the
1470 # ReadFile will hang.
1471 self._close_pipe_fds(p2cread, p2cwrite,
1472 c2pread, c2pwrite,
1473 errread, errwrite)

FileNotFoundError: [WinError 2] The system cannot find the file specified

TP_NUM_C_BUFS too small: 50

remote: Compressing objects: 100% (71/71), done.
remote: Total 79 (delta 31), reused 6 (delta 1), pack-reused 0Receiving objects: 82% (65/79)
Receiving objects: 100% (79/79), 1.68 MiB | 7.94 MiB/s, done.
Resolving deltas: 100% (31/31), done.
0 [main] python (17888) C:\Users\afaan\AppData\Local\Programs\Python\Python311\python.exe: *** fatal error - Internal error: TP_NUM_C_BUFS too small: 50

Unable to start the app

python3 app.py

[nltk_data] Error loading punkt: <urlopen error [SSL:
[nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data] unable to get local issuer certificate (_ssl.c:992)>
Enter the GitHub URL of the repository: https://github.com/cmooredev/RepoReader
Cloning the repository...
Cloning into '/var/folders/sw/6wyg_mg101v59l2_37zqx6gm0000gn/T/tmpg8w9vpn7'...
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 53 (delta 23), reused 39 (delta 14), pack-reused 0
Unpacking objects: 100% (53/53), done.
[nltk_data] Error loading punkt: <urlopen error [SSL:
[nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data] unable to get local issuer certificate (_ssl.c:992)>
[nltk_data] Error loading averaged_perceptron_tagger: <urlopen error
[nltk_data] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
[nltk_data] failed: unable to get local issuer certificate
[nltk_data] (_ssl.c:992)>
Error loading files with pattern '**/*.txt':


Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:

import nltk
nltk.download('punkt')

For more information see: https://www.nltk.org/data.html

Attempted to load tokenizers/punkt/PY3/english.pickle

Searched in:
- '/Users/kg/nltk_data'
- '/Users/kg/ai/RepoReader/dev/nltk_data'
- '/Users/kg/ai/RepoReader/dev/share/nltk_data'
- '/Users/kg/ai/RepoReader/dev/lib/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
- ''


Error loading files with pattern '**/*.md':


Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:

import nltk
nltk.download('punkt')

For more information see: https://www.nltk.org/data.html

Attempted to load tokenizers/punkt/PY3/english.pickle

Searched in:
- '/Users/kg/nltk_data'
- '/Users/kg/ai/RepoReader/dev/nltk_data'
- '/Users/kg/ai/RepoReader/dev/share/nltk_data'
- '/Users/kg/ai/RepoReader/dev/lib/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
- ''


Error loading files with pattern '/*.py': Invalid file /var/folders/sw/6wyg_mg101v59l2_37zqx6gm0000gn/T/tmpg8w9vpn7/config.py. The FileType.UNK file type is not supported in partition.
Error loading files with pattern '
/*.ipynb': [Errno 21] Is a directory: '/var/folders/sw/6wyg_mg101v59l2_37zqx6gm0000gn/T/tmpg8w9vpn7'
No documents were found to index. Exiting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.