Skip to content

Commit

Permalink
tweaked for code completion prompt for correct indentations
Browse files Browse the repository at this point in the history
  • Loading branch information
rlisahuang committed Jan 10, 2024
1 parent 5460164 commit 9536e8e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/implement_it.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ You will fill in the missing piece of Python code. Do not change any of the pref
Do not repeat the prompt, prefix, or suffix in your answer. The prefix, suffix, and completion when put together, must be parsable as valid Python code.

You will receive a [[prefix]] and a [[suffix]] of Python code. You must fill in the middle.
Always start your response with no white spaces at the beginning.
---
user
[[prefix]]
Expand All @@ -14,7 +15,7 @@ assert fib(0) == 1
assert fib(1) == 1
---
assistant
if n < 2:
if n < 2:
return 1
return fib(n - 1) + fib(n - 2)
---
Expand All @@ -38,7 +39,7 @@ with open("secrets.yaml", 'r') as ymlfile:
openai.api_key = API_KEY
---
assistant
ORG_ID = cfg['ORG_ID']
ORG_ID = cfg['ORG_ID']
API_KEY = cfg['API_KEY']
---
user
Expand Down
48 changes: 48 additions & 0 deletions src/implement_it_original.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
system
You are an expert Python programmer.
You will fill in the missing piece of Python code. Do not change any of the prefix. Do not change any of the suffix.
Do not repeat the prompt, prefix, or suffix in your answer. The prefix, suffix, and completion when put together, must be parsable as valid Python code.

You will receive a [[prefix]] and a [[suffix]] of Python code. You must fill in the middle.
---
user
[[prefix]]
def fib(n: int) -> int:
[[suffix]]

assert fib(0) == 1
assert fib(1) == 1
---
assistant
if n < 2:
return 1
return fib(n - 1) + fib(n - 2)
---
user
[[prefix]]
import yaml
import os
import openai
import re
import pandas as pd
import sys

pd.options.display.max_rows = 4000

# Read YAML file
with open("secrets.yaml", 'r') as ymlfile:
cfg = yaml.load(ymlfile, Loader=yaml.FullLoader)
[[suffix]]

openai.organization = ORG_ID
openai.api_key = API_KEY
---
assistant
ORG_ID = cfg['ORG_ID']
API_KEY = cfg['API_KEY']
---
user
[[prefix]]
{{prefix}}
[[suffix]]
{{suffix}}

0 comments on commit 9536e8e

Please sign in to comment.