🔨 refactor(base.py): make function_name and initialize methods abstract
This commit makes the `function_name` and `initialize` methods abstract in the `CustomChain` and `CustomAgentExecutor` classes. This is done to enforce the implementation of these methods in the subclasses of these classes. This change improves the code quality and readability by making the code more explicit and easier to understand.
This commit is contained in:
parent
81d231c632
commit
85d2f9cce8
1 changed files with 4 additions and 0 deletions
|
|
@ -91,10 +91,12 @@ class CustomChain(Chain, ABC):
|
|||
"""Custom chain"""
|
||||
|
||||
@staticmethod
|
||||
@abstractmethod
|
||||
def function_name():
|
||||
return "CustomChain"
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def initialize(cls, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
|
@ -109,10 +111,12 @@ class CustomAgentExecutor(AgentExecutor, ABC):
|
|||
"""Custom chain"""
|
||||
|
||||
@staticmethod
|
||||
@abstractmethod
|
||||
def function_name():
|
||||
return "CustomChain"
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def initialize(cls, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue