2023-12-10 00:25:25 +08:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
2024-06-03 23:58:31 +08:00
|
|
|
|
2023-12-10 00:25:25 +08:00
|
|
|
class BaseAiHandler(ABC):
|
|
|
|
"""
|
2024-10-30 09:56:03 +09:00
|
|
|
This class defines the interface for an AI handler to be used by the PR Agents.
|
2023-12-10 00:25:25 +08:00
|
|
|
"""
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def __init__(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def deployment_id(self):
|
|
|
|
pass
|
|
|
|
|
2024-06-03 23:58:31 +08:00
|
|
|
@abstractmethod
|
2024-04-14 12:00:19 +03:00
|
|
|
async def chat_completion(self, model: str, system: str, user: str, temperature: float = 0.2, img_path: str = None):
|
2023-12-13 08:16:02 +08:00
|
|
|
"""
|
|
|
|
This method should be implemented to return a chat completion from the AI model.
|
|
|
|
Args:
|
|
|
|
model (str): the name of the model to use for the chat completion
|
|
|
|
system (str): the system message string to use for the chat completion
|
|
|
|
user (str): the user message string to use for the chat completion
|
2024-10-30 09:56:03 +09:00
|
|
|
temperature (float): the temperature to use for the chat completion
|
2023-12-13 08:16:02 +08:00
|
|
|
"""
|
2023-12-10 00:25:25 +08:00
|
|
|
pass
|