Update mcp/orchestrator.py
Browse files- mcp/orchestrator.py +2 -6
mcp/orchestrator.py
CHANGED
@@ -16,8 +16,7 @@ from mcp.disgenet import disease_to_genes
|
|
16 |
from mcp.gemini import gemini_summarize, gemini_qa
|
17 |
from mcp.openai_utils import ai_summarize, ai_qa
|
18 |
|
19 |
-
|
20 |
-
def _safe_call(
|
21 |
func: Any,
|
22 |
*args,
|
23 |
default: Any = None,
|
@@ -27,13 +26,12 @@ def _safe_call(
|
|
27 |
Safely call an async function, returning a default on HTTP or other failures.
|
28 |
"""
|
29 |
try:
|
30 |
-
return await func(*args, **kwargs)
|
31 |
except httpx.HTTPStatusError:
|
32 |
return default
|
33 |
except Exception:
|
34 |
return default
|
35 |
|
36 |
-
|
37 |
async def _gather_tasks(tasks: List[asyncio.Task]) -> List[Any]:
|
38 |
"""
|
39 |
Await a list of asyncio.Tasks and return their results in order.
|
@@ -60,7 +58,6 @@ def _flatten_unique(items: List[Union[List[Any], Any]]) -> List[Any]:
|
|
60 |
flat.append(elem)
|
61 |
return flat
|
62 |
|
63 |
-
|
64 |
async def orchestrate_search(
|
65 |
query: str,
|
66 |
llm: Literal['openai', 'gemini'] = 'openai',
|
@@ -129,7 +126,6 @@ async def orchestrate_search(
|
|
129 |
'llm_used': llm_used,
|
130 |
}
|
131 |
|
132 |
-
|
133 |
async def answer_ai_question(
|
134 |
question: str,
|
135 |
context: str = "",
|
|
|
16 |
from mcp.gemini import gemini_summarize, gemini_qa
|
17 |
from mcp.openai_utils import ai_summarize, ai_qa
|
18 |
|
19 |
+
async def _safe_call(
|
|
|
20 |
func: Any,
|
21 |
*args,
|
22 |
default: Any = None,
|
|
|
26 |
Safely call an async function, returning a default on HTTP or other failures.
|
27 |
"""
|
28 |
try:
|
29 |
+
return await func(*args, **kwargs)
|
30 |
except httpx.HTTPStatusError:
|
31 |
return default
|
32 |
except Exception:
|
33 |
return default
|
34 |
|
|
|
35 |
async def _gather_tasks(tasks: List[asyncio.Task]) -> List[Any]:
|
36 |
"""
|
37 |
Await a list of asyncio.Tasks and return their results in order.
|
|
|
58 |
flat.append(elem)
|
59 |
return flat
|
60 |
|
|
|
61 |
async def orchestrate_search(
|
62 |
query: str,
|
63 |
llm: Literal['openai', 'gemini'] = 'openai',
|
|
|
126 |
'llm_used': llm_used,
|
127 |
}
|
128 |
|
|
|
129 |
async def answer_ai_question(
|
130 |
question: str,
|
131 |
context: str = "",
|