-
Notifications
You must be signed in to change notification settings - Fork 1
/
orchestrator_helper.py
29 lines (24 loc) · 867 Bytes
/
orchestrator_helper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from typing import List
from ..orchestrator.orchestration_strategy import OrchestrationStrategy
from ..orchestrator import OrchestrationSettings
from ..orchestrator.strategies import get_orchestrator
__all__ = ["OrchestrationStrategy"]
class Orchestrator:
def __init__(self) -> None:
pass
async def handle_message(
self,
user_message: str,
chat_history: List[dict],
conversation_id: str,
orchestrator: OrchestrationSettings,
**kwargs: dict,
) -> dict:
orchestrator = get_orchestrator(orchestrator.strategy.value)
if orchestrator is None:
raise Exception(
f"Unknown orchestration strategy: {orchestrator.strategy.value}"
)
return await orchestrator.handle_message(
user_message, chat_history, conversation_id
)