Files
NexQuant/rdagent/core/scenario.py
T

65 lines
1.8 KiB
Python
Raw Normal View History

2024-07-05 17:42:00 +08:00
from abc import ABC, abstractmethod
2024-09-29 18:43:17 +08:00
from rdagent.core.experiment import Task
2024-07-05 17:42:00 +08:00
class Scenario(ABC):
"""
We should include scenario information here. Following inform should not be included
- method related (e.g. rag... config for a concrete module)
"""
2024-07-05 17:42:00 +08:00
@property
@abstractmethod
2024-07-18 22:36:04 +08:00
def background(self) -> str:
2024-07-05 17:42:00 +08:00
"""Background information"""
2024-09-29 18:43:17 +08:00
# TODO: We have to change all the sub classes to override get_source_data_desc instead of `source_data`
def get_source_data_desc(self, task: Task | None = None) -> str: # noqa: ARG002
"""
Source data description
The choice of data may vary based on the specific task at hand.
"""
return ""
2024-07-05 17:42:00 +08:00
@property
2024-07-18 22:36:04 +08:00
def source_data(self) -> str:
2024-09-29 18:43:17 +08:00
"""
A convenient shortcut for describing source data
"""
return self.get_source_data_desc()
2024-07-05 17:42:00 +08:00
# NOTE: we should keep the interface simpler. So some previous interfaces are deleted.
# If we need some specific function only used in the subclass(no external usage).
# We should not set them in the base class
2024-07-05 17:42:00 +08:00
@property
@abstractmethod
def rich_style_description(self) -> str:
"""Rich style description to present"""
2024-07-05 17:42:00 +08:00
@abstractmethod
def get_scenario_all_desc(
self,
task: Task | None = None,
filtered_tag: str | None = None,
simple_background: bool | None = None,
) -> str:
2024-09-29 18:43:17 +08:00
"""
Combine all descriptions together
The scenario description varies based on the task being performed.
"""
@abstractmethod
def get_runtime_environment(self) -> str:
"""
Get the runtime environment information
"""
@property
def experiment_setting(self) -> str | None:
"""Get experiment setting and return as rich text string"""
return None