MCPcopy Create free account
hub / github.com/InternScience/SciReason / parse_template

Method parse_template

opencompass/models/base.py:149–161  ·  view source on GitHub ↗

Parse a prompt template, and wrap it with meta template if applicable. Args: prompt_template (List[PromptType]): A prompt template (potentially before being wrapped by meta template). mode (str): Parsing mode. Choices are 'ppl' and 'gen'.

(self, prompt_template: PromptType, mode: str)

Source from the content-addressed store, hash-verified

147 """
148
149 def parse_template(self, prompt_template: PromptType, mode: str) -> str:
150 """Parse a prompt template, and wrap it with meta template if
151 applicable.
152
153 Args:
154 prompt_template (List[PromptType]): A prompt
155 template (potentially before being wrapped by meta template).
156 mode (str): Parsing mode. Choices are 'ppl' and 'gen'.
157
158 Returns:
159 str: The final string.
160 """
161 return self.template_parser.parse_template(prompt_template, mode)
162
163 def get_ppl_from_template(self,
164 templates: List[PromptType],

Calls

no outgoing calls