Refactor project structure and implement new features
- Removed unused security module and updated import paths. - Enhanced OpenAI client with streaming capabilities for chat completions. - Added new backend API endpoints for health check (ping). - Established a new FastAPI application with CORS configuration. - Created a new Appshell component for the frontend with navigation links. - Integrated SVG icons and improved styling for the Appshell component. - Implemented memory management for conversation history using PostgreSQL. - Developed abstract classes for AI agents and models, with OpenAI integration. - Added encryption utilities for secure data handling.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class ModeloABC(ABC):
|
||||
"""
|
||||
Clase base para definir la interfaz de un modelo conversacional.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
model: str,
|
||||
temperature: float = 0.7,
|
||||
top_p: float = 1.0,
|
||||
top_k: int = None,
|
||||
frecuencia_penalizacion: float = 0.0,
|
||||
num_tokens_maximos: int = 512
|
||||
):
|
||||
self.model = model
|
||||
self.temperature = temperature
|
||||
self.top_p = top_p
|
||||
self.top_k = top_k
|
||||
self.frecuencia_penalizacion = frecuencia_penalizacion
|
||||
self.num_tokens_maximos = num_tokens_maximos
|
||||
|
||||
@abstractmethod
|
||||
async def responder(self, prompt: str, system_prompt: str = "", stream: bool = False, **kwargs) -> str:
|
||||
"""
|
||||
Devuelve una respuesta a partir de un prompt y configuración del modelo.
|
||||
Este método debe implementarse de forma asíncrona en las subclases.
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user