feat: migrate agent core to pydantic-ai framework
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import logging
|
||||
from typing import Any, Callable
|
||||
from pydantic_ai import Agent, RunContext
|
||||
from pydantic_ai.exceptions import ModelRetry
|
||||
from core.agent import BaseAgent
|
||||
from core.prompts import NOTIFICATION_READER_SYSTEM_PROMPT
|
||||
from core.notification_tools import NotificationTools
|
||||
from core.schemas import NotificationDecision
|
||||
|
||||
logger: logging.Logger = logging.getLogger("agent-notification-reader")
|
||||
|
||||
@@ -13,13 +16,12 @@ class NotificationNoToolCalledError(Exception):
|
||||
|
||||
|
||||
class NotificationReaderAgent(BaseAgent):
|
||||
"""AI agent that reviews Gitea notifications and decides how to route them."""
|
||||
"""AI agent that reviews Gitea notifications and decides how to route them using Pydantic AI."""
|
||||
|
||||
def __init__(self, model_name: str) -> None:
|
||||
super().__init__(model_name)
|
||||
self.system_prompt: str = NOTIFICATION_READER_SYSTEM_PROMPT
|
||||
|
||||
|
||||
async def decide_notification(
|
||||
self,
|
||||
mission: str,
|
||||
|
||||
Reference in New Issue
Block a user