MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/optillm / format_question

Function format_question

scripts/gen_optillmbench.py:138–154  ·  view source on GitHub ↗

Format a question for the benchmark dataset

(category: str, question: str, answer: str)

Source from the content-addressed store, hash-verified

136 return " ".join(text.replace("\r", "\n").split())
137
138def format_question(category: str, question: str, answer: str) -> Dict[str, Any]:
139 """Format a question for the benchmark dataset"""
140 # Basic sanity checks
141 if not question or not answer:
142 raise ValueError(f"Empty question or answer in {category}")
143
144 return {
145 "id": f"{category}_{random.getrandbits(32):08x}",
146 "category": category,
147 "question": clean_text(question),
148 "answer": clean_text(answer),
149 "metadata": {
150 "source": SOURCES[category]["name"],
151 "type": category,
152 "difficulty": "challenging" # All examples are chosen to be challenging
153 }
154 }
155
156def load_source_dataset(config: Dict[str, Any]) -> datasets.Dataset:
157 """Load a source dataset with error handling"""

Callers 1

Calls 1

clean_textFunction · 0.85

Tested by

no test coverage detected