- Fixed ContextBuilder import in agent.py - Corrected AnthropicProvider to match BaseProvider interface - Fixed tool registry imports - Verified basic functionality with test - All 4 tools (read, write, edit, bash) now load correctly
36 lines
965 B
Python
36 lines
965 B
Python
"""
|
|
Base provider interface
|
|
"""
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Dict, List, Any, Optional
|
|
|
|
|
|
class BaseProvider(ABC):
|
|
"""Base class for LLM providers"""
|
|
|
|
def __init__(self, api_key: str, model: str):
|
|
self.api_key = api_key
|
|
self.model = model
|
|
|
|
@abstractmethod
|
|
async def generate_response(
|
|
self,
|
|
messages: List[Dict[str, Any]],
|
|
system_prompt: str,
|
|
tools: Optional[List[Dict[str, Any]]] = None,
|
|
max_tokens: int = 8192
|
|
) -> Dict[str, Any]:
|
|
"""
|
|
Generate a response from the LLM
|
|
|
|
Args:
|
|
messages: List of conversation messages
|
|
system_prompt: System prompt for the model
|
|
tools: List of available tools (optional)
|
|
max_tokens: Maximum tokens to generate
|
|
|
|
Returns:
|
|
Dict containing the response with 'content' and optional 'tool_calls'
|
|
"""
|
|
pass |