MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / query

Method query

trinity/buffer/storage/sql.py:261–282  ·  view source on GitHub ↗
(
        self, offset: int = 0, limit: int = 10, filters: Optional[Dict] = None
    )

Source from the content-addressed store, hash-verified

259 )
260
261 async def query(
262 self, offset: int = 0, limit: int = 10, filters: Optional[Dict] = None
263 ) -> List[Experience]:
264 await self.prepare()
265
266 async def operation(session: AsyncSession):
267 stmt = select(self.table_model_cls)
268 conditions = self._build_filter_conditions(filters)
269 if conditions:
270 stmt = stmt.where(and_(*conditions))
271 stmt = stmt.offset(offset).limit(limit)
272 result = await session.execute(stmt)
273 meta_rows = result.scalars().all()
274 if not meta_rows:
275 return []
276 ids = [row.id for row in meta_rows]
277 blob_map = await self._fetch_blobs(session, ids)
278 return self._assemble_experiences(meta_rows, blob_map)
279
280 return await async_run_with_retry_session(
281 self.session, operation, self.max_retry_times, self.max_retry_interval
282 )
283
284 @classmethod
285 async def load_from_dataset(

Callers 1

Calls 2

prepareMethod · 0.95

Tested by 1