Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1: Create Snake game in python using AutoPR #2

Merged
merged 1 commit into from
Jul 31, 2023
Merged

Conversation

hariexcel
Copy link
Owner

@hariexcel hariexcel commented Jul 31, 2023

AutoPR Success

Fixes #1

Status

This pull request was autonomously generated by AutoPR.

If there's a problem with this pull request, please open an issue.

⚠️⚠️⚠️ Warning: Using gpt-3.5-turbo completion model. AutoPR is currently not optimized for this model. See irgolic/AutoPR#65 for more details. In the mean time, if you have access to the gpt-4 API, please use that instead. Please note that ChatGPT Plus does not give you access to the gpt-4 API; you need to sign up on the GPT-4 API waitlist.

📖 Looked at files
💬 Asked for InitialFileSelect
Prompt
Hey, somebody just opened an issue in my repo, could you help me write a pull request?

Given context variables enclosed by +-+:

Issue:
+-+
#1 Create Snake game in python using AutoPR

hariexcel: Create Snake game in python using AutoPR


+-+

The list of files in the repo is:
```README.md (186 tokens)
.github/workflows/autopr.yml (649 tokens)```

Should we take a look at any files? If so, pick only a few files (max 5000 tokens). 
Respond with a very short rationale, and a list of files.
If looking at files would be a waste of time with regard to the issue, respond with an empty list.
Response
Yes, let's take a look at the files in the repo to understand the context of the issue. 

Rationale: Reviewing the files will help us understand the current state of the project and what needs to be done to create the Snake game in Python.

Files to review:
1. README.md (186 tokens)
2. .github/workflows/autopr.yml (649 tokens)
🛤 Ran InitialFileSelectResponse on rail
Prompt
Given the following document surrounded by `+++++`, answer the following questions. 
If the answer doesn't exist in the document, enter `null`.

+++++
Yes, let's take a look at the files in the repo to understand the context of the issue. 

Rationale: Reviewing the files will help us understand the current state of the project and what needs to be done to create the Snake game in Python.

Files to review:
1. README.md (186 tokens)
2. .github/workflows/autopr.yml (649 tokens)
+++++

Extract information from this document and return a JSON that follows the correct schema.
If looking at files would be a waste of time, please submit an empty list.


Given below is XML that describes the information to extract from this document and the tags to extract it into.


<output>
    <list name="filepaths">
        <string description="Files in this repository that we should look at."/>
    </list>
</output>

Raw output
{
  "filepaths": [
    "README.md",
    ".github/workflows/autopr.yml"
  ]
}
Parsed output
{
  "filepaths": [
    "README.md",
    ".github/workflows/autopr.yml"
  ]
}
Validated output
{
  "filepaths": [
    "README.md",
    ".github/workflows/autopr.yml"
  ]
}
💬 Asked for LookAtFiles
Prompt
Hey, somebody just submitted an issue, could you own it, and write a pull request?

Given context variables enclosed by +-+:

Issue:
+-+
#1 Create Snake game in python using AutoPR

hariexcel: Create Snake game in python using AutoPR


+-+

We've decided to look at these files:
```>>> Path: README.md:

0 <div align="center">
1 
2 # 🚀 AutoPR Template 🚀
3 
4 [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label&color=purple)](https://discord.gg/ykk7Znt3K6)
5 
6 [AutoPR](https://github.com/irgolic/AutoPR) automatically writes pull requests in response to issues with ChatGPT.  
7 
8 </div>
9 
10 # 🛠 Usage
11 
12 Please see [USAGE.md](https://github.com/irgolic/AutoPR/blob/main/USAGE.md) for more information.
13 
14 If you'd like to try out GPT-4 AutoPR, you can make an issue in this repository, and I'll run it manually.
>>> Path: .github/workflows/autopr.yml:

0 on:
1   issues:
2     types: [labeled]
3   issue_comment:
4     types: [created]
5 
6 permissions:
7   contents: write
8   issues: write
9   pull-requests: write
10 
11 jobs:
12   autopr:
13     if: ${{ (github.event_name == 'issues' && 
14              contains( github.event.label.name, 'AutoPR')) || 
15             (github.event_name == 'issue_comment' && 
16              github.event.issue.pull_request &&
17              contains( github.event.comment.body, 'Hey AutoPR')) }}
18     runs-on: ubuntu-latest
19     steps:
20     - name: Install jq
21       run: sudo apt-get install jq
22     - name: Check if label was added by a collaborator
23       env:
24         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25       run: |
26         is_collaborator=$(curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github+json" \
27           "https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}" | jq -r '.message')
28 
29         if [ "$is_collaborator" == "Not Found" ]; then
30           echo "Label not added by a collaborator. Skipping action."
31           exit 78
32         fi
33     - name: Checkout
34       uses: actions/checkout@v2
35       with:
36         ref: main
37         fetch-depth: 1
38     - name: AutoPR
39       uses: docker://ghcr.io/irgolic/autopr:latest
40       env:
41         OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
42       with:
43         github_token: ${{ secrets.PAT }}
44         model: 'gpt-3.5-turbo'
45         context_limit: 4096```

The list of files in the repo that we haven't taken a look at yet:
``````

Take some notes that will help us plan our code commits, in an effort to close the issue. 
Also, should we take a look at any other files? If so, pick only a few files (max 5000 tokens).
Respond with some very brief notes, and a list of files to continue looking at. 
If looking at files would be a waste of time with regard to the issue, respond with an empty list.
Response
Based on the issue and the context provided, here are some brief notes and a list of files to continue looking at:

Notes:
- The issue is to create a Snake game in Python using AutoPR.
- The issue was submitted by user hariexcel.

Files to continue looking at:
- README.md: The README file provides an overview of the project and may contain additional instructions or requirements.
- .github/workflows/autopr.yml: The workflow file contains the configuration for the AutoPR action and may have relevant information for the implementation.

Please review these files and let me know if there are any specific sections or code snippets you would like to focus on.
🛤 Ran LookAtFilesResponse on rail
Prompt
Given the following document surrounded by `+++++`, answer the following questions. 
If the answer doesn't exist in the document, enter `null`.

+++++
Based on the issue and the context provided, here are some brief notes and a list of files to continue looking at:

Notes:
- The issue is to create a Snake game in Python using AutoPR.
- The issue was submitted by user hariexcel.

Files to continue looking at:
- README.md: The README file provides an overview of the project and may contain additional instructions or requirements.
- .github/workflows/autopr.yml: The workflow file contains the configuration for the AutoPR action and may have relevant information for the implementation.

Please review these files and let me know if there are any specific sections or code snippets you would like to focus on.
+++++

Extract information from this document and return a JSON that follows the correct schema.
If looking at files would be a waste of time, please submit an empty list.


Given below is XML that describes the information to extract from this document and the tags to extract it into.


<output>
    <string name="notes" description="Notes relevant to solving the issue, that we will use to plan our code commits." length="1 1000" on-fail="noop"/>
    <list name="filepaths_we_should_look_at">
        <string description="The paths to files we should look at next in the repo. Drop any files that are a waste of time with regard to the issue."/>
    </list>
</output>

Raw output
{
  "notes": "Based on the issue and the context provided, here are some brief notes and a list of files to continue looking at:\n\nNotes:\n- The issue is to create a Snake game in Python using AutoPR.\n- The issue was submitted by user hariexcel.\n\nFiles to continue looking at:\n- README.md: The README file provides an overview of the project and may contain additional instructions or requirements.\n- .github/workflows/autopr.yml: The workflow file contains the configuration for the AutoPR action and may have relevant information for the implementation.\n\nPlease review these files and let me know if there are any specific sections or code snippets you would like to focus on.",
  "filepaths_we_should_look_at": [
    "README.md",
    ".github/workflows/autopr.yml"
  ]
}
Parsed output
{
  "notes": "Based on the issue and the context provided, here are some brief notes and a list of files to continue looking at:\n\nNotes:\n- The issue is to create a Snake game in Python using AutoPR.\n- The issue was submitted by user hariexcel.\n\nFiles to continue looking at:\n- README.md: The README file provides an overview of the project and may contain additional instructions or requirements.\n- .github/workflows/autopr.yml: The workflow file contains the configuration for the AutoPR action and may have relevant information for the implementation.\n\nPlease review these files and let me know if there are any specific sections or code snippets you would like to focus on.",
  "filepaths_we_should_look_at": [
    "README.md",
    ".github/workflows/autopr.yml"
  ]
}
Validated output
{
  "filepaths_we_should_look_at": [
    "README.md",
    ".github/workflows/autopr.yml"
  ],
  "notes": "Based on the issue and the context provided, here are some brief notes and a list of files to continue looking at:\n\nNotes:\n- The issue is to create a Snake game in Python using AutoPR.\n- The issue was submitted by user hariexcel.\n\nFiles to continue looking at:\n- README.md: The README file provides an overview of the project and may contain additional instructions or requirements.\n- .github/workflows/autopr.yml: The workflow file contains the configuration for the AutoPR action and may have relevant information for the implementation.\n\nPlease review these files and let me know if there are any specific sections or code snippets you would like to focus on."
}
🚀 Running request_more_information
🛤 Ran action choice rail
Instructions
You are AutoPR, an autonomous pull request creator and a helpful assistant only capable of communicating with valid JSON, and no other text.


ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, enter `null`.

Here are examples of simple (XML, JSON) pairs that show the expected behavior:
- `<string name='foo' format='two-words lower-case' />` => `{'foo': 'example one'}`
- `<list name='bar'><string format='upper-case' /></list>` => `{"bar": ['STRING ONE', 'STRING TWO', etc.]}`
- `<object name='baz'><string name="foo" format="capitalize two-words" /><integer name="index" format="1-indexed" /></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}`

Prompt
Given context variables enclosed by +-+:

Issue:
+-+
#1 Create Snake game in python using AutoPR

hariexcel: Create Snake game in python using AutoPR


+-+

Notes:
+-+
Based on the issue and the context provided, here are some brief notes and a list of files to continue looking at:

Notes:
- The issue is to create a Snake game in Python using AutoPR.
- The issue was submitted by user hariexcel.

Files to continue looking at:
- README.md: The README file provides an overview of the project and may contain additional instructions or requirements.
- .github/workflows/autopr.yml: The workflow file contains the configuration for the AutoPR action and may have relevant information for the implementation.

Please review these files and let me know if there are any specific sections or code snippets you would like to focus on.
+-+

You are about to make a decision on what to do next, and return a JSON that follows the correct schema.


Given below is XML that describes the information to extract from this document and the tags to extract it into.


<output>
    <string name="action" choices="plan_pull_request,request_more_information"/>
    <object name="plan_pull_request" description="plan_pull_request" if="action==plan_pull_request">
        <string name="reason"/>
    </object>
    <object name="request_more_information" description="request_more_information" if="action==request_more_information">
        <string name="message"/>
    </object>
</output>

Raw output
{
  "action": "request_more_information",
  "request_more_information": {
    "message": "Please provide more information about the Snake game requirements."
  }
}
Parsed output
{
  "action": "request_more_information",
  "request_more_information": {
    "message": "Please provide more information about the Snake game requirements."
  }
}

@hariexcel hariexcel marked this pull request as ready for review July 31, 2023 04:25
@hariexcel hariexcel merged commit 0c40cb5 into main Jul 31, 2023
@hariexcel hariexcel deleted the autopr/1 branch July 31, 2023 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Snake game in python using AutoPR
1 participant