orchestrators
#
BaseOrchestrator #
基础: ABC
编排器的基类。
编排器的总体思路是管理服务之间的消息流。
给定一些状态和任务,确定要发布的下一批消息。然后,一旦消息处理完毕,用结果更新状态。
源代码位于 llama_deploy/orchestrators/base.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
get_next_messages 抽象方法
异步
#
get_next_messages(task_def: TaskDefinition, state: Dict[str, Any]) -> Tuple[List[QueueMessage], Dict[str, Any]]
获取要处理的下一条消息。返回消息和新状态。
源代码位于 llama_deploy/orchestrators/base.py
17 18 19 20 21 22 |
|
add_result_to_state 抽象方法
异步
#
add_result_to_state(result: TaskResult, state: Dict[str, Any]) -> Dict[str, Any]
将消息处理结果添加到状态中。返回新状态。
源代码位于 llama_deploy/orchestrators/base.py
24 25 26 27 28 29 |
|
SimpleOrchestrator #
基础: BaseOrchestrator
一个简单的编排器,用于处理服务和用户之间的编排。
目前,最终消息被发布到 `human` 消息队列以进行最终处理。
源代码位于 llama_deploy/orchestrators/simple.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
get_next_messages 异步
#
get_next_messages(task_def: TaskDefinition, state: Dict[str, Any]) -> Tuple[List[QueueMessage], Dict[str, Any]]
获取要处理的下一条消息。返回消息和新状态。
假设 agent_id(即服务名称)是下一条消息的目标。
运行所需的服务,然后将结果发送到最终消息类型。
源代码位于 llama_deploy/orchestrators/simple.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
add_result_to_state 异步
#
add_result_to_state(result: TaskResult, state: Dict[str, Any]) -> Dict[str, Any]
将消息处理结果添加到状态中。返回新状态。
源代码位于 llama_deploy/orchestrators/simple.py
84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
SimpleOrchestratorConfig #
基础: BaseSettings
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
max_retries
|
int
|
|
3
|
final_message_type
|
str | None
|
|
无
|
源代码位于 llama_deploy/orchestrators/simple.py
12 13 14 15 16 |
|