跳转至

Operation base

labridge.callback.base.operation_base

labridge.callback.base.operation_base.CallBackOperationBase

Bases: object

This is base class for callback operation. Here, callback operations indicate those operations requiring the user's permission.

PARAMETER DESCRIPTION
llm

The used LLM.

TYPE: LLM

embed_model

The used embedding model.

TYPE: BaseEmbedding

verbose

Whether to show the inner progress.

TYPE: bool DEFAULT: False

Source code in labridge\callback\base\operation_base.py
 8
 9
10
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
class CallBackOperationBase(object):
	r"""
	This is base class for callback operation.
	Here, callback operations indicate those operations requiring the user's permission.

	Args:
		llm (LLM): The used LLM.
		embed_model (BaseEmbedding): The used embedding model.
		verbose (bool): Whether to show the inner progress.
	"""
	def __init__(
		self,
		llm: LLM,
		embed_model: BaseEmbedding,
		op_name: str,
		verbose: bool = False,
	):
		self.op_name = op_name
		self._llm = llm
		self._embed_model = embed_model
		self._verbose = verbose

	@abstractmethod
	def operation_description(self, **kwargs) -> str:
		r""" This method return the description of the operation, which is presented to the users. """

	@abstractmethod
	def do_operation(self, **kwargs) -> OperationOutputLog:
		r""" This method will execute the operation when authorized. And return the operation log """

	@abstractmethod
	async def ado_operation(self, **kwargs) -> OperationOutputLog:
		r""" This method will asynchronously execute the operation when authorized. And return the operation log """

labridge.callback.base.operation_base.CallBackOperationBase.ado_operation(**kwargs) abstractmethod async

This method will asynchronously execute the operation when authorized. And return the operation log

Source code in labridge\callback\base\operation_base.py
38
39
40
@abstractmethod
async def ado_operation(self, **kwargs) -> OperationOutputLog:
	r""" This method will asynchronously execute the operation when authorized. And return the operation log """

labridge.callback.base.operation_base.CallBackOperationBase.do_operation(**kwargs) abstractmethod

This method will execute the operation when authorized. And return the operation log

Source code in labridge\callback\base\operation_base.py
34
35
36
@abstractmethod
def do_operation(self, **kwargs) -> OperationOutputLog:
	r""" This method will execute the operation when authorized. And return the operation log """

labridge.callback.base.operation_base.CallBackOperationBase.operation_description(**kwargs) abstractmethod

This method return the description of the operation, which is presented to the users.

Source code in labridge\callback\base\operation_base.py
30
31
32
@abstractmethod
def operation_description(self, **kwargs) -> str:
	r""" This method return the description of the operation, which is presented to the users. """