Skip to content

Commit

Permalink
only set role_key_tool if provided in the dataset constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
brianfitzgerald committed Mar 7, 2024
1 parent 2da71da commit 91e2c63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/axolotl/prompters.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,16 @@ class ShareGPTPrompter(Prompter): # pylint: disable=too-few-public-methods

role_key_human = "human"
role_key_model = "gpt"
role_key_tool = "tool"
# Optional, only used for tool usage datasets.
role_key_tool = None

def __init__(
self,
prompt_style=None, # pylint: disable=unused-argument
conversation: Optional[Union[str, Conversation]] = None,
role_key_human: Optional[str] = None,
role_key_model: Optional[str] = None,
role_key_tool: Optional[str] = None,
):
if conversation:
if isinstance(conversation, Conversation):
Expand All @@ -287,6 +289,8 @@ def __init__(
self.role_key_human = role_key_human
if role_key_model:
self.role_key_model = role_key_model
if role_key_tool:
self.role_key_tool = role_key_tool

def _build_result(self, source):
if len(source) < 2:
Expand Down

0 comments on commit 91e2c63

Please sign in to comment.