git clone https://github.com/Drwaish/DebugAndDocstringPrompt.git
cd DebugAndDocstringPrompt
Install dependencies
pip install openai
Paste openai api key for smooth running of code.
Open Repository in Visual Studio Code.
For locally test lambda function.
python lambda_function.py
For remotely test lambda function.
- Enter url in 'URL' variable
- Paste your code in 'code' variable
- Uncomment your request choice
Timeout for POST request is 5 seconds. If Internet connection is slow increase timeout span. Then
python script.py
User hit the lambda function with this payload.
{
"body" : {
"messages" :
[
{
"role": "system",
"content": "Your are a very helpful code debbuger. Debug the following code and fix the bugs."
},
{
"role": "user"
"content: "'''<Enter your code here>'''"
}
]
}
}
Payload return the docstring in google style.
{
"body": {
"messages" :
[
{
"role": "system",
"content": "'Parameters: \\n -------------- \\n Return\\n --------\\n Consider above to write docstring of following code in numpy style, consider only above two arguments in docstring and not write 'Notes' and 'Examples' in docstring."
},
{
"role": "user"
"content: "'''<Enter your code here>'''"
}
]
}
}
Payload return the docstring in google style.
{
"body": {
"messages" :
[
{
"role": "system",
"content": "Write docstring of following code in google style. "
},
{
"role": "user",
"content": "def data():\n return True"
}
]
}
}
Deploy on AWS Lambda and automate your work.