Generation from partially done JSON/List #694
Answered
by
rlouf
isamu-isozaki
asked this question in
Q&A
-
What I want is to complete a list of BaseTasks given couple BaseTasks are already defined like class CompletionStatus(str, Enum):
todo = 'todo'
done = 'done'
inprogress = "inprogress"
class BaseTask(BaseModel):
status: CompletionStatus
task_description: constr(max_length=50) |
Beta Was this translation helpful? Give feedback.
Answered by
rlouf
Feb 21, 2024
Replies: 1 comment 1 reply
-
If I understand correctly you can already do this, and it could be handled more elegantly once #667 is implemented. For instance: gen_choice = generate.choice(model, [", ", "]"])
gen_task = generate.json(model, BaseTask)
prompt = "[BaseTask1, BaseTask"
while True:
result = gen_choice(prompt)
if result == "]":
return prompt + "]"
else:
prompt += ", "
result = gen_task(prompt)
prompt += result |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
isamu-isozaki
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I understand correctly you can already do this, and it could be handled more elegantly once #667 is implemented. For instance: