openai chat speculative execution (#250)

Co-authored-by: Ying Sheng <sqy1415@gmail.com>
This commit is contained in:
LiviaSun
2024-05-18 22:23:53 -07:00
committed by GitHub
parent 5b647543c1
commit ec380dfd30
11 changed files with 316 additions and 45 deletions

View File

@@ -14,10 +14,25 @@ def gen_character_spec(s):
s += "\nJob:" + gen("job", stop="\n") + "\n"
@function(api_num_spec_tokens=64)
def gen_character_spec_no_few_shot(s):
# s += "Construct a character with name, birthday, and job:\n"
s += "Construct a character:\n"
s += "Name:" + gen("name", stop="\n") + "\nBirthday:" + gen("birthday", stop="\n")
s += "\nJob:" + gen("job", stop="\n") + "\n"
set_default_backend(OpenAI("gpt-3.5-turbo-instruct"))
state = gen_character_spec.run()
print("name:", state["name"])
print("birthday:", state["birthday"])
print("job:", state["job"])
print("...name:", state["name"])
print("...birthday:", state["birthday"])
print("...job:", state["job"])
state = gen_character_spec_no_few_shot.run()
print("\n...name:", state["name"])
print("...birthday:", state["birthday"])
print("...job:", state["job"])