项目文件夹

文件
Gelei Deng 6a767aae02 Model support (#274)
* feat: 🎸 add new models

* minor readme update

* style: format code with Black

This commit fixes the style issues introduced in dafa18b according to the output
from Black.

Details: https://github.com/GreyDGL/PentestGPT/pull/274

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2025-05-01 18:02:42 +08:00

35 行
991 B
Python

from abc import ABC, abstractmethod
from loguru import logger
class BaseModel(ABC):
def __init__(self, model_name):
self.model_name = model_name
self.logger = logger
self.streaming_callback = None
async def generate_response(
self, user_prompt: str, conversation: list = None, **kwargs
) -> str:
"""
Generate a response based on the conversation
:param user_prompt: user prompt
:param conversation: list of conversation
:param kwargs: additional parameters
:return: llm response
"""
pass
async def generate_json_response(self, conversation: list, **kwargs) -> dict:
"""
Generate a response based on the conversation
:param conversation: list of conversation
:param kwargs: additional parameters
:return: llm response
"""
pass
def set_streaming_callback(self, callback):
self.streaming_callback = callback