Skip to content

Commit

Permalink
update finetuning example to ensure asst messages are the last to appear
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdai committed Sep 23, 2024
1 parent dacb06f commit 7a80e4c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions arc_finetuning_st/finetuning/finetuning_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ def from_attempts(
),
]
)

# always end with an asst message or else openai finetuning job will failt
if a.critique == "This predicted output is correct.":
final_asst_message = ChatMessage(
role=MessageRole.ASSISTANT,
content="Glad, we were able to solve the puzzle!",
)
else:
final_asst_message = ChatMessage(
role=MessageRole.ASSISTANT,
content="Thanks for the feedback. I'll incorporate this into my next prediction.",
)

messages.append(final_asst_message)
return cls(messages=messages, task_name=task_name)

def to_json(self) -> str:
Expand Down

0 comments on commit 7a80e4c

Please sign in to comment.