This commit is contained in:
Noah Shinn 2023-03-28 21:10:06 -04:00
parent 2223481bfe
commit 975fc6fcd5
7 changed files with 22669 additions and 99 deletions

View File

@ -22,7 +22,7 @@ def gpt_completion(
stop_strs: Optional[List[str]] = None,
temperature: float = 0.0,
num_comps=1,
) -> List[str] | str:
) -> Union[List[str], str]:
response = openai.Completion.create(
model=model,
prompt=prompt,
@ -48,7 +48,7 @@ def gpt_chat(
max_tokens: int = 256,
temperature: float = 0.0,
num_comps=1,
) -> List[str] | str:
) -> Union[List[str], str]:
response = openai.ChatCompletion.create(
model=model,
messages=[

View File

@ -1,6 +1,6 @@
from .generator_utils import gpt_chat, gpt_completion
from typing import Optional, List
from typing import Optional, List, Union
PY_SIMPLE_COMPLETION_INSTRUCTION = "# Write the body of this function only."
PY_REFLEXION_COMPLETION_INSTRUCTION = "You are PythonGPT. You will be given your past function implementation, a series of unit tests, and a hint to change the implementation appropriately. Apply the changes below by writing the body of this function only.\n\n-----"
@ -64,7 +64,7 @@ def py_generate_func_impl(
self_reflection: Optional[str] = None,
num_comps: int = 1,
temperature: float = 0.0,
) -> str | List[str]:
) -> Union[str, List[str]]:
if strategy != "reflexion" and strategy != "simple":
raise ValueError(f"Invalid strategy: given `{strategy}` but expected one of `reflexion` or `simple`")
if strategy == "reflexion" and (prev_func_impl is None or feedback is None or self_reflection is None):

2
lazzzy

@ -1 +1 @@
Subproject commit 10aa52640c74ccb7512a7e4cb122a3c1c548ce7f
Subproject commit 404c06a5bf6201596b45d28f092aefe017306cd9

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
python main.py \
--run_name "reflexion_ucs_scratch" \
--run_name "reflexion_ucs_with_output2" \
--root_dir "root" \
--dataset_path ./human-eval/data/HumanEval.jsonl.gz \
--strategy "reflexion-ucs" \

22454
scratch/log Normal file

File diff suppressed because it is too large Load Diff