MCPcopy Index your code
hub / github.com/algorithmicsuperintelligence/optillm / execute_parallel_approaches

Function execute_parallel_approaches

optillm/server.py:495–502  ·  view source on GitHub ↗
(approaches, system_prompt, initial_query, client, model, request_config: dict = None)

Source from the content-addressed store, hash-verified

493 return final_response, total_tokens
494
495async def execute_parallel_approaches(approaches, system_prompt, initial_query, client, model, request_config: dict = None):
496 async def run_approach(approach):
497 return await asyncio.to_thread(execute_single_approach, approach, system_prompt, initial_query, client, model, request_config)
498
499 tasks = [run_approach(approach) for approach in approaches]
500 results = await asyncio.gather(*tasks)
501 responses, tokens = zip(*results)
502 return list(responses), sum(tokens)
503
504def execute_n_times(n: int, approaches, operation: str, system_prompt: str, initial_query: str, client: Any, model: str,
505 request_config: dict = None, request_id: str = None) -> Tuple[Union[str, List[str]], int]:

Callers 1

execute_n_timesFunction · 0.85

Calls 1

run_approachFunction · 0.70

Tested by

no test coverage detected