|
|
|
|
|
by jameshiew
1731 days ago
|
|
I haven't used Github Copilot but from what I understand it generates a completion from the text already in your file. Since OpenAI Codex can "understand" natural language instructions, I've found putting code into a prompt with extra context in natural language on what needs to be achieved can give decent results. e.g to generate a docstring, you might use a Markdown-ish prompt like # Writing a good docstring
This is an example of writing a really good docstring that follows a best practice for the given language. Attention is paid to detailing things like
* parameter and return types (if applicable)
* any errors that might be raised or returned, depending on the language
I received the following code:
```{{{language}}}
{{{snippet}}}
```
The code with a really good docstring added is below:
```{{{language}}}
If you wanted a docstring in a particular format, you could add some specific examples as context to your prompt to get even better results. |
|