flare / llm /llm_interface.py
ciyidogan's picture
Upload 5 files
8304bb2 verified
raw
history blame
1.12 kB
"""
LLM Provider Interface for Flare
"""
import os
from abc import ABC, abstractmethod
from typing import Dict, List, Optional, Any
class LLMInterface(ABC):
"""Abstract base class for LLM providers"""
def __init__(self, settings: Dict[str, Any] = None):
"""Initialize with provider settings"""
self.settings = settings or {}
self.internal_prompt = self.settings.get("internal_prompt", "")
self.parameter_collection_config = self.settings.get("parameter_collection_config", {})
@abstractmethod
async def generate(self, system_prompt: str, user_input: str, context: List[Dict]) -> str:
"""Generate response from LLM"""
pass
@abstractmethod
async def startup(self, project_config: Dict) -> bool:
"""Initialize LLM with project config"""
pass
@abstractmethod
def get_provider_name(self) -> str:
"""Get provider name for logging"""
pass
@abstractmethod
def get_model_info(self) -> Dict[str, Any]:
"""Get model information"""
pass