跳转至

Info base

labridge.interact.collect.types.info_base

labridge.interact.collect.types.info_base.CollectingBatchInfoBase

Bases: CollectingInfoBase

The CollectingInfo which can be collected in a batch mode.

Source code in labridge\interact\collect\types\info_base.py
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
class CollectingBatchInfoBase(CollectingInfoBase):
	r"""
	The CollectingInfo which can be collected in a batch mode.
	"""
	def __init__(
		self,
		info_name: str,
		info_description: str,
		info_type: CollectingInfoType,
	):
		super().__init__(
			info_name=info_name,
			info_description=info_description,
			info_type=info_type,
			batch_mode=True,
		)

	@abstractmethod
	def insert_info(self, **kwargs):
		r""" insert info """

labridge.interact.collect.types.info_base.CollectingBatchInfoBase.insert_info(**kwargs) abstractmethod

insert info

Source code in labridge\interact\collect\types\info_base.py
97
98
99
@abstractmethod
def insert_info(self, **kwargs):
	r""" insert info """

labridge.interact.collect.types.info_base.CollectingInfoBase

This is the base class for the CollectingInfo.

PARAMETER DESCRIPTION
info_name

The information name.

TYPE: str

info_description

The information description.

TYPE: str

info_type

The information type.

TYPE: CollectingInfoType

batch_mode

Whether the information can be collected in a batch mode.

TYPE: bool

Source code in labridge\interact\collect\types\info_base.py
11
12
13
14
15
16
17
18
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
class CollectingInfoBase:
	r"""
	This is the base class for the CollectingInfo.

	Args:
		info_name (str): The information name.
		info_description (str): The information description.
		info_type (CollectingInfoType): The information type.
		batch_mode (bool): Whether the information can be collected in a batch mode.
	"""
	def __init__(
		self,
		info_name: str,
		info_description: str,
		info_type: CollectingInfoType,
		batch_mode: bool,
	):
		self.info_name = info_name
		self.info_description = info_description
		self.info_type = info_type
		self._batch_mode = batch_mode
		self._collect_finish = False
		self._collected_infos = {}

	@abstractmethod
	def info_content(self) -> Dict[str, str]:
		r""" Yield the information to the LLM for extraction. """

	@abstractmethod
	def _required_infos(self) -> Dict[str, str]:
		r""" Required infos """

	@abstractmethod
	def update_collected_info(self, collected_info):
		r""" Update self._collected_infos """

	@property
	def required_infos(self) -> Dict[str, str]:
		r""" Required infos """
		return self._required_infos()

	@property
	def batch_mode(self) -> bool:
		return self._batch_mode

	@abstractmethod
	def _collected(self) -> bool:
		r""" Whether the collecting process ends. """

	@property
	def collected(self) -> bool:
		r""" Whether all required infos are collected. """
		return self._collected()

	@property
	def collected_infos(self) -> dict:
		r""" Return the collected info . """
		return self._collected_infos

	@abstractmethod
	def _collecting_keys(self) -> List[str]:
		r""" The keys in collecting. """

	@property
	def collecting_keys(self) -> List[str]:
		r""" The collecting information names. """
		return self._collecting_keys()

labridge.interact.collect.types.info_base.CollectingInfoBase.collected: bool property

Whether all required infos are collected.

labridge.interact.collect.types.info_base.CollectingInfoBase.collected_infos: dict property

Return the collected info .

labridge.interact.collect.types.info_base.CollectingInfoBase.collecting_keys: List[str] property

The collecting information names.

labridge.interact.collect.types.info_base.CollectingInfoBase.required_infos: Dict[str, str] property

Required infos

labridge.interact.collect.types.info_base.CollectingInfoBase.info_content() abstractmethod

Yield the information to the LLM for extraction.

Source code in labridge\interact\collect\types\info_base.py
35
36
37
@abstractmethod
def info_content(self) -> Dict[str, str]:
	r""" Yield the information to the LLM for extraction. """

labridge.interact.collect.types.info_base.CollectingInfoBase.update_collected_info(collected_info) abstractmethod

Update self._collected_infos

Source code in labridge\interact\collect\types\info_base.py
43
44
45
@abstractmethod
def update_collected_info(self, collected_info):
	r""" Update self._collected_infos """