camel.extractors 包#
子模块#
camel.extractors.base 模块#
- class camel.extractors.base.BaseExtractor(pipeline: List[List[BaseExtractorStrategy]], cache_templates: bool = True, max_cache_size: int = 1000, extraction_timeout: float = 30.0, batch_size: int = 10, monitoring_interval: float = 5.0, cpu_threshold: float = 80.0, memory_threshold: float = 85.0, **kwargs)[来源]#
基类:
object带有固定策略管道的响应提取器基类。
该提取器: - 采用固定的多阶段管道提取策略。 - 在每个阶段内按顺序尝试每种策略直到成功。 - 将前一阶段的输出作为下一阶段的输入进行处理。 - 支持异步执行以提高处理效率。 - 提供批量处理和资源监控选项。
- async cleanup() None[来源]#
清理提取器资源。
该方法负责清理资源并重置提取器状态。 它确保: 1. 所有资源都被正确释放 2. 模板缓存被清除 3. 并行处理资源被关闭 4. 状态被重置为初始状态 5. 即使发生错误也会执行清理
- Raises:
RuntimeError - 如果清理失败(在重置初始化状态后)。
模块内容#
- class camel.extractors.BaseExtractor(pipeline: List[List[BaseExtractorStrategy]], cache_templates: bool = True, max_cache_size: int = 1000, extraction_timeout: float = 30.0, batch_size: int = 10, monitoring_interval: float = 5.0, cpu_threshold: float = 80.0, memory_threshold: float = 85.0, **kwargs)[来源]#
基类:
object带有固定策略管道的响应提取器基类。
该提取器: - 采用固定的多阶段管道提取策略 - 在每阶段中按顺序尝试各个策略直至成功 - 将前一阶段的输出作为下一阶段的输入进行处理 - 支持异步执行以提高处理效率 - 提供批量处理和资源监控选项
- async cleanup() None[来源]#
清理提取器资源。
该方法负责清理资源并重置提取器状态。 它确保: 1. 所有资源都被正确释放 2. 模板缓存被清除 3. 并行处理资源被关闭 4. 状态被重置为初始状态 5. 即使发生错误也会执行清理
- Raises:
RuntimeError - 如果清理失败(在重置初始化状态后)。