Code Monkey home page Code Monkey logo

codex-readme's Introduction

๐Ÿค– codex-readme ๐Ÿ“œ

The gif shows how the readme below was generated. To generate your own readmes you need to get access to the Codex API (https://openai.com/blog/openai-codex/).

codex-readme

What is it?

This project is a set of programs that I use to create a README.md file.

How does it work?

It reads program files and concatenates the beginning of all files to create a input prompt which is then fed to OpenAI Codex to generate a README.

How to use it?

./codex_readme.py

TODO

  • Add more programs and improve the README.md generator.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Credits

This project is based on the OpenAI Codex project.

Contact

If you have any questions or would like to get in touch, please open an issue on Github or send me an email: [email protected]


Traffic Statistics

codex-readme's People

Contributors

glsmerfu avatar tom-doerr 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  avatar  avatar  avatar  avatar  avatar

codex-readme's Issues

Issue on generating README.md

Found your project on Reddit so I thought I'd give it a try.

I tried this on my project, and it started generating (what I assume is) the README to my screen, but it ended prematurely with the following:

Traceback (most recent call last):
  File "../codex-readme/codex_readme.py", line 196, in <module>
    generate_until_accepted(input_prompt, args.tokens)
  File "../codex-readme/codex_readme.py", line 169, in generate_until_accepted
    generated_readme = clear_screen_and_display_generated_readme(response)
  File "../codex-readme/codex_readme.py", line 116, in clear_screen_and_display_generated_readme
    next_response = next(response)
StopIteration

I'm not a python guy (just dabble), so naturally, I turned to ChatGPT. It said the following which may be relevant:

The generate_until_accepted function uses args without declaring it as a global variable or passing it as an argument. This could lead to unexpected behavior if args is defined elsewhere in the script. It would be better to pass args as an argument to enerate_until_accepted.

The StopIteration error occurs when the next() function is called on an iterator that has no more elements. In this case, the error is raised because next(response) is called after the completion request has been completed.

The issue may be caused by the stop parameter passed to the openai.Completion.create method. The stop parameter specifies a sequence of tokens at which to stop generating text. In this case, the stop parameter is set to '===================\n', which is the sequence of characters that marks the end of the input prompt.

If the completion request generates text that does not include the stop sequence, the next(response) call in the clear_screen_and_display_generated_readme function will raise a StopIteration error because there are no more elements to iterate over.

To fix the issue, you can check whether next_response['choices'][0]['finish_reason'] is equal to 'stop' before calling next(response) again. Here's an updated version of the clear_screen_and_display_generated_readme function that handles this case:

def clear_screen_and_display_generated_readme(response):
    '''
    Display the generated README and return its contents as a string.
    '''
    os.system('cls' if os.name == 'nt' else 'clear')
    generated_readme = README_START
    print(generated_readme)

    for next_response in response:
        completion = next_response['choices'][0]['text']
        print(completion, end='')
        generated_readme += completion
        if next_response['choices'][0]['finish_reason'] == 'stop':
            break

    return generated_readme

This updated function should exit the loop when it encounters the 'stop' finish reason, and return the generated README as a string.

No mention of how to get an API key

The script requires an OpenAI key, but it's not mentioned anywhere that it is needed, or how to obtain one (additionally, no mention of the modules needed to install as well).

StopIteration Error

Hi Tom,
I just implemented the API Key in ~/.config/openaiapirc
with the folowing content:

[openai]
organization_id=org-MY_ORGANIZATION_KEY
secret_key=sk-MY_API_KEY

The module openai is installed fine.
I am running Python3 on Windows.

After starting the program with:

python ./codex-readme.py

I get these output error:

...
You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.


Traceback (most recent call last):
  File "C:\dev\codex-readme\codex_readme.py", line 196, in <module>
    generate_until_accepted(input_prompt, args.tokens)
  File "C:\dev\codex-readme\codex_readme.py", line 169, in generate_until_accepted
    generated_readme = clear_screen_and_display_generated_readme(response)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\dev\codex-readme\codex_readme.py", line 116, in clear_screen_and_display_generated_readme
    next_response = next(response)
                    ^^^^^^^^^^^^^^
StopIteration

Any help would be appreciated.

The model: `code-davinci-001` does not exist

Not entirely sure if this is an "issue" in its classical form, but I run into the error while running the script:

The model: code-davinci-001 does not exist

Link to an online discussion:
https://community.openai.com/t/the-model-text-davinci-edit-001-does-not-exist/116144/31

Seems to be deprecated and replaced by gpt-3.5-turbo

ChatGPT (self)
The code-davinci-001 model you're trying to access might have been removed or renamed by OpenAI since my knowledge cutoff date. I suggest checking the OpenAI API documentation to ensure that the model name you're using is correct and supported.

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.