MCPcopy Create free account
hub / github.com/InternScience/InternAgent / score_batch

Method score_batch

internagent/mas/agents/survey_agent.py:224–289  ·  view source on GitHub ↗
(batch_index, batch, semaphore)

Source from the content-addressed store, hash-verified

222 # Helper: scoring single batch
223 # ------------------------------------------------------------
224 async def score_batch(batch_index, batch, semaphore):
225 async with semaphore:
226 # Prepare papers (content fallback to abstract)
227 abs_batch = [
228 {
229 'id': paper['id'],
230 'title': paper['title'],
231 'content': paper['content'] if paper['content'] else paper['abstract']
232 }
233 for paper in batch
234 ]
235
236 # Build prompt
237 if io_description is not None:
238 prompt = (
239 "You are a precise and reliable literature-review scoring assistant.\n\n"
240 "Read each paper in the list below and assign a score to each one individually.\n"
241 "Each paper is a dictionary containing: id, title, and content.\n\n"
242 "Scoring criteria:\n"
243 f"1. Relevance to the domain: {domain}\n"
244 f"2. Input/Output match:\n"
245 f" - Input: {io_description[0]}\n"
246 f" - Output: {io_description[1]}\n"
247 "3. Empirical novelty of the method\n"
248 "4. Interestingness and meaningfulness\n\n"
249 "Instructions:\n"
250 "- Score each paper independently.\n"
251 "- Use a scoring scale from 1 to 10 (10 = excellent match).\n"
252 "- Do NOT add new papers. Do NOT modify IDs.\n"
253 "- Return only a JSON object where:\n"
254 " keys = paper.id\n"
255 " values = numeric scores\n\n"
256 f"The papers to score are:\n{abs_batch}\n\n"
257 "Return JSON only."
258 )
259 else:
260 prompt = (
261 "You are a precise and reliable literature-review scoring assistant.\n\n"
262 "Read each paper in the list below and assign a score to each one individually.\n"
263 "Each paper is a dictionary containing: id, title, and content.\n\n"
264 "Scoring criteria:\n"
265 "1. Relevance to the target topic\n"
266 "2. Novelty\n"
267 "3. Empirical strength\n"
268 "4. Meaningfulness\n\n"
269 "Instructions:\n"
270 "- Score each paper independently.\n"
271 "- Use a scoring scale from 1 to 10.\n"
272 "- Do NOT add new papers. Do NOT modify IDs.\n"
273 "- Return only a JSON object where:\n"
274 " keys = paper.id\n"
275 " values = numeric scores\n\n"
276 f"The papers to score are:\n{abs_batch}\n\n"
277 "Return JSON only."
278 )
279
280 # Call model
281 try:

Callers

nothing calls this directly

Calls 1

_call_modelMethod · 0.80

Tested by

no test coverage detected