MCPcopy Create free account
hub / github.com/bigcode-project/starcoder / get_dialogue

Method get_dialogue

chat/dialogues.py:68–78  ·  view source on GitHub ↗

Helper function to format the messages as an easy-to-read dialogue.

(self)

Source from the content-addressed store, hash-verified

66 return prompt
67
68 def get_dialogue(self):
69 """Helper function to format the messages as an easy-to-read dialogue."""
70 prompt = ""
71 if self.messages is None:
72 raise ValueError("Dialogue template must have at least one message.")
73 for message in self.messages:
74 if message["role"] == "user":
75 prompt += "\n\nHuman: " + message["content"]
76 else:
77 prompt += "\n\nAssistant: " + message["content"]
78 return prompt
79
80 def get_special_tokens(self) -> List[str]:
81 return [self.system_token, self.user_token, self.assistant_token, self.end_token]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected