Executor
执行器
dataclass
Executor(desc: str = 'Evaluating', show_progress: bool = True, keep_progress_bar: bool = True, jobs: List[Any] = list(), raise_exceptions: bool = False, batch_size: Optional[int] = None, run_config: Optional[RunConfig] = None, _nest_asyncio_applied: bool = False, pbar: Optional[tqdm] = None)
用于运行异步任务并进行进度跟踪和错误处理的 Executor 类。
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
desc |
str
|
进度条的描述 |
show_progress |
bool
|
是否显示进度条 |
keep_progress_bar |
bool
|
完成后是否保留进度条 |
jobs |
List[Any]
|
要执行的作业列表 |
raise_exceptions |
bool
|
是否抛出异常或记录它们 |
batch_size |
int
|
是否对(大量)任务列表进行批处理 |
run_config |
RunConfig
|
Configuration for the run |
_nest_asyncio_applied |
bool
|
是否已应用 nest_asyncio |
提交
提交一个要执行的作业,将可调用对象包装以添加错误处理和索引,从而跟踪作业索引。
Source code in ragas/src/ragas/executor.py
结果
执行所有提交的作业并返回它们的结果。结果按作业提交的顺序返回。
Source code in ragas/src/ragas/executor.py
run_async_batch
run_async_batch(desc: str, func: Callable, kwargs_list: List[Dict], batch_size: Optional[int] = None)
提供以不同参数并行运行相同异步函数的功能。